Display also humidity and pressure
Display update triggered by value change, not interval
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
volatile unsigned long lastButtonPress = millis();
|
||||
|
||||
// Debouncing na timerze:
|
||||
// Debouncing using timer:
|
||||
// https://github.com/khoih-prog/TimerInterrupt/blob/master/examples/SwitchDebounce/SwitchDebounce.ino
|
||||
void initButton() {
|
||||
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
||||
@@ -9,17 +9,20 @@ void initButton() {
|
||||
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), buttonISRstate, RISING);
|
||||
}
|
||||
|
||||
// FIXME: runMetronome ISR should be started/stopped by button. Otherwise fraction of first PERIOD_MS is lost from countdown.
|
||||
void buttonISRstate() {
|
||||
if ((millis() - lastButtonPress) > 100) {
|
||||
if (countdown < 0)
|
||||
// TODO: enable metronome timer
|
||||
countdown = 0;
|
||||
else if (countdown == 0)
|
||||
else if (countdown == 0) {
|
||||
// TODO: restart metronome timer to align countdown
|
||||
countdown = COUNTDOWN;
|
||||
else {
|
||||
updateTube();
|
||||
} else {
|
||||
countdown = -1;
|
||||
digitalWrite(BUTTON_LED_PIN, LOW);
|
||||
updateTube();
|
||||
// TODO: disable metronome timer
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user