Skip to content

Commit

Permalink
implemented filter on fermentation knock detection; closes #36
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Satrom committed Mar 25, 2019
1 parent 2cccc9a commit b3ad30f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions brew-buddy-firmware/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dependencies.Adafruit_ILI9341_RK=1.2.1
dependencies.Adafruit_ImageReader=1.0.8
dependencies.MQTT-TLS=0.2.20
dependencies.JsonParserGeneratorRK=0.0.6
dependencies.Debounce=0.0.1
5 changes: 3 additions & 2 deletions brew-buddy-firmware/src/brew-buddy-firmware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ unsigned long fermentationStartTime = 0;
QueueArray<long> knockArray;
float fermentationRate = 0; // knocks per ms
unsigned long lastKnock;
#define KNOCK_INTERVAL 50

String messageBase = "bb/";

Expand Down Expand Up @@ -184,7 +185,7 @@ void setup()

// Check and display the battery level
int battLevel = getBattPercentage();
//displayBattLevel(battLevel);
displayBattLevel(battLevel);

waitUntil(Particle.connected);

Expand Down Expand Up @@ -240,7 +241,7 @@ void loop()
waitUntil(Particle.connected);
Particle.publish(messageBase + "ferment/state", "start");
}
else
else if (millis() - lastKnock > KNOCK_INTERVAL)
{
knockArray.push(millis() - lastKnock);
lastKnock = millis();
Expand Down
5 changes: 3 additions & 2 deletions brew-buddy-firmware/src/brew-buddy-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ unsigned long fermentationStartTime = 0;
QueueArray<long> knockArray;
float fermentationRate = 0; // knocks per ms
unsigned long lastKnock;
#define KNOCK_INTERVAL 50

String messageBase = "bb/";

Expand Down Expand Up @@ -149,7 +150,7 @@ void setup()

// Check and display the battery level
int battLevel = getBattPercentage();
//displayBattLevel(battLevel);
displayBattLevel(battLevel);

waitUntil(Particle.connected);

Expand Down Expand Up @@ -205,7 +206,7 @@ void loop()
waitUntil(Particle.connected);
Particle.publish(messageBase + "ferment/state", "start");
}
else
else if (millis() - lastKnock > KNOCK_INTERVAL)
{
knockArray.push(millis() - lastKnock);
lastKnock = millis();
Expand Down

0 comments on commit b3ad30f

Please sign in to comment.