diff --git a/brew-buddy-firmware/project.properties b/brew-buddy-firmware/project.properties index 955c1b8..7e6d121 100644 --- a/brew-buddy-firmware/project.properties +++ b/brew-buddy-firmware/project.properties @@ -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 diff --git a/brew-buddy-firmware/src/brew-buddy-firmware.cpp b/brew-buddy-firmware/src/brew-buddy-firmware.cpp index f242d62..8bfd6ff 100644 --- a/brew-buddy-firmware/src/brew-buddy-firmware.cpp +++ b/brew-buddy-firmware/src/brew-buddy-firmware.cpp @@ -136,6 +136,7 @@ unsigned long fermentationStartTime = 0; QueueArray knockArray; float fermentationRate = 0; // knocks per ms unsigned long lastKnock; +#define KNOCK_INTERVAL 50 String messageBase = "bb/"; @@ -184,7 +185,7 @@ void setup() // Check and display the battery level int battLevel = getBattPercentage(); - //displayBattLevel(battLevel); + displayBattLevel(battLevel); waitUntil(Particle.connected); @@ -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(); diff --git a/brew-buddy-firmware/src/brew-buddy-firmware.ino b/brew-buddy-firmware/src/brew-buddy-firmware.ino index 59c3318..0085d82 100644 --- a/brew-buddy-firmware/src/brew-buddy-firmware.ino +++ b/brew-buddy-firmware/src/brew-buddy-firmware.ino @@ -101,6 +101,7 @@ unsigned long fermentationStartTime = 0; QueueArray knockArray; float fermentationRate = 0; // knocks per ms unsigned long lastKnock; +#define KNOCK_INTERVAL 50 String messageBase = "bb/"; @@ -149,7 +150,7 @@ void setup() // Check and display the battery level int battLevel = getBattPercentage(); - //displayBattLevel(battLevel); + displayBattLevel(battLevel); waitUntil(Particle.connected); @@ -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();