Display also humidity and pressure

Display update triggered by value change, not interval
This commit is contained in:
cryptogopher
2026-02-12 00:10:45 +01:00
parent 0c9a7a51d9
commit c2af98d588
5 changed files with 116 additions and 33 deletions

View File

@@ -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
}
}