display sensor values only once on startup

This commit is contained in:
Nicu Hodos 2024-06-01 22:03:54 +02:00
parent 8a955fa43a
commit 16647d1f88
3 changed files with 3 additions and 2 deletions

View File

@ -58,6 +58,7 @@ namespace Devices {
[](const char* msg) {
if (strcmp("PRESS", msg) == 0 && !Display::tDisplaySensor.isEnabled()) {
Bme::data.readAll();
Display::tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS);
Display::tDisplaySensor.restart();
};
}

View File

@ -33,7 +33,7 @@ namespace Display {
tDisplayTime.disable();
return true;
}, []() {
tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS);
tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS*2);
tDisplayTime.enableDelayed(tDisplaySensor.getInterval());
});

View File

@ -30,6 +30,7 @@ void turnLed(bool on = true) {
Task tButton(TASK_IMMEDIATE, TASK_ONCE, []() {
if (Display::tDisplaySensor.isEnabled()) return;
Bme::data.readAll();
Display::tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS);
Display::tDisplaySensor.restart();
}, &ts);
Task tLed(TASK_IMMEDIATE, TASK_ONCE, []() {
@ -44,7 +45,6 @@ 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*2);
Display::tDisplaySensor.restart();
}
}, &ts);