move stopwatch face into Second Movement
This commit is contained in:
parent
29547227ee
commit
0603319d28
@ -31,6 +31,7 @@ const watch_face_t watch_faces[] = {
|
|||||||
clock_face,
|
clock_face,
|
||||||
world_clock_face,
|
world_clock_face,
|
||||||
sunrise_sunset_face,
|
sunrise_sunset_face,
|
||||||
|
stopwatch_face,
|
||||||
countdown_face,
|
countdown_face,
|
||||||
beats_face,
|
beats_face,
|
||||||
voltage_face,
|
voltage_face,
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
#include "world_clock_face.h"
|
#include "world_clock_face.h"
|
||||||
#include "advanced_alarm_face.h"
|
#include "advanced_alarm_face.h"
|
||||||
#include "countdown_face.h"
|
#include "countdown_face.h"
|
||||||
|
#include "stopwatch_face.h"
|
||||||
#include "fast_stopwatch_face.h"
|
#include "fast_stopwatch_face.h"
|
||||||
#include "sunrise_sunset_face.h"
|
#include "sunrise_sunset_face.h"
|
||||||
#include "character_set_face.h"
|
#include "character_set_face.h"
|
||||||
|
|||||||
@ -4,6 +4,7 @@ SRCS += \
|
|||||||
./watch-faces/clock/world_clock_face.c \
|
./watch-faces/clock/world_clock_face.c \
|
||||||
./watch-faces/complication/advanced_alarm_face.c \
|
./watch-faces/complication/advanced_alarm_face.c \
|
||||||
./watch-faces/complication/countdown_face.c \
|
./watch-faces/complication/countdown_face.c \
|
||||||
|
./watch-faces/complication/stopwatch_face.c \
|
||||||
./watch-faces/complication/fast_stopwatch_face.c \
|
./watch-faces/complication/fast_stopwatch_face.c \
|
||||||
./watch-faces/complication/sunrise_sunset_face.c \
|
./watch-faces/complication/sunrise_sunset_face.c \
|
||||||
./watch-faces/demo/accel_interrupt_count_face.c \
|
./watch-faces/demo/accel_interrupt_count_face.c \
|
||||||
|
|||||||
@ -55,24 +55,25 @@ static void _stopwatch_face_update_display(stopwatch_state_t *stopwatch_state, b
|
|||||||
// display maxes out just shy of 40 days, thanks to the limit on the day digits (0-39)
|
// display maxes out just shy of 40 days, thanks to the limit on the day digits (0-39)
|
||||||
stopwatch_state->running = false;
|
stopwatch_state->running = false;
|
||||||
movement_cancel_background_task();
|
movement_cancel_background_task();
|
||||||
watch_display_string("st39235959", 0);
|
watch_display_text(WATCH_POSITION_TOP_RIGHT, "39");
|
||||||
|
watch_display_text(WATCH_POSITION_BOTTOM, "235959");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_duration_t duration = watch_utility_seconds_to_duration(stopwatch_state->seconds_counted);
|
watch_duration_t duration = watch_utility_seconds_to_duration(stopwatch_state->seconds_counted);
|
||||||
char buf[14];
|
char buf[14];
|
||||||
|
|
||||||
sprintf(buf, "st %02d%02d ", duration.hours, duration.minutes);
|
sprintf(buf, "%02d%02d ", duration.hours, duration.minutes);
|
||||||
watch_display_string(buf, 0);
|
watch_display_text(WATCH_POSITION_BOTTOM, buf);
|
||||||
|
|
||||||
if (duration.days != 0) {
|
if (duration.days != 0) {
|
||||||
sprintf(buf, "%2d", (uint8_t)duration.days);
|
sprintf(buf, "%2d", (uint8_t)duration.days);
|
||||||
watch_display_string(buf, 2);
|
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_seconds) {
|
if (show_seconds) {
|
||||||
sprintf(buf, "%02d", duration.seconds);
|
sprintf(buf, "%02d", duration.seconds);
|
||||||
watch_display_string(buf, 8);
|
watch_display_text(WATCH_POSITION_SECONDS, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,10 +98,12 @@ bool stopwatch_face_loop(movement_event_t event, void *context) {
|
|||||||
switch (event.event_type) {
|
switch (event.event_type) {
|
||||||
case EVENT_ACTIVATE:
|
case EVENT_ACTIVATE:
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
|
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "STW", "ST");
|
||||||
// fall through
|
// fall through
|
||||||
case EVENT_TICK:
|
case EVENT_TICK:
|
||||||
if (stopwatch_state->start_time.reg == 0) {
|
if (stopwatch_state->start_time.reg == 0) {
|
||||||
watch_display_string("st 000000", 0);
|
watch_display_text(WATCH_POSITION_TOP_RIGHT, " ");
|
||||||
|
watch_display_text(WATCH_POSITION_BOTTOM, "000000");
|
||||||
} else {
|
} else {
|
||||||
_stopwatch_face_update_display(stopwatch_state, true);
|
_stopwatch_face_update_display(stopwatch_state, true);
|
||||||
}
|
}
|
||||||
@ -110,7 +113,7 @@ bool stopwatch_face_loop(movement_event_t event, void *context) {
|
|||||||
if (!stopwatch_state->running) {
|
if (!stopwatch_state->running) {
|
||||||
stopwatch_state->start_time.reg = 0;
|
stopwatch_state->start_time.reg = 0;
|
||||||
stopwatch_state->seconds_counted = 0;
|
stopwatch_state->seconds_counted = 0;
|
||||||
watch_display_string("st 000000", 0);
|
watch_display_text(WATCH_POSITION_BOTTOM, "000000");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_BUTTON_DOWN:
|
case EVENT_ALARM_BUTTON_DOWN:
|
||||||
@ -148,7 +151,7 @@ bool stopwatch_face_loop(movement_event_t event, void *context) {
|
|||||||
// since the tick animation is running, displaying the stopped time could be misleading,
|
// since the tick animation is running, displaying the stopped time could be misleading,
|
||||||
// as it could imply that the stopwatch is running. instead, show a blank display to
|
// as it could imply that the stopwatch is running. instead, show a blank display to
|
||||||
// indicate that we are in sleep mode.
|
// indicate that we are in sleep mode.
|
||||||
watch_display_string("st ---- ", 0);
|
watch_display_text(WATCH_POSITION_BOTTOM, "---- ");
|
||||||
} else {
|
} else {
|
||||||
// this OTOH shouldn't happen anymore; if we're running, we shouldn't enter low energy mode
|
// this OTOH shouldn't happen anymore; if we're running, we shouldn't enter low energy mode
|
||||||
_stopwatch_face_update_display(stopwatch_state, false);
|
_stopwatch_face_update_display(stopwatch_state, false);
|
||||||
Loading…
x
Reference in New Issue
Block a user