bring in clock face, add 024h mode, refactor out last raw access of settings->bit
This commit is contained in:
parent
07d6a05e33
commit
b3ed4df0a1
@ -42,8 +42,9 @@
|
|||||||
// This allows these preferences to be stored before entering BACKUP mode and and restored after waking from reset.
|
// This allows these preferences to be stored before entering BACKUP mode and and restored after waking from reset.
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MOVEMENT_CLOCK_MODE_12H = 0,
|
MOVEMENT_CLOCK_MODE_12H = 0, /// use 12 hour clock
|
||||||
MOVEMENT_CLOCK_MODE_24H,
|
MOVEMENT_CLOCK_MODE_24H, /// use 24 hour clock
|
||||||
|
MOVEMENT_CLOCK_MODE_024H, /// use 24 hour clock with leading zero
|
||||||
MOVEMENT_NUM_CLOCK_MODES
|
MOVEMENT_NUM_CLOCK_MODES
|
||||||
} movement_clock_mode_t;
|
} movement_clock_mode_t;
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
#include "movement_faces.h"
|
#include "movement_faces.h"
|
||||||
|
|
||||||
const watch_face_t watch_faces[] = {
|
const watch_face_t watch_faces[] = {
|
||||||
|
clock_face,
|
||||||
simple_clock_face,
|
simple_clock_face,
|
||||||
beats_face,
|
beats_face,
|
||||||
world_clock_face,
|
world_clock_face,
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "simple_clock_face.h"
|
#include "simple_clock_face.h"
|
||||||
|
#include "clock_face.h"
|
||||||
#include "beats_face.h"
|
#include "beats_face.h"
|
||||||
#include "world_clock_face.h"
|
#include "world_clock_face.h"
|
||||||
#include "countdown_face.h"
|
#include "countdown_face.h"
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
SRCS += \
|
SRCS += \
|
||||||
./watch-faces/clock/simple_clock_face.c \
|
./watch-faces/clock/simple_clock_face.c \
|
||||||
|
./watch-faces/clock/clock_face.c \
|
||||||
./watch-faces/clock/beats_face.c \
|
./watch-faces/clock/beats_face.c \
|
||||||
./watch-faces/clock/world_clock_face.c \
|
./watch-faces/clock/world_clock_face.c \
|
||||||
./watch-faces/complication/countdown_face.c \
|
./watch-faces/complication/countdown_face.c \
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include "clock_face.h"
|
#include "clock_face.h"
|
||||||
#include "watch.h"
|
#include "watch.h"
|
||||||
#include "watch_utility.h"
|
#include "watch_utility.h"
|
||||||
#include "watch_private_display.h"
|
#include "watch_common_display.h"
|
||||||
|
|
||||||
// 2.2 volts will happen when the battery has maybe 5-10% remaining?
|
// 2.2 volts will happen when the battery has maybe 5-10% remaining?
|
||||||
// we can refine this later.
|
// we can refine this later.
|
||||||
@ -52,14 +52,6 @@ typedef struct {
|
|||||||
bool battery_low;
|
bool battery_low;
|
||||||
} clock_state_t;
|
} clock_state_t;
|
||||||
|
|
||||||
static bool clock_is_in_24h_mode(movement_settings_t *settings) {
|
|
||||||
return movement_clock_mode_24h();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool clock_should_set_leading_zero(movement_settings_t *settings) {
|
|
||||||
return clock_is_in_24h_mode(settings) && settings->bit.clock_24h_leading_zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void clock_indicate(watch_indicator_t indicator, bool on) {
|
static void clock_indicate(watch_indicator_t indicator, bool on) {
|
||||||
if (on) {
|
if (on) {
|
||||||
watch_set_indicator(indicator);
|
watch_set_indicator(indicator);
|
||||||
@ -77,7 +69,7 @@ static void clock_indicate_time_signal(clock_state_t *clock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void clock_indicate_24h(movement_settings_t *settings) {
|
static void clock_indicate_24h(movement_settings_t *settings) {
|
||||||
clock_indicate(WATCH_INDICATOR_24H, clock_is_in_24h_mode(settings));
|
clock_indicate(WATCH_INDICATOR_24H, !!movement_clock_mode_24h());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool clock_is_pm(watch_date_time date_time) {
|
static bool clock_is_pm(watch_date_time date_time) {
|
||||||
@ -138,7 +130,7 @@ static void clock_display_all(watch_date_time date_time, bool leading_zero) {
|
|||||||
date_time.unit.second
|
date_time.unit.second
|
||||||
);
|
);
|
||||||
|
|
||||||
watch_display_string(buf, 0);
|
watch_display_text(WATCH_POSITION_FULL, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool clock_display_some(watch_date_time current, watch_date_time previous) {
|
static bool clock_display_some(watch_date_time current, watch_date_time previous) {
|
||||||
@ -163,7 +155,8 @@ static bool clock_display_some(watch_date_time current, watch_date_time previous
|
|||||||
current.unit.second
|
current.unit.second
|
||||||
);
|
);
|
||||||
|
|
||||||
watch_display_string(buf, 6);
|
watch_display_text(WATCH_POSITION_MINUTES, buf);
|
||||||
|
watch_display_text(WATCH_POSITION_SECONDS, buf + 2);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -175,12 +168,11 @@ static bool clock_display_some(watch_date_time current, watch_date_time previous
|
|||||||
|
|
||||||
static void clock_display_clock(movement_settings_t *settings, clock_state_t *clock, watch_date_time current) {
|
static void clock_display_clock(movement_settings_t *settings, clock_state_t *clock, watch_date_time current) {
|
||||||
if (!clock_display_some(current, clock->date_time.previous)) {
|
if (!clock_display_some(current, clock->date_time.previous)) {
|
||||||
if (!clock_is_in_24h_mode(settings)) {
|
if (movement_clock_mode_24h() == MOVEMENT_CLOCK_MODE_12H) {
|
||||||
// if we are in 12 hour mode, do some cleanup.
|
|
||||||
clock_indicate_pm(settings, current);
|
clock_indicate_pm(settings, current);
|
||||||
current = clock_24h_to_12h(current);
|
current = clock_24h_to_12h(current);
|
||||||
}
|
}
|
||||||
clock_display_all(current, clock_should_set_leading_zero(settings));
|
clock_display_all(current, movement_clock_mode_24h() == MOVEMENT_CLOCK_MODE_024H);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +189,7 @@ static void clock_display_low_energy(watch_date_time date_time) {
|
|||||||
date_time.unit.minute
|
date_time.unit.minute
|
||||||
);
|
);
|
||||||
|
|
||||||
watch_display_string(buf, 0);
|
watch_display_text(WATCH_POSITION_FULL, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clock_start_tick_tock_animation(void) {
|
static void clock_start_tick_tock_animation(void) {
|
||||||
Loading…
x
Reference in New Issue
Block a user