#include "watch_common_display.h"
#include "watch_utility.h"
#include "watch_rtc.h"
+#include "slcd.h"
/*
This watch face implements the original F-91W stopwatch functionality
// How quickly should the elapsing time be displayed?
// This is just for looks, timekeeping is always accurate to 128Hz
static const uint8_t DISPLAY_RUNNING_RATE = 32;
+static const uint8_t DISPLAY_RUNNING_RATE_SLOW = 2;
/// @brief Display minutes, seconds and fractions derived from 128 Hz tick counter
/// on the lcd.
/// @param ticks
static void _display_elapsed(fast_stopwatch_state_t *state, uint32_t ticks) {
char buf[3];
- uint8_t sec_100 = (ticks & 0x7F) * 100 / 128;
- watch_display_character_lp_seconds('0' + sec_100 / 10, 8);
- watch_display_character_lp_seconds('0' + sec_100 % 10, 9);
+ if (state->slow_refresh && (state->status == SW_STATUS_RUNNING || state->status == SW_STATUS_IDLE)) {
+ watch_display_character_lp_seconds(' ', 8);
+ watch_display_character_lp_seconds(' ', 9);
+ } else {
+ uint8_t sec_100 = (ticks & 0x7F) * 100 / 128;
+
+ watch_display_character_lp_seconds('0' + sec_100 / 10, 8);
+ watch_display_character_lp_seconds('0' + sec_100 % 10, 9);
+ }
uint32_t seconds = ticks >> 7;
static uint8_t get_refresh_rate(fast_stopwatch_state_t *state) {
switch (state->status) {
case SW_STATUS_RUNNING:
- return DISPLAY_RUNNING_RATE;
+ if (state->slow_refresh) {
+ return DISPLAY_RUNNING_RATE_SLOW;
+ } else {
+ return DISPLAY_RUNNING_RATE;
+ }
case SW_STATUS_RUNNING_LAPPING:
return 2;
case SW_STATUS_STOPPED:
case EVENT_ALARM_BUTTON_DOWN:
state->status = SW_STATUS_RUNNING;
state->start_counter = counter;
- movement_request_tick_frequency(DISPLAY_RUNNING_RATE);
+ movement_request_tick_frequency(get_refresh_rate(state));
+ return;
+ case EVENT_LIGHT_LONG_PRESS:
+ state->slow_refresh = !state->slow_refresh;
return;
default:
return;
case EVENT_ALARM_BUTTON_DOWN:
state->status = SW_STATUS_STOPPED;
state->stop_counter = counter;
- movement_request_tick_frequency(1);
+ movement_request_tick_frequency(get_refresh_rate(state));
return;
case EVENT_LIGHT_BUTTON_DOWN:
state->status = SW_STATUS_RUNNING_LAPPING;
state->lap_counter = counter;
- movement_request_tick_frequency(2);
+ movement_request_tick_frequency(get_refresh_rate(state));
return;
default:
return;
case EVENT_ALARM_BUTTON_DOWN:
state->status = SW_STATUS_STOPPED_LAPPING;
state->stop_counter = counter;
- movement_request_tick_frequency(1);
+ movement_request_tick_frequency(get_refresh_rate(state));
return;
case EVENT_LIGHT_BUTTON_DOWN:
state->status = SW_STATUS_RUNNING;
state->lap_counter = counter;
- movement_request_tick_frequency(DISPLAY_RUNNING_RATE);
+ movement_request_tick_frequency(get_refresh_rate(state));
+ return;
+ case EVENT_LIGHT_LONG_PRESS:
+ state->status = SW_STATUS_RUNNING;
+ state->slow_refresh = !state->slow_refresh;
+ movement_request_tick_frequency(get_refresh_rate(state));
return;
default:
return;
state->status = SW_STATUS_RUNNING_LAPPING;
state->start_counter = counter - state->stop_counter + state->start_counter;
state->lap_counter = counter - state->stop_counter + state->lap_counter;
- movement_request_tick_frequency(2);
+ movement_request_tick_frequency(get_refresh_rate(state));
return;
case EVENT_LIGHT_BUTTON_DOWN:
state->status = SW_STATUS_STOPPED;
case EVENT_ALARM_BUTTON_DOWN:
state->status = SW_STATUS_RUNNING;
state->start_counter = counter - state->stop_counter + state->start_counter;
- movement_request_tick_frequency(DISPLAY_RUNNING_RATE);
+ movement_request_tick_frequency(get_refresh_rate(state));
return;
case EVENT_LIGHT_BUTTON_DOWN:
state->status = SW_STATUS_IDLE;
break;
case EVENT_ALARM_BUTTON_DOWN:
case EVENT_LIGHT_BUTTON_DOWN:
+ case EVENT_LIGHT_LONG_PRESS:
_button_beep();
// Fall into the case below;
case EVENT_TICK: