early work on background tasks, documentation

This commit is contained in:
Joey Castillo
2021-10-16 16:03:27 -04:00
parent 458ebf6987
commit 0cfb37c671
7 changed files with 102 additions and 7 deletions

View File

@@ -28,16 +28,16 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
switch (event.event_type) {
case EVENT_ACTIVATE:
case EVENT_TICK:
case EVENT_LOW_POWER_TICK:
case EVENT_LOW_ENERGY_UPDATE:
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 && event.event_type != EVENT_LOW_POWER_TICK) {
if (date_time.reg >> 6 == previous_date_time >> 6 && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
// 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 && event.event_type != EVENT_LOW_POWER_TICK) {
} else if (date_time.reg >> 12 == previous_date_time >> 12 && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
// everything before minutes is the same.
pos = 6;
sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
@@ -54,7 +54,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
}
pos = 0;
if (event.event_type == EVENT_LOW_POWER_TICK) {
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
sprintf(buf, "%s%2d%2d%02d ", weekdays[simple_clock_face_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_face_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);

View File

@@ -15,6 +15,7 @@ uint8_t simple_clock_face_get_weekday(uint16_t day, uint16_t month, uint16_t yea
simple_clock_face_activate, \
simple_clock_face_loop, \
simple_clock_face_resign, \
NULL, \
}
#endif // FAKE_FACE_H_

View File

@@ -19,6 +19,7 @@ void pulseometer_face_resign(movement_settings_t *settings, void *context);
pulseometer_face_activate, \
pulseometer_face_loop, \
pulseometer_face_resign, \
NULL, \
}
#endif // PULSEOMETER_FACE_H_

View File

@@ -13,6 +13,7 @@ void preferences_face_resign(movement_settings_t *settings, void *context);
preferences_face_activate, \
preferences_face_loop, \
preferences_face_resign, \
NULL, \
}
#endif // PREFERENCES_FACE_H_

View File

@@ -13,6 +13,7 @@ void set_time_face_resign(movement_settings_t *settings, void *context);
set_time_face_activate, \
set_time_face_loop, \
set_time_face_resign, \
NULL, \
}
#endif // SET_TIME_FACE_H_