diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-10-03 20:37:15 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-10-03 20:47:15 -0400 |
commit | 4300dff61631143f794f186cadb222bdf5f75a06 (patch) | |
tree | 85608336dcb17dc2140c33c092eb81c114d9df49 /launcher/widgets | |
parent | 64485b4255271dca8d6d38a91fa9ace610bf7222 (diff) | |
download | Sensor-Watch-4300dff61631143f794f186cadb222bdf5f75a06.tar.gz Sensor-Watch-4300dff61631143f794f186cadb222bdf5f75a06.tar.bz2 Sensor-Watch-4300dff61631143f794f186cadb222bdf5f75a06.zip |
launcher: first crack at low power 'screensaver' mode
Diffstat (limited to 'launcher/widgets')
-rw-r--r-- | launcher/widgets/clock/simple_clock_widget.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/launcher/widgets/clock/simple_clock_widget.c b/launcher/widgets/clock/simple_clock_widget.c index 51c6c9c6..29a53b41 100644 --- a/launcher/widgets/clock/simple_clock_widget.c +++ b/launcher/widgets/clock/simple_clock_widget.c @@ -27,17 +27,18 @@ void simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, u watch_date_time date_time; uint32_t previous_date_time; switch (event) { - case EVENT_TICK: case EVENT_ACTIVATE: + case EVENT_TICK: + case EVENT_SCREENSAVER: date_time = watch_rtc_get_date_time(); previous_date_time = *((uint32_t *)context); *((uint32_t *)context) = date_time.reg; - if (date_time.reg >> 6 == previous_date_time >> 6) { + if (date_time.reg >> 6 == previous_date_time >> 6 && event != EVENT_SCREENSAVER) { // everything before seconds is the same, don't waste cycles setting those segments. pos = 8; sprintf(buf, "%02d", date_time.unit.second); - } else if (date_time.reg >> 12 == previous_date_time >> 12) { + } else if (date_time.reg >> 12 == previous_date_time >> 12 && event != EVENT_SCREENSAVER) { // everything before minutes is the same. pos = 6; sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second); @@ -54,7 +55,11 @@ void simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, u if (date_time.unit.hour == 0) date_time.unit.hour = 12; } pos = 0; - sprintf(buf, "%s%2d%2d%02d%02d", weekdays[simple_clock_widget_get_weekday(date_time.unit.year, date_time.unit.month, date_time.unit.day)], date_time.unit.day, date_time.unit.hour, date_time.unit.minute, date_time.unit.second); + if (event == EVENT_SCREENSAVER) { + sprintf(buf, "%s%2d%2d%02d ", weekdays[simple_clock_widget_get_weekday(date_time.unit.year, date_time.unit.month, date_time.unit.day)], date_time.unit.day, date_time.unit.hour, date_time.unit.minute); + } else { + sprintf(buf, "%s%2d%2d%02d%02d", weekdays[simple_clock_widget_get_weekday(date_time.unit.year, date_time.unit.month, date_time.unit.day)], date_time.unit.day, date_time.unit.hour, date_time.unit.minute, date_time.unit.second); + } } watch_display_string(buf, pos); break; |