fix issue with overlapping display of sensor and date by allowing them to be displayed only when time is being displayed
This commit is contained in:
parent
b7b8fc603d
commit
06cdca9036
@ -16,7 +16,7 @@
|
||||
#define MILLISECONDS(value) value*TASK_MILLISECOND
|
||||
#define SECONDS(value) value*TASK_SECOND
|
||||
#define MINUTES(value) value*TASK_MINUTE
|
||||
#define DISPLAY_SENSOR_ITERATIONS 2
|
||||
#define DISPLAY_SENSOR_ITERATIONS 2+1
|
||||
#define DISPLAY_DELAY (SECONDS(2))
|
||||
|
||||
namespace Display {
|
||||
@ -35,23 +35,25 @@ namespace Display {
|
||||
[]() {
|
||||
drawColon(false);
|
||||
});
|
||||
Task tDisplaySensor(SECONDS(5), DISPLAY_SENSOR_ITERATIONS, displayTemp, &ts, false,
|
||||
Task tDisplaySensor(SECONDS(5), DISPLAY_SENSOR_ITERATIONS, nullptr, &ts, false,
|
||||
[]() {
|
||||
if (!tDisplayTime.isEnabled()) return false;
|
||||
tDisplayTime.disable();
|
||||
tDisplaySensor.setCallback(displayTemp);
|
||||
return true;
|
||||
},
|
||||
[]() {
|
||||
tDisplaySensor.setIterations(DISPLAY_SENSOR_ITERATIONS * 2);
|
||||
tDisplayTime.enableDelayed(tDisplaySensor.getInterval());
|
||||
tDisplaySensor.setIterations((DISPLAY_SENSOR_ITERATIONS - 1) * 2 + 1);
|
||||
tDisplayTime.enable();
|
||||
});
|
||||
Task tDisplayDate(TASK_IMMEDIATE, TASK_ONCE, displayDate, &ts, false,
|
||||
Task tDisplayDate(SECONDS(5), TASK_ONCE + 1, displayDate, &ts, false,
|
||||
[]() {
|
||||
if (!tDisplayTime.isEnabled()) return false;
|
||||
tDisplayTime.disable();
|
||||
tDisplaySensor.disable();
|
||||
return true;
|
||||
},
|
||||
[]() {
|
||||
tDisplayTime.enableDelayed(SECONDS(5));
|
||||
tDisplayTime.enable();
|
||||
});
|
||||
|
||||
bool hourFormat24 = false;
|
||||
@ -204,5 +206,6 @@ namespace Display {
|
||||
void setup() {
|
||||
clockDisplay.begin(DISPLAY_ADDRESS);
|
||||
clockDisplay.setBrightness(Brightness::current);
|
||||
tDisplayTime.enable();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user