diff --git a/include/devices.h b/include/devices.h index b4dd440..21ee6c1 100644 --- a/include/devices.h +++ b/include/devices.h @@ -79,7 +79,6 @@ namespace Devices { [](const char* msg) { if (strcmp("PRESS", msg) == 0 && !Display::tDisplaySensor.isEnabled()) { Bme::data.readAll(); - Display::tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS); Display::displayTask.activate(Display::tDisplaySensor); }; } diff --git a/include/display.h b/include/display.h index 8457455..c85ccc0 100644 --- a/include/display.h +++ b/include/display.h @@ -70,7 +70,7 @@ namespace Display { return true; }, []() { - tDisplaySensor.setIterations((DISPLAY_SENSOR_ITERATIONS - 1) * 2 + 1); + tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS); displayTask.restorePerm(); }); Task tDisplayDate(SECONDS(5), TASK_ONCE + 1, displayDate, &ts, false, nullptr, diff --git a/src/esp_clock.cpp b/src/esp_clock.cpp index 3d800a5..81e27ca 100644 --- a/src/esp_clock.cpp +++ b/src/esp_clock.cpp @@ -30,7 +30,6 @@ Task tButton(TASK_IMMEDIATE, TASK_ONCE, []() { if (Display::tDisplaySensor.isEnabled()) return; Bme::data.readAll(); - Display::tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS); Display::displayTask.activate(Display::tDisplaySensor); }, &ts); Task tLed(TASK_IMMEDIATE, TASK_ONCE, @@ -46,6 +45,7 @@ Task tReadBme(TASK_MINUTE, TASK_FOREVER, []() { Devices::publishBme280(); if (abs(lastTemp - Bme::data.temp) > 0.2) { lastTemp = Bme::data.temp; + Display::tDisplaySensor.setIterations((DISPLAY_SENSOR_ITERATIONS - 1) * 2 + 1); Display::displayTask.activate(Display::tDisplaySensor); } }, &ts); @@ -89,7 +89,8 @@ void setup() { attachInterrupt(digitalPinToInterrupt(BUTTON), onButtonPressed, FALLING); attachInterrupt(digitalPinToInterrupt(LED_BUILTIN), onLed, CHANGE); - tReadBme.enable(); + tReadBme.enableDelayed(); + tButton.restart(); } void loop() {