inputs: circadianrhythm: move strings to flashmem, merge duplicate loop algo

This commit is contained in:
Torrie Fischer 2023-12-23 11:04:15 +01:00
parent a5d468efde
commit 0106b09c9b

View File

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