From 0106b09c9bdcb3d9bea9d5bda92256cc64fd204c Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Sat, 23 Dec 2023 11:04:15 +0100 Subject: [PATCH] inputs: circadianrhythm: move strings to flashmem, merge duplicate loop algo --- src/inputs/CircadianRhythm.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/inputs/CircadianRhythm.h b/src/inputs/CircadianRhythm.h index a8b608e..0605d4c 100644 --- a/src/inputs/CircadianRhythm.h +++ b/src/inputs/CircadianRhythm.h @@ -37,14 +37,9 @@ class CircadianRhythm : public InputSource { // Find the last hour that is prior to or equal to now if (cur.hour <= hour) { start = cur; - } else { - break; - } - } - for(ScheduleEntry cur : schedule) { // Find the first hour that is after now // If no such hour exists, we should automatically wrap back to hour 0 - if (cur.hour > hour) { + } else if (cur.hour > hour) { end = cur; break; } @@ -83,9 +78,9 @@ class CircadianRhythm : public InputSource { hour = 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); - Log.notice("Adjusting brightness to %d", brightness); + Log.notice(F("Adjusting brightness to %d"), brightness); return InputEvent{InputEvent::SetBrightness, brightness}; } return InputEvent{};