inputs: circadianrhythm: move strings to flashmem, merge duplicate loop algo
This commit is contained in:
parent
a5d468efde
commit
0106b09c9b
@ -37,14 +37,9 @@ class CircadianRhythm : public InputSource {
|
|||||||
// Find the last hour that is prior to or equal to now
|
// Find the last hour that is prior to or equal to now
|
||||||
if (cur.hour <= hour) {
|
if (cur.hour <= hour) {
|
||||||
start = cur;
|
start = cur;
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(ScheduleEntry cur : schedule) {
|
|
||||||
// Find the first hour that is after now
|
// Find the first hour that is after now
|
||||||
// If no such hour exists, we should automatically wrap back to hour 0
|
// If no such hour exists, we should automatically wrap back to hour 0
|
||||||
if (cur.hour > hour) {
|
} else if (cur.hour > hour) {
|
||||||
end = cur;
|
end = cur;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -83,9 +78,9 @@ class CircadianRhythm : public InputSource {
|
|||||||
hour = 0;
|
hour = 0;
|
||||||
minute = 0;
|
minute = 0;
|
||||||
}
|
}
|
||||||
Log.notice("Current time: %d:%d", hour, minute);
|
Log.notice(F("Current time: %d:%d"), hour, minute);
|
||||||
auto brightness = brightnessForTime(hour, minute);
|
auto brightness = brightnessForTime(hour, minute);
|
||||||
Log.notice("Adjusting brightness to %d", brightness);
|
Log.notice(F("Adjusting brightness to %d"), brightness);
|
||||||
return InputEvent{InputEvent::SetBrightness, brightness};
|
return InputEvent{InputEvent::SetBrightness, brightness};
|
||||||
}
|
}
|
||||||
return InputEvent{};
|
return InputEvent{};
|
||||||
|
Loading…
Reference in New Issue
Block a user