movement: fix preferences glitch, add some notes

This commit is contained in:
Joey Castillo 2021-10-20 10:36:55 -04:00
parent 148a47f76a
commit 1020dd7898
2 changed files with 83 additions and 74 deletions

View File

@ -209,7 +209,11 @@ void cb_tick() {
event.event_type = EVENT_TICK; event.event_type = EVENT_TICK;
watch_date_time date_time = watch_rtc_get_date_time(); watch_date_time date_time = watch_rtc_get_date_time();
if (date_time.unit.second != movement_state.last_second) { if (date_time.unit.second != movement_state.last_second) {
// TODO: since we time the LED with the 1 Hz tick, the actual time lit can vary depending on whether the
// user hit it just before or just after a tick. If we time this with the system tick we can do better.
if (movement_state.light_ticks) movement_state.light_ticks--; if (movement_state.light_ticks) movement_state.light_ticks--;
// TODO: can we consolidate these two ticks?
if (movement_state.settings.bit.le_interval && movement_state.le_mode_ticks > 0) movement_state.le_mode_ticks--; if (movement_state.settings.bit.le_interval && movement_state.le_mode_ticks > 0) movement_state.le_mode_ticks--;
if (movement_state.timeout_ticks > 0) movement_state.timeout_ticks--; if (movement_state.timeout_ticks > 0) movement_state.timeout_ticks--;

View File

@ -69,7 +69,8 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
watch_display_string((char *)preferences_face_titles[current_page], 0); watch_display_string((char *)preferences_face_titles[current_page], 0);
if (event.subsecond % 2) return current_page <= 2; // blink active setting on even-numbered quarter-seconds
if (event.subsecond % 2) {
char buf[8]; char buf[8];
switch (current_page) { switch (current_page) {
case 0: case 0:
@ -126,9 +127,10 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
break; break;
case 4: case 4:
if (settings->bit.led_duration) { if (settings->bit.led_duration) {
// FIXME: since we time the LED with the 1 Hz tick, the actual time lit can vary depending // TODO: since we time the LED with the 1 Hz tick, the actual time lit can vary depending
// on whether the user hit it just before or just after a tick. so the setting is "1-2 s", // on whether the user hit it just before or just after a tick. so the setting is "1-2 s",
// "3-4 s", or "5-6 s". If we time this with the system tick we can do better. // "3-4 s", or "5-6 s". If we time this with the system tick we can do better.
// see also cb_tick at the bottom of movement.c
sprintf(buf, " %1d-%1d s", settings->bit.led_duration * 2 - 1, settings->bit.led_duration * 2); sprintf(buf, " %1d-%1d s", settings->bit.led_duration * 2 - 1, settings->bit.led_duration * 2);
watch_display_string(buf, 4); watch_display_string(buf, 4);
} else { } else {
@ -144,10 +146,13 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
watch_display_string(buf, 8); watch_display_string(buf, 8);
break; break;
} }
}
// on LED color select screns, preview the color.
if (current_page >= 5) { if (current_page >= 5) {
watch_set_led_color(settings->bit.led_red_color ? (0xF | settings->bit.led_red_color << 4) : 0, watch_set_led_color(settings->bit.led_red_color ? (0xF | settings->bit.led_red_color << 4) : 0,
settings->bit.led_green_color ? (0xF | settings->bit.led_green_color << 4) : 0); settings->bit.led_green_color ? (0xF | settings->bit.led_green_color << 4) : 0);
// return false so the watch stays awake (needed for the PWM driver to function).
return false; return false;
} }