Skip to content

Commit bf4d461

Browse files
Merge branch 'next' - new faces before the freeze
Merge the next branch containing numerous new sensor watch faces as well as some new features. Not all of them made it in the end and we even had to revert improvements merged in last next due to issues that weren't found during testing. Still, I am very proud to be merging in and closing over 20 pull requests. I believe the project is in the best possible shape it can be before the movement 2.0 refactor. Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com> Tested-on-hardware-by: David Volovskiy <devolov@gmail.com> Tested-on-hardware-by: CarpeNoctem <cryptomax@pm.me> GitHub-Pull-Request: #469
2 parents 035fff5 + fe9a0a6 commit bf4d461

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+7843
-145
lines changed

make.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,20 @@ SRCS += \
215215

216216
endif
217217

218+
ifeq ($(LED), BLUE)
219+
CFLAGS += -DWATCH_IS_BLUE_BOARD
220+
endif
221+
222+
ifndef COLOR
223+
$(error Set the COLOR variable to RED, BLUE, or GREEN depending on what board you have.)
224+
endif
225+
226+
COLOR_VALID := $(filter $(COLOR),RED BLUE GREEN)
227+
228+
ifeq ($(COLOR_VALID),)
229+
$(error COLOR must be RED, BLUE, or GREEN)
230+
endif
231+
218232
ifeq ($(COLOR), BLUE)
219233
CFLAGS += -DWATCH_IS_BLUE_BOARD
220234
endif

movement/make/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ SRCS += \
5252
../shell.c \
5353
../shell_cmd_list.c \
5454
../watch_faces/clock/simple_clock_face.c \
55+
../watch_faces/clock/close_enough_clock_face.c \
5556
../watch_faces/clock/clock_face.c \
5657
../watch_faces/clock/world_clock_face.c \
5758
../watch_faces/clock/beats_face.c \
@@ -129,6 +130,17 @@ SRCS += \
129130
../watch_faces/clock/minute_repeater_decimal_face.c \
130131
../watch_faces/complication/tuning_tones_face.c \
131132
../watch_faces/complication/kitchen_conversions_face.c \
133+
../watch_faces/complication/wordle_face.c \
134+
../watch_faces/complication/endless_runner_face.c \
135+
../watch_faces/complication/periodic_face.c \
136+
../watch_faces/complication/deadline_face.c \
137+
../watch_faces/complication/higher_lower_game_face.c \
138+
../watch_faces/clock/french_revolutionary_face.c \
139+
../watch_faces/clock/minimal_clock_face.c \
140+
../watch_faces/complication/simon_face.c \
141+
../watch_faces/complication/simple_calculator_face.c \
142+
../watch_faces/sensor/alarm_thermometer_face.c \
143+
../watch_faces/demo/beeps_face.c \
132144
# New watch faces go above this line.
133145

134146
# Leave this line at the bottom of the file; it has all the targets for making your project.

movement/movement.c

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -95,31 +95,6 @@
9595
#define MOVEMENT_DEFAULT_LED_DURATION 1
9696
#endif
9797

98-
// Default to no set location latitude
99-
#ifndef MOVEMENT_DEFAULT_LATITUDE
100-
#define MOVEMENT_DEFAULT_LATITUDE 0
101-
#endif
102-
103-
// Default to no set location longitude
104-
#ifndef MOVEMENT_DEFAULT_LONGITUDE
105-
#define MOVEMENT_DEFAULT_LONGITUDE 0
106-
#endif
107-
108-
// Default to no set birthdate year
109-
#ifndef MOVEMENT_DEFAULT_BIRTHDATE_YEAR
110-
#define MOVEMENT_DEFAULT_BIRTHDATE_YEAR 0
111-
#endif
112-
113-
// Default to no set birthdate month
114-
#ifndef MOVEMENT_DEFAULT_BIRTHDATE_MONTH
115-
#define MOVEMENT_DEFAULT_BIRTHDATE_MONTH 0
116-
#endif
117-
118-
// Default to no set birthdate day
119-
#ifndef MOVEMENT_DEFAULT_BIRTHDATE_DAY
120-
#define MOVEMENT_DEFAULT_BIRTHDATE_DAY 0
121-
#endif
122-
12398
#if __EMSCRIPTEN__
12499
#include <emscripten.h>
125100
#endif
@@ -264,14 +239,24 @@ void movement_request_tick_frequency(uint8_t freq) {
264239
}
265240

