blink colon when clock is in sleep mode (custom LCD only)
This commit is contained in:
parent
15fcfbc63a
commit
e5b458fe3b
@ -201,12 +201,14 @@ static void clock_display_low_energy(watch_date_time date_time) {
|
||||
static void clock_start_tick_tock_animation(void) {
|
||||
if (!watch_sleep_animation_is_running()) {
|
||||
watch_start_sleep_animation(500);
|
||||
watch_start_indicator_blink_if_possible(WATCH_INDICATOR_COLON, 500);
|
||||
}
|
||||
}
|
||||
|
||||
static void clock_stop_tick_tock_animation(void) {
|
||||
if (watch_sleep_animation_is_running()) {
|
||||
watch_stop_sleep_animation();
|
||||
watch_stop_blink();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -106,9 +106,51 @@ void watch_start_character_blink(char character, uint32_t duration) {
|
||||
watch_display_character(character, 7);
|
||||
watch_clear_pixel(2, 10); // clear segment B of position 7 since it can't blink
|
||||
|
||||
slcd_disable();
|
||||
slcd_set_blink_enabled(false);
|
||||
slcd_configure_blink(false, 0x07, 0x07, 0);
|
||||
slcd_configure_blink(false, 0x0F, 0x0F, 0);
|
||||
slcd_set_blink_enabled(true);
|
||||
slcd_enable();
|
||||
}
|
||||
|
||||
void watch_start_indicator_blink_if_possible(watch_indicator_t indicator, uint32_t duration) {
|
||||
#ifdef USE_CUSTOM_LCD
|
||||
uint8_t mask = 0;
|
||||
switch (indicator) {
|
||||
case WATCH_INDICATOR_COLON:
|
||||
mask = 0b0001;
|
||||
break;
|
||||
case WATCH_INDICATOR_LAP:
|
||||
mask = 0b0010;
|
||||
break;
|
||||
case WATCH_INDICATOR_BATTERY:
|
||||
mask = 0b0100;
|
||||
break;
|
||||
case WATCH_INDICATOR_SLEEP:
|
||||
mask = 0b1000;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
watch_set_indicator(indicator);
|
||||
|
||||
if (duration <= _slcd_fc_min_ms_bypass) {
|
||||
slcd_configure_frame_counter(0, (duration / (1000 / _slcd_framerate)) - 1, false);
|
||||
} else {
|
||||
slcd_configure_frame_counter(0, ((duration / (1000 / _slcd_framerate)) / 8 - 1), true);
|
||||
}
|
||||
slcd_set_frame_counter_enabled(0, true);
|
||||
|
||||
|
||||
slcd_disable();
|
||||
slcd_set_blink_enabled(false);
|
||||
slcd_configure_blink(false, mask, 0, 0);
|
||||
slcd_set_blink_enabled(true);
|
||||
slcd_enable();
|
||||
#else
|
||||
(void) indicator;
|
||||
(void) duration;
|
||||
#endif
|
||||
}
|
||||
|
||||
void watch_stop_blink(void) {
|
||||
|
||||
@ -57,6 +57,9 @@ typedef enum {
|
||||
// These next indicators are only available on the new custom LCD:
|
||||
WATCH_INDICATOR_BATTERY, ///< The battery indicator. Will fall back to the LAP icon on the original F-91W LCD.
|
||||
WATCH_INDICATOR_SLEEP, ///< The sleep indicator. No fallback here; use the tick animation to indicate sleep.
|
||||
|
||||
// You can generally address the colon using dedicated functions, but it's also available here if needed.
|
||||
WATCH_INDICATOR_COLON, ///< The colon between hours and minutes.
|
||||
} watch_indicator_t;
|
||||
|
||||
/// An enum listing the locations on the display where text can be placed.
|
||||
@ -197,15 +200,26 @@ void watch_clear_all_indicators(void);
|
||||
* @param character The character you wish to blink.
|
||||
* @param duration The duration of the on/off cycle in milliseconds, from 50 to ~4250 ms.
|
||||
* @note Segment B of position 7 cannot blink autonomously, so not all characters will work well.
|
||||
* Supported characters for blinking:
|
||||
* Supported characters for blinking on classic LCD :
|
||||
* * Punctuation: underscore, apostrophe, comma, hyphen, equals sign, tilde (top segment only)
|
||||
* * Numbers: 5, 6, ampersand (lowercase 7)
|
||||
* * Letters: b, C, c, E, F, h, i, L, l, n, o, S, t
|
||||
* Supported characters for blinking on custom LCD :
|
||||
* * Only the segments making up the capital letter 'C' (ADEF)
|
||||
*/
|
||||
void watch_start_character_blink(char character, uint32_t duration);
|
||||
|
||||
/** @brief Blinks an indicator on the custom LCD.
|
||||
* @details You can blink the LAP, ARROWS, SLEEP and COLON indicators on the custom LCD.
|
||||
* Alas you cannot autonomously blink any indicators on the original F-91W LCD.
|
||||
* @param indicator The indicator you wish to blink.
|
||||
* @param duration The duration of the on/off cycle in milliseconds, from 50 to ~4250 ms.
|
||||
*/
|
||||
void watch_start_indicator_blink_if_possible(watch_indicator_t indicator, uint32_t duration);
|
||||
|
||||
/** @brief Stops and clears all blinking segments.
|
||||
* @details This will stop all blinking in position 7, and clear all segments in that digit.
|
||||
* On the Pro LCD, this will also stop the blinking of all indicators.
|
||||
*/
|
||||
void watch_stop_blink(void);
|
||||
|
||||
|
||||
@ -79,6 +79,10 @@ void watch_start_character_blink(char character, uint32_t duration) {
|
||||
blink_interval_id = emscripten_set_interval(watch_invoke_blink_callback, (double)duration, NULL);
|
||||
}
|
||||
|
||||
void watch_start_indicator_blink_if_possible(watch_indicator_t indicator, uint32_t duration) {
|
||||
/// TODO: For #SecondMovement, implement this on simulator
|
||||
}
|
||||
|
||||
void watch_stop_blink(void) {
|
||||
emscripten_clear_timeout(blink_interval_id);
|
||||
blink_interval_id = -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user