movement: add tick animation in sleep mode
This commit is contained in:
parent
75be621914
commit
148a47f76a
@ -9,9 +9,10 @@ void simple_clock_face_setup(movement_settings_t *settings, void ** context_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void simple_clock_face_activate(movement_settings_t *settings, void *context) {
|
void simple_clock_face_activate(movement_settings_t *settings, void *context) {
|
||||||
if (settings->bit.clock_mode_24h) {
|
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
|
||||||
}
|
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
// this ensures that none of the timestamp fields will match, so we can re-render them all.
|
// this ensures that none of the timestamp fields will match, so we can re-render them all.
|
||||||
*((uint32_t *)context) = 0xFFFFFFFF;
|
*((uint32_t *)context) = 0xFFFFFFFF;
|
||||||
@ -55,6 +56,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
|
|||||||
}
|
}
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
||||||
|
if (!watch_tick_animation_is_running()) watch_start_tick_animation(500);
|
||||||
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);
|
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 {
|
} 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);
|
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);
|
||||||
|
@ -277,6 +277,10 @@ void watch_start_tick_animation(uint32_t duration) {
|
|||||||
slcd_sync_start_animation(&SEGMENT_LCD_0, segs, 1, duration);
|
slcd_sync_start_animation(&SEGMENT_LCD_0, segs, 1, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool watch_tick_animation_is_running() {
|
||||||
|
return hri_slcd_get_CTRLD_CSREN_bit(SLCD);
|
||||||
|
}
|
||||||
|
|
||||||
void watch_stop_tick_animation() {
|
void watch_stop_tick_animation() {
|
||||||
const uint32_t segs[] = { SLCD_SEGID(0, 2)};
|
const uint32_t segs[] = { SLCD_SEGID(0, 2)};
|
||||||
slcd_sync_stop_animation(&SEGMENT_LCD_0, segs, 1);
|
slcd_sync_stop_animation(&SEGMENT_LCD_0, segs, 1);
|
||||||
|
@ -138,6 +138,11 @@ void watch_stop_blink();
|
|||||||
*/
|
*/
|
||||||
void watch_start_tick_animation(uint32_t duration);
|
void watch_start_tick_animation(uint32_t duration);
|
||||||
|
|
||||||
|
/** @brief Checks if the tick animation is currently running.
|
||||||
|
* @return true if the animation is running; false otherwise.
|
||||||
|
*/
|
||||||
|
bool watch_tick_animation_is_running();
|
||||||
|
|
||||||
/** @brief Stops the tick/tock animation and clears all animating segments.
|
/** @brief Stops the tick/tock animation and clears all animating segments.
|
||||||
* @details This will stop the animation and clear all segments in position 8.
|
* @details This will stop the animation and clear all segments in position 8.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user