266241
void movement_illuminate_led(void) {
267-
if (movement_state.settings.bit.led_duration) {
242+
if (movement_state.settings.bit.led_duration != 0b111) {
268243
watch_set_led_color(movement_state.settings.bit.led_red_color ? (0xF | movement_state.settings.bit.led_red_color << 4) : 0,
269244
movement_state.settings.bit.led_green_color ? (0xF | movement_state.settings.bit.led_green_color << 4) : 0);
270-
movement_state.light_ticks = (movement_state.settings.bit.led_duration * 2 - 1) * 128;
245+
if (movement_state.settings.bit.led_duration == 0) {
246+
movement_state.light_ticks = 1;
247+
} else {
248+
movement_state.light_ticks = (movement_state.settings.bit.led_duration * 2 - 1) * 128;
249+
}
271250
_movement_enable_fast_tick_if_needed();
272251
}
273252
}
274253

254+
static void _movement_led_off(void) {
255+
watch_set_led_off();
256+
movement_state.light_ticks = -1;
257+
_movement_disable_fast_tick_if_possible();
258+
}
259+
275260
bool movement_default_loop_handler(movement_event_t event, movement_settings_t *settings) {
276261
(void)settings;
277262

@@ -282,6 +267,11 @@ bool movement_default_loop_handler(movement_event_t event, movement_settings_t *
282267
case EVENT_LIGHT_BUTTON_DOWN:
283268
movement_illuminate_led();
284269
break;
270+
case EVENT_LIGHT_BUTTON_UP:
271+
if (movement_state.settings.bit.led_duration == 0) {
272+
_movement_led_off();
273+
}
274+
break;
285275
case EVENT_MODE_LONG_PRESS:
286276
if (MOVEMENT_SECONDARY_FACE_INDEX && movement_state.current_face_idx == 0) {
287277
movement_move_to_face(MOVEMENT_SECONDARY_FACE_INDEX);
@@ -416,11 +406,7 @@ void app_init(void) {
416406
movement_state.settings.bit.to_interval = MOVEMENT_DEFAULT_TIMEOUT_INTERVAL;
417407
movement_state.settings.bit.le_interval = MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL;
418408
movement_state.settings.bit.led_duration = MOVEMENT_DEFAULT_LED_DURATION;
419-
movement_state.location.bit.latitude = MOVEMENT_DEFAULT_LATITUDE;
420-
movement_state.location.bit.longitude = MOVEMENT_DEFAULT_LONGITUDE;
421-
movement_state.birthdate.bit.year = MOVEMENT_DEFAULT_BIRTHDATE_YEAR;
422-
movement_state.birthdate.bit.month = MOVEMENT_DEFAULT_BIRTHDATE_MONTH;
423-
movement_state.birthdate.bit.day = MOVEMENT_DEFAULT_BIRTHDATE_DAY;
409+
424410
movement_state.light_ticks = -1;
425411
movement_state.alarm_ticks = -1;
426412
movement_state.next_available_backup_register = 4;
@@ -443,14 +429,10 @@ void app_init(void) {
443429

444430
void app_wake_from_backup(void) {
445431
movement_state.settings.reg = watch_get_backup_data(0);
446-
movement_state.location.reg = watch_get_backup_data(1);
447-
movement_state.birthdate.reg = watch_get_backup_data(2);
448432
}
449433

450434
void app_setup(void) {
451435
watch_store_backup_data(movement_state.settings.reg, 0);
452-
watch_store_backup_data(movement_state.location.reg, 1);
453-
watch_store_backup_data(movement_state.birthdate.reg, 2);
454436

455437
static bool is_first_launch = true;
456438

@@ -544,9 +526,7 @@ bool app_loop(void) {
544526
if (watch_get_pin_level(BTN_LIGHT)) {
545527
movement_state.light_ticks = 1;
546528
} else {
547-
watch_set_led_off();
548-
movement_state.light_ticks = -1;
549-
_movement_disable_fast_tick_if_possible();
529+
_movement_led_off();
550530
}
551531
}
552532

@@ -584,6 +564,17 @@ bool app_loop(void) {
584564
event.subsecond = movement_state.subsecond;
585565
// the first trip through the loop overrides the can_sleep state
586566
can_sleep = wf->loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
567+
568+
// Keep light on if user is still interacting with the watch.
569+
if (movement_state.light_ticks > 0) {
570+
switch (event.event_type) {
571+
case EVENT_LIGHT_BUTTON_DOWN:
572+
case EVENT_MODE_BUTTON_DOWN:
573+
case EVENT_ALARM_BUTTON_DOWN:
574+
movement_illuminate_led();
575+
}
576+
}
577+
587578
event.event_type = EVENT_NONE;
588579
}
589580

movement/movement.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ typedef union {
5050
uint8_t to_interval : 2; // an inactivity interval for asking the active face to resign.
5151
bool to_always : 1; // if true, always time out from the active face to face 0. otherwise only faces that time out will resign (the default).
5252
uint8_t le_interval : 3; // 0 to disable low energy mode, or an inactivity interval for going into low energy mode.
53-
uint8_t led_duration : 2; // how many seconds to shine the LED for (x2), or 0 to disable it.
53+
uint8_t led_duration : 3; // how many seconds to shine the LED for (x2), 0 to shine only while the button is depressed, or all bits set to disable the LED altogether.
5454
uint8_t led_red_color : 4; // for general purpose illumination, the red LED value (0-15)
5555
uint8_t led_green_color : 4; // for general purpose illumination, the green LED value (0-15)
5656
uint8_t time_zone : 6; // an integer representing an index in the time zone table.
@@ -60,9 +60,10 @@ typedef union {
6060
// time-oriented complication like a sunrise/sunset timer, and a simple locale preference could tell an
6161
// altimeter to display feet or meters as easily as it tells a thermometer to display degrees in F or C.
6262
bool clock_mode_24h : 1; // indicates whether clock should use 12 or 24 hour mode.
63+
bool clock_24h_leading_zero : 1; // indicates whether clock should leading zero to indicate 24 hour mode.
6364
bool use_imperial_units : 1; // indicates whether to use metric units (the default) or imperial.
6465
bool alarm_enabled : 1; // indicates whether there is at least one alarm enabled.
65-
uint8_t reserved : 6; // room for more preferences if needed.
66+
uint8_t reserved : 5; // room for more preferences if needed.
6667
} bit;
6768
uint32_t reg;
6869
} movement_settings_t;
@@ -242,8 +243,6 @@ typedef struct {
242243
typedef struct {
243244
// properties stored in BACKUP register
244245
movement_settings_t settings;
245-
movement_location_t location;
246-
movement_birthdate_t birthdate;
247246

248247
// transient properties
249248
int16_t current_face_idx;

movement/movement_config.h

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ const watch_face_t watch_faces[] = {
7676
/* Set the timeout before switching to low energy mode
7777
* Valid values are:
7878
* 0: Never
79-
* 1: 10 mins
80-
* 2: 1 hour
81-
* 3: 2 hours
82-
* 4: 6 hours
83-
* 5: 12 hours
84-
* 6: 1 day
79+
* 1: 1 hour
80+
* 2: 2 hours
81+
* 3: 6 hours
82+
* 4: 12 hours
83+
* 5: 1 day
84+
* 6: 2 days
8585
* 7: 7 days
8686
*/
87-
#define MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL 2
87+
#define MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL 1
8888

8989
/* Set the led duration
9090
* Valid values are:
@@ -95,20 +95,4 @@ const watch_face_t watch_faces[] = {
9595
*/
9696
#define MOVEMENT_DEFAULT_LED_DURATION 1
9797

98-
/* The latitude and longitude used for the wearers location
99-
* Set signed values in 1/100ths of a degree
100-
*/
101-
#define MOVEMENT_DEFAULT_LATITUDE 0
102-
#define MOVEMENT_DEFAULT_LONGITUDE 0
103-
104-
/* The wearers birthdate
105-
* Valid values:
106-
* Year: 1 - 4095
107-
* Month: 1 - 12
108-
* Day: 1 - 31
109-
*/
110-
#define MOVEMENT_DEFAULT_BIRTHDATE_YEAR 0
111-
#define MOVEMENT_DEFAULT_BIRTHDATE_MONTH 0
112-
#define MOVEMENT_DEFAULT_BIRTHDATE_DAY 0
113-
11498
#endif // MOVEMENT_CONFIG_H_

movement/movement_custom_signal_tunes.h

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,33 @@ int8_t signal_tune[] = {
6767
};
6868
#endif // SIGNAL_TUNE_MARIO_THEME
6969

70+
#ifdef SIGNAL_TUNE_MGS_CODEC
71+
int8_t signal_tune[] = {
72+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
73+
BUZZER_NOTE_C6, 1,
74+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
75+
BUZZER_NOTE_C6, 1,
76+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
77+
BUZZER_NOTE_C6, 1,
78+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
79+
BUZZER_NOTE_C6, 1,
80+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
81+
BUZZER_NOTE_C6, 1,
82+
BUZZER_NOTE_REST, 6,
83+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
84+
BUZZER_NOTE_C6, 1,
85+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
86+
BUZZER_NOTE_C6, 1,
87+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
88+
BUZZER_NOTE_C6, 1,
89+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
90+
BUZZER_NOTE_C6, 1,
91+
BUZZER_NOTE_G5SHARP_A5FLAT, 1,
92+
BUZZER_NOTE_C6, 1,
93+
0
94+
};
95+
#endif // SIGNAL_TUNE_MGS_CODEC
96+
7097
#ifdef SIGNAL_TUNE_KIM_POSSIBLE
7198
int8_t signal_tune[] = {
7299
BUZZER_NOTE_G7, 6,
@@ -119,4 +146,60 @@ int8_t signal_tune[] = {
119146
};
120147
#endif // SIGNAL_TUNE_LAYLA
121148

149+
#ifdef SIGNAL_TUNE_HARRY_POTTER_SHORT
150+
int8_t signal_tune[] = {
151+
BUZZER_NOTE_B5, 12,
152+
BUZZER_NOTE_REST, 1,
153+
BUZZER_NOTE_E6, 12,
154+
BUZZER_NOTE_REST, 1,
155+
BUZZER_NOTE_G6, 6,
156+
BUZZER_NOTE_REST, 1,
157+
BUZZER_NOTE_F6SHARP_G6FLAT, 6,
158+
BUZZER_NOTE_REST, 1,
159+
BUZZER_NOTE_E6, 16,
160+
BUZZER_NOTE_REST, 1,
161+
BUZZER_NOTE_B6, 8,
162+
BUZZER_NOTE_REST, 1,
163+
BUZZER_NOTE_A6, 24,
164+
BUZZER_NOTE_REST, 1,
165+
BUZZER_NOTE_F6SHARP_G6FLAT, 24,
166+
0
167+
};
168+
#endif // SIGNAL_TUNE_HARRY_POTTER_SHORT
169+
170+
#ifdef SIGNAL_TUNE_HARRY_POTTER_LONG
171+
int8_t signal_tune[] = {
172+
BUZZER_NOTE_B5, 12,
173+
BUZZER_NOTE_REST, 1,
174+
BUZZER_NOTE_E6, 12,
175+
BUZZER_NOTE_REST, 1,
176+
BUZZER_NOTE_G6, 6,
177+
BUZZER_NOTE_REST, 1,
178+
BUZZER_NOTE_F6SHARP_G6FLAT, 6,
179+
BUZZER_NOTE_REST, 1,
180+
BUZZER_NOTE_E6, 16,
181+
BUZZER_NOTE_REST, 1,
182+
BUZZER_NOTE_B6, 8,
183+
BUZZER_NOTE_REST, 1,
184+
BUZZER_NOTE_A6, 24,
185+
BUZZER_NOTE_REST, 1,
186+
BUZZER_NOTE_F6SHARP_G6FLAT, 24,
187+
BUZZER_NOTE_REST, 1,
188+
189+
BUZZER_NOTE_E6, 12,
190+
BUZZER_NOTE_REST, 1,
191+
BUZZER_NOTE_G6, 6,
192+
BUZZER_NOTE_REST, 1,
193+
BUZZER_NOTE_F6SHARP_G6FLAT, 6,
194+
BUZZER_NOTE_REST, 1,
195+
BUZZER_NOTE_D6SHARP_E6FLAT, 16,
196+
BUZZER_NOTE_REST, 1,
197+
BUZZER_NOTE_F6, 8,
198+
BUZZER_NOTE_REST, 1,
199+
BUZZER_NOTE_B5, 24,
200+
201+
0
202+
};
203+
#endif // SIGNAL_TUNE_HARRY_POTTER_LONG
204+
122205
#endif // MOVEMENT_CUSTOM_SIGNAL_TUNES_H_

movement/movement_faces.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define MOVEMENT_FACES_H_
2727

2828
#include "simple_clock_face.h"
29+
#include "close_enough_clock_face.h"
2930
#include "clock_face.h"
3031
#include "world_clock_face.h"
3132
#include "preferences_face.h"
@@ -104,6 +105,17 @@
104105
#include "minute_repeater_decimal_face.h"
105106
#include "tuning_tones_face.h"
106107
#include "kitchen_conversions_face.h"
108+
#include "wordle_face.h"
109+
#include "endless_runner_face.h"
110+
#include "periodic_face.h"
111+
#include "deadline_face.h"
112+
#include "higher_lower_game_face.h"
113+
#include "french_revolutionary_face.h"
114+
#include "minimal_clock_face.h"
115+
#include "simon_face.h"
116+
#include "simple_calculator_face.h"
117+
#include "alarm_thermometer_face.h"
118+
#include "beeps_face.h"
107119
// New includes go above this line.
108120

109121
#endif // MOVEMENT_FACES_H_

0 commit comments

Comments
 (0)