static void _movement_handle_background_tasks(void) {
for(uint8_t i = 0; i < MOVEMENT_NUM_FACES; i++) {
// For each face, if the watch face wants a background task...
- if (watch_faces[i].wants_background_task != NULL && watch_faces[i].wants_background_task(&movement_state.settings, watch_face_contexts[i])) {
+ if (watch_faces[i].wants_background_task != NULL && watch_faces[i].wants_background_task(watch_face_contexts[i])) {
// ...we give it one. pretty straightforward!
movement_event_t background_event = { EVENT_BACKGROUND_TASK, 0 };
- watch_faces[i].loop(background_event, &movement_state.settings, watch_face_contexts[i]);
+ watch_faces[i].loop(background_event, watch_face_contexts[i]);
}
}
movement_state.needs_background_tasks_handled = false;
if (scheduled_tasks[i].reg <= date_time.reg) {
scheduled_tasks[i].reg = 0;
movement_event_t background_event = { EVENT_BACKGROUND_TASK, 0 };
- watch_faces[i].loop(background_event, &movement_state.settings, watch_face_contexts[i]);
+ watch_faces[i].loop(background_event, watch_face_contexts[i]);
// check if loop scheduled a new task
if (scheduled_tasks[i].reg) {
num_active_tasks++;
_movement_disable_fast_tick_if_possible();
}
-bool movement_default_loop_handler(movement_event_t event, movement_settings_t *settings) {
- (void)settings;
-
+bool movement_default_loop_handler(movement_event_t event) {
switch (event.event_type) {
case EVENT_MODE_BUTTON_UP:
movement_move_to_next_face();
movement_request_tick_frequency(1);
for(uint8_t i = 0; i < MOVEMENT_NUM_FACES; i++) {
- watch_faces[i].setup(&movement_state.settings, i, &watch_face_contexts[i]);
+ watch_faces[i].setup(i, &watch_face_contexts[i]);
}
- watch_faces[movement_state.current_face_idx].activate(&movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+ watch_faces[movement_state.current_face_idx].activate(watch_face_contexts[movement_state.current_face_idx]);
event.subsecond = 0;
event.event_type = EVENT_ACTIVATE;
}
if (movement_state.needs_background_tasks_handled) _movement_handle_background_tasks();
event.event_type = EVENT_LOW_ENERGY_UPDATE;
- watch_faces[movement_state.current_face_idx].loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+ watch_faces[movement_state.current_face_idx].loop(event, watch_face_contexts[movement_state.current_face_idx]);
// if we need to wake immediately, do it!
if (movement_state.needs_wake) return;
// low note for nonzero case, high note for return to watch_face 0
watch_buzzer_play_note(movement_state.next_face_idx ? BUZZER_NOTE_C7 : BUZZER_NOTE_C8, 50);
}
- wf->resign(&movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+ wf->resign(watch_face_contexts[movement_state.current_face_idx]);
movement_state.current_face_idx = movement_state.next_face_idx;
// we have just updated the face idx, so we must recache the watch face pointer.
wf = &watch_faces[movement_state.current_face_idx];
watch_clear_display();
movement_request_tick_frequency(1);
- wf->activate(&movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+ wf->activate(watch_face_contexts[movement_state.current_face_idx]);
event.subsecond = 0;
event.event_type = EVENT_ACTIVATE;
movement_state.watch_face_changed = false;
if (event.event_type) {
event.subsecond = movement_state.subsecond;
// the first trip through the loop overrides the can_sleep state
- can_sleep = wf->loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+ can_sleep = wf->loop(event, watch_face_contexts[movement_state.current_face_idx]);
// Keep light on if user is still interacting with the watch.
if (movement_state.light_ticks > 0) {
// first trip | can sleep | cannot sleep | can sleep | cannot sleep
// second trip | can sleep | cannot sleep | cannot sleep | can sleep
// && | can sleep | cannot sleep | cannot sleep | cannot sleep
- bool can_sleep2 = wf->loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+ bool can_sleep2 = wf->loop(event, watch_face_contexts[movement_state.current_face_idx]);
can_sleep = can_sleep && can_sleep2;
event.event_type = EVENT_NONE;
}
* like configuring a pin mode or a peripheral, you may want to do that here too.
* This function will be called again after waking from sleep mode, since sleep mode disables all
* of the device's pins and peripherals.
- * @param settings A pointer to the global Movement settings. You can use this to inform how you present your
- * display to the user (i.e. taking into account whether they have silenced the buttons, or if
- * they prefer 12 or 24-hour mode). You can also change these settings if you like.
* @param watch_face_index The index of this watch face in the global array of watch faces; 0 is the first face,
* 1 is the second, etc. You may stash this value in your context if you wish to reference
* it later; your watch face's index is set at launch and will not change.
* data required for your watch face.
*
*/
-typedef void (*watch_face_setup)(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
+typedef void (*watch_face_setup)(uint8_t watch_face_index, void ** context_ptr);
/** @brief Prepare to go on-screen.
* @details This function is called just before your watch enters the foreground. If your watch face has any
* watch face depends on data from a peripheral (like an I2C sensor), you will likely want to enable
* that peripheral here. In addition, if your watch face requires an update frequncy other than 1 Hz,
* you may want to request that here using the movement_request_tick_frequency function.
- * @param settings A pointer to the global Movement settings. @see watch_face_setup.
* @param context A pointer to your watch face's context. @see watch_face_setup.
*
*/
-typedef void (*watch_face_activate)(movement_settings_t *settings, void *context);
+typedef void (*watch_face_activate)(void *context);
/** @brief Handle events and update the display.
* @details This function is called in response to an event. You should set up a switch statement that handles,
* fail to do this, the user will become stuck on your watch face.
* @param event A struct containing information about the event, including its type. @see movement_event_type_t
* for a list of all possible event types.
- * @param settings A pointer to the global Movement settings. @see watch_face_setup.
* @param context A pointer to your application's context. @see watch_face_setup.
* @return true if your watch face is prepared for the system to enter STANDBY mode; false to keep the system awake.
* You should almost always return true.
unlikely the user is wearing or looking at the watch.
EVENT_BACKGROUND_TASK is also a special case. @see watch_face_wants_background_task for details.
*/
-typedef bool (*watch_face_loop)(movement_event_t event, movement_settings_t *settings, void *context);
+typedef bool (*watch_face_loop)(movement_event_t event, void *context);
/** @brief Prepare to go off-screen.
* @details This function is called before your watch face enters the background. If you requested a tick
* frequency other than the standard 1 Hz, **you must call movement_request_tick_frequency(1) here**
* to reset to 1 Hz. You should also disable any peripherals you enabled when you entered the foreground.
- * @param settings A pointer to the global Movement settings. @see watch_face_setup.
* @param context A pointer to your application's context. @see watch_face_setup.
*/
-typedef void (*watch_face_resign)(movement_settings_t *settings, void *context);
+typedef void (*watch_face_resign)(void *context);
/** @brief OPTIONAL. Request an opportunity to run a background task.
* @details Most apps will not need this function, but if you provide it, Movement will call it once per minute in
* - If your background task involves an external pin or peripheral, request background tasks no more than once per hour.
* - If you need to enable a pin or a peripheral to perform your task, return it to its original state afterwards.
*
- * @param settings A pointer to the global Movement settings. @see watch_face_setup.
* @param context A pointer to your application's context. @see watch_face_setup.
* @return true to request a background task; false otherwise.
*/
-typedef bool (*watch_face_wants_background_task)(movement_settings_t *settings, void *context);
+typedef bool (*watch_face_wants_background_task)(void *context);
typedef struct {
watch_face_setup setup;
void movement_move_to_face(uint8_t watch_face_index);
void movement_move_to_next_face(void);
-bool movement_default_loop_handler(movement_event_t event, movement_settings_t *settings);
+bool movement_default_loop_handler(movement_event_t event);
void movement_illuminate_led(void);
void movement_force_led_on(uint8_t red, uint8_t green, uint8_t blue);
#include <string.h>
#include "<#watch_face_name#>_face.h"
-void <#watch_face_name#>_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void <#watch_face_name#>_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(<#watch_face_name#>_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void <#watch_face_name#>_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void <#watch_face_name#>_face_activate(void *context) {
<#watch_face_name#>_state_t *state = (<#watch_face_name#>_state_t *)context;
// Handle any tasks related to your watch face coming on screen.
}
-bool <#watch_face_name#>_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool <#watch_face_name#>_face_loop(movement_event_t event, void *context) {
<#watch_face_name#>_state_t *state = (<#watch_face_name#>_state_t *)context;
switch (event.event_type) {
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
// You can override any of these behaviors by adding a case for these events to this switch statement.
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
// return true if the watch can enter standby mode. Generally speaking, you should always return true.
return true;
}
-void <#watch_face_name#>_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void <#watch_face_name#>_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
uint8_t unused;
} <#watch_face_name#>_state_t;
-void <#watch_face_name#>_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void <#watch_face_name#>_face_activate(movement_settings_t *settings, void *context);
-bool <#watch_face_name#>_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void <#watch_face_name#>_face_resign(movement_settings_t *settings, void *context);
+void <#watch_face_name#>_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void <#watch_face_name#>_face_activate(void *context);
+bool <#watch_face_name#>_face_loop(movement_event_t event, void *context);
+void <#watch_face_name#>_face_resign(void *context);
#define <#watch_face_name#>_face ((const watch_face_t){ \
<#watch_face_name#>_face_setup, \
};
}
-void close_enough_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void close_enough_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void close_enough_clock_face_activate(movement_settings_t *settings, void *context) {
+void close_enough_clock_face_activate(void *context) {
close_enough_clock_state_t *state = (close_enough_clock_state_t *)context;
if (watch_tick_animation_is_running()) {
state->prev_min_checked = -1;
}
-bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool close_enough_clock_face_loop(movement_event_t event, void *context) {
close_enough_clock_state_t *state = (close_enough_clock_state_t *)context;
char buf[11];
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void close_enough_clock_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void close_enough_clock_face_resign(void *context) {
(void) context;
}
bool alarm_enabled;
} close_enough_clock_state_t;
-void close_enough_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void close_enough_clock_face_activate(movement_settings_t *settings, void *context);
-bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void close_enough_clock_face_resign(movement_settings_t *settings, void *context);
+void close_enough_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void close_enough_clock_face_activate(void *context);
+bool close_enough_clock_face_loop(movement_event_t event, void *context);
+void close_enough_clock_face_resign(void *context);
#define close_enough_clock_face ((const watch_face_t){ \
close_enough_clock_face_setup, \
state->result = sun_rise_set(utc_now.unit.year + WATCH_RTC_REFERENCE_YEAR, utc_now.unit.month, utc_now.unit.day, lon, lat, &state->rise, &state->set);
}
-void day_night_percentage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void day_night_percentage_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void day_night_percentage_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void day_night_percentage_face_activate(void *context) {
(void) context;
}
-bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool day_night_percentage_face_loop(movement_event_t event, void *context) {
day_night_percentage_state_t *state = (day_night_percentage_state_t *)context;
char buf[12];
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void day_night_percentage_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void day_night_percentage_face_resign(void *context) {
(void) context;
}
double daylen;
} day_night_percentage_state_t;
-void day_night_percentage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void day_night_percentage_face_activate(movement_settings_t *settings, void *context);
-bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void day_night_percentage_face_resign(movement_settings_t *settings, void *context);
+void day_night_percentage_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void day_night_percentage_face_activate(void *context);
+bool day_night_percentage_face_loop(movement_event_t event, void *context);
+void day_night_percentage_face_resign(void *context);
#define day_night_percentage_face ((const watch_face_t){ \
day_night_percentage_face_setup, \
-void decimal_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void decimal_time_face_setup(uint8_t watch_face_index, void ** context_ptr) {
// These next two lines just silence the compiler warnings associated with unused parameters.
// We have no use for the settings or the watch_face_index, so we make that explicit here.
- (void) settings;
(void) watch_face_index;
(void) context_ptr;
// At boot, context_ptr will be NULL indicating that we don't have anyplace to store our context.
}
-void decimal_time_face_activate(movement_settings_t *settings, void *context) {
+void decimal_time_face_activate(void *context) {
// same as above: silence the warning, we don't need to check the settings.
- (void) settings;
// we do however need to set some things in our context. Here we cast it to the correct type...
decimal_time_face_state_t *state = (decimal_time_face_state_t *)context;
-bool decimal_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool decimal_time_face_loop(movement_event_t event, void *context) {
- (void) settings;
decimal_time_face_state_t *state = (decimal_time_face_state_t *)context;
char buf[16];
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void decimal_time_face_resign(movement_settings_t *settings, void *context) {
+void decimal_time_face_resign(void *context) {
// our watch face, like most watch faces, has nothing special to do when resigning.
// there are no peripherals or sensors here to worry about turning off.
- (void) settings;
(void) context;
}
uint8_t features_to_show : 2 ; // what features are to be displayed?
} decimal_time_face_state_t;
-void decimal_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void decimal_time_face_activate(movement_settings_t *settings, void *context);
-bool decimal_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void decimal_time_face_resign(movement_settings_t *settings, void *context);
+void decimal_time_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void decimal_time_face_activate(void *context);
+bool decimal_time_face_loop(movement_event_t event, void *context);
+void decimal_time_face_resign(void *context);
// void decimal_time_face_wants_background_task();
#include <string.h>
#include "french_revolutionary_face.h"
-void french_revolutionary_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void french_revolutionary_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(french_revolutionary_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void french_revolutionary_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void french_revolutionary_face_activate(void *context) {
french_revolutionary_state_t *state = (french_revolutionary_state_t *)context;
// Handle any tasks related to your watch face coming on screen.
state->colon_set_after_splash = false;
}
-bool french_revolutionary_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool french_revolutionary_face_loop(movement_event_t event, void *context) {
french_revolutionary_state_t *state = (french_revolutionary_state_t *)context;
char buf[11];
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
// You can override any of these behaviors by adding a case for these events to this switch statement.
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
// return true if the watch can enter standby mode. Generally speaking, you should always return true.
return true;
}
-void french_revolutionary_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void french_revolutionary_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
uint8_t hour : 5; // 0-10
} fr_decimal_time;
-void french_revolutionary_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void french_revolutionary_face_activate(movement_settings_t *settings, void *context);
-bool french_revolutionary_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void french_revolutionary_face_resign(movement_settings_t *settings, void *context);
+void french_revolutionary_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void french_revolutionary_face_activate(void *context);
+bool french_revolutionary_face_loop(movement_event_t event, void *context);
+void french_revolutionary_face_resign(void *context);
char fix_character_one(char digit);
fr_decimal_time get_decimal_time(watch_date_time *date_time);
void set_display_buffer(char *buf, french_revolutionary_state_t *state, fr_decimal_time *decimal_time, watch_date_time *date_time);
date_time->second = round(seconds % 60);
}
-static void _update(movement_settings_t *settings, mars_time_state_t *state) {
+static void _update(mars_time_state_t *state) {
char buf[11];
watch_date_time date_time = watch_rtc_get_date_time();
uint32_t now = watch_utility_date_time_to_unix_time(date_time, movement_get_current_timezone_offset());
watch_display_string(buf, 0);
}
-void mars_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void mars_time_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(mars_time_state_t));
}
}
-void mars_time_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void mars_time_face_activate(void *context) {
mars_time_state_t *state = (mars_time_state_t *)context;
(void) state;
}
-bool mars_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool mars_time_face_loop(movement_event_t event, void *context) {
mars_time_state_t *state = (mars_time_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
case EVENT_TICK:
- _update(settings, state);
+ _update(state);
break;
case EVENT_LIGHT_BUTTON_UP:
state->displaying_sol = !state->displaying_sol;
- _update(settings, state);
+ _update(state);
break;
case EVENT_LIGHT_LONG_PRESS:
movement_illuminate_led();
break;
case EVENT_ALARM_BUTTON_UP:
state->current_site = (state->current_site + 1) % MARS_TIME_NUM_SITES;
- _update(settings, state);
+ _update(state);
break;
case EVENT_TIMEOUT:
// TODO: make this lower power so we can avoid timeout
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void mars_time_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void mars_time_face_resign(void *context) {
(void) context;
}
bool displaying_sol;
} mars_time_state_t;
-void mars_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void mars_time_face_activate(movement_settings_t *settings, void *context);
-bool mars_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void mars_time_face_resign(movement_settings_t *settings, void *context);
+void mars_time_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void mars_time_face_activate(void *context);
+bool mars_time_face_loop(movement_event_t event, void *context);
+void mars_time_face_resign(void *context);
#define mars_time_face ((const watch_face_t){ \
mars_time_face_setup, \
#include <string.h>
#include "minimal_clock_face.h"
-static void _minimal_clock_face_update_display(movement_settings_t *settings) {
+static void _minimal_clock_face_update_display() {
watch_date_time date_time = watch_rtc_get_date_time();
char buffer[11];
watch_display_string(buffer, 4);
}
-void minimal_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void minimal_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(minimal_clock_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void minimal_clock_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void minimal_clock_face_activate(void *context) {
(void) context;
// Handle any tasks related to your watch face coming on screen.
watch_set_colon();
}
-bool minimal_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool minimal_clock_face_loop(movement_event_t event, void *context) {
(void) context;
switch (event.event_type) {
case EVENT_ACTIVATE:
// Show your initial UI here.
- _minimal_clock_face_update_display(settings);
+ _minimal_clock_face_update_display();
break;
case EVENT_TICK:
// If needed, update your display here.
- _minimal_clock_face_update_display(settings);
+ _minimal_clock_face_update_display();
break;
case EVENT_LIGHT_BUTTON_UP:
// You can use the Light button for your own purposes. Note that by default, Movement will also
// Avoid displaying fast-updating values like seconds, since the display won't update again for 60 seconds.
// You should also consider starting the tick animation, to show the wearer that this is sleep mode:
// watch_start_tick_animation(500);
- _minimal_clock_face_update_display(settings);
+ _minimal_clock_face_update_display();
break;
default:
// Movement's default loop handler will step in for any cases you don't handle above:
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
// You can override any of these behaviors by adding a case for these events to this switch statement.
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
// return true if the watch can enter standby mode. Generally speaking, you should always return true.
return true;
}
-void minimal_clock_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void minimal_clock_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
uint8_t unused;
} minimal_clock_state_t;
-void minimal_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void minimal_clock_face_activate(movement_settings_t *settings, void *context);
-bool minimal_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void minimal_clock_face_resign(movement_settings_t *settings, void *context);
+void minimal_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void minimal_clock_face_activate(void *context);
+bool minimal_clock_face_loop(movement_event_t event, void *context);
+void minimal_clock_face_resign(void *context);
#define minimal_clock_face ((const watch_face_t){ \
minimal_clock_face_setup, \
else watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
}
-void minute_repeater_decimal_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void minute_repeater_decimal_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void minute_repeater_decimal_face_activate(movement_settings_t *settings, void *context) {
+void minute_repeater_decimal_face_activate(void *context) {
minute_repeater_decimal_state_t *state = (minute_repeater_decimal_state_t *)context;
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
state->previous_date_time = 0xFFFFFFFF;
}
-bool minute_repeater_decimal_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool minute_repeater_decimal_face_loop(movement_event_t event, void *context) {
minute_repeater_decimal_state_t *state = (minute_repeater_decimal_state_t *)context;
char buf[11];
uint8_t pos;
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void minute_repeater_decimal_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void minute_repeater_decimal_face_resign(void *context) {
(void) context;
}
-bool minute_repeater_decimal_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool minute_repeater_decimal_face_wants_background_task(void *context) {
minute_repeater_decimal_state_t *state = (minute_repeater_decimal_state_t *)context;
if (!state->signal_enabled) return false;
void mrd_play_hour_chime(void);
void mrd_play_tens_chime(void);
void mrd_play_minute_chime(void);
-void minute_repeater_decimal_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void minute_repeater_decimal_face_activate(movement_settings_t *settings, void *context);
-bool minute_repeater_decimal_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void minute_repeater_decimal_face_resign(movement_settings_t *settings, void *context);
-bool minute_repeater_decimal_face_wants_background_task(movement_settings_t *settings, void *context);
+void minute_repeater_decimal_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void minute_repeater_decimal_face_activate(void *context);
+bool minute_repeater_decimal_face_loop(movement_event_t event, void *context);
+void minute_repeater_decimal_face_resign(void *context);
+bool minute_repeater_decimal_face_wants_background_task(void *context);
#define minute_repeater_decimal_face ((const watch_face_t){ \
minute_repeater_decimal_face_setup, \
else watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
}
-void repetition_minute_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void repetition_minute_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void repetition_minute_face_activate(movement_settings_t *settings, void *context) {
+void repetition_minute_face_activate(void *context) {
repetition_minute_state_t *state = (repetition_minute_state_t *)context;
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
state->previous_date_time = 0xFFFFFFFF;
}
-bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool repetition_minute_face_loop(movement_event_t event, void *context) {
repetition_minute_state_t *state = (repetition_minute_state_t *)context;
char buf[11];
uint8_t pos;
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void repetition_minute_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void repetition_minute_face_resign(void *context) {
(void) context;
}
-bool repetition_minute_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool repetition_minute_face_wants_background_task(void *context) {
repetition_minute_state_t *state = (repetition_minute_state_t *)context;
if (!state->signal_enabled) return false;
void play_hour_chime(void);
void play_quarter_chime(void);
void play_minute_chime(void);
-void repetition_minute_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void repetition_minute_face_activate(movement_settings_t *settings, void *context);
-bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void repetition_minute_face_resign(movement_settings_t *settings, void *context);
-bool repetition_minute_face_wants_background_task(movement_settings_t *settings, void *context);
+void repetition_minute_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void repetition_minute_face_activate(void *context);
+bool repetition_minute_face_loop(movement_event_t event, void *context);
+void repetition_minute_face_resign(void *context);
+bool repetition_minute_face_wants_background_task(void *context);
#define repetition_minute_face ((const watch_face_t){ \
repetition_minute_face_setup, \
}
}
-void simple_clock_bin_led_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void simple_clock_bin_led_face_setup(uint8_t watch_face_index, void ** context_ptr) {
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(simple_clock_bin_led_state_t));
memset(*context_ptr, 0, sizeof(simple_clock_bin_led_state_t));
}
}
-void simple_clock_bin_led_face_activate(movement_settings_t *settings, void *context) {
+void simple_clock_bin_led_face_activate(void *context) {
simple_clock_bin_led_state_t *state = (simple_clock_bin_led_state_t *)context;
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
state->previous_date_time = 0xFFFFFFFF;
}
-bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool simple_clock_bin_led_face_loop(movement_event_t event, void *context) {
simple_clock_bin_led_state_t *state = (simple_clock_bin_led_state_t *)context;
char buf[11];
uint8_t pos;
}
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void simple_clock_bin_led_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void simple_clock_bin_led_face_resign(void *context) {
(void) context;
}
-bool simple_clock_bin_led_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool simple_clock_bin_led_face_wants_background_task(void *context) {
simple_clock_bin_led_state_t *state = (simple_clock_bin_led_state_t *)context;
if (!state->signal_enabled) return false;
uint8_t ticks;
} simple_clock_bin_led_state_t;
-void simple_clock_bin_led_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void simple_clock_bin_led_face_activate(movement_settings_t *settings, void *context);
-bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void simple_clock_bin_led_face_resign(movement_settings_t *settings, void *context);
-bool simple_clock_bin_led_face_wants_background_task(movement_settings_t *settings, void *context);
+void simple_clock_bin_led_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void simple_clock_bin_led_face_activate(void *context);
+bool simple_clock_bin_led_face_loop(movement_event_t event, void *context);
+void simple_clock_bin_led_face_resign(void *context);
+bool simple_clock_bin_led_face_wants_background_task(void *context);
#define simple_clock_bin_led_face ((const watch_face_t){ \
simple_clock_bin_led_face_setup, \
else watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
}
-void weeknumber_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void weeknumber_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void weeknumber_clock_face_activate(movement_settings_t *settings, void *context) {
+void weeknumber_clock_face_activate(void *context) {
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
state->previous_date_time = 0xFFFFFFFF;
}
-bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool weeknumber_clock_face_loop(movement_event_t event, void *context) {
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
char buf[11];
uint8_t pos;
movement_play_signal();
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void weeknumber_clock_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void weeknumber_clock_face_resign(void *context) {
(void) context;
}
-bool weeknumber_clock_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool weeknumber_clock_face_wants_background_task(void *context) {
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
if (!state->signal_enabled) return false;
bool alarm_enabled;
} weeknumber_clock_state_t;
-void weeknumber_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void weeknumber_clock_face_activate(movement_settings_t *settings, void *context);
-bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void weeknumber_clock_face_resign(movement_settings_t *settings, void *context);
-bool weeknumber_clock_face_wants_background_task(movement_settings_t *settings, void *context);
+void weeknumber_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void weeknumber_clock_face_activate(void *context);
+bool weeknumber_clock_face_loop(movement_event_t event, void *context);
+void weeknumber_clock_face_resign(void *context);
+bool weeknumber_clock_face_wants_background_task(void *context);
#define weeknumber_clock_face ((const watch_face_t){ \
weeknumber_clock_face_setup, \
watch_buzzer_play_note(BUZZER_NOTE_G7, 75);
}
-void world_clock2_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr)
+void world_clock2_face_setup(uint8_t watch_face_index, void **context_ptr)
{
- (void) settings;
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void world_clock2_face_activate(movement_settings_t *settings, void *context)
+void world_clock2_face_activate(void *context)
{
- (void) settings;
world_clock2_state_t *state = (world_clock2_state_t *) context;
if (watch_tick_animation_is_running())
refresh_face = true;
}
-static bool mode_display(movement_event_t event, movement_settings_t *settings, world_clock2_state_t *state)
+static bool mode_display(movement_event_t event, world_clock2_state_t *state)
{
char buf[11];
uint8_t pos;
movement_move_to_next_face();
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-static bool mode_settings(movement_event_t event, movement_settings_t *settings, world_clock2_state_t *state)
+static bool mode_settings(movement_event_t event, world_clock2_state_t *state)
{
char buf[11];
int8_t hours, minutes;
movement_move_to_next_face();
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-bool world_clock2_face_loop(movement_event_t event, movement_settings_t *settings, void *context)
+bool world_clock2_face_loop(movement_event_t event, void *context)
{
world_clock2_state_t *state = (world_clock2_state_t *) context;
switch (state->current_mode) {
case WORLD_CLOCK2_MODE_DISPLAY:
- return mode_display(event, settings, state);
+ return mode_display(event, state);
case WORLD_CLOCK2_MODE_SETTINGS:
- return mode_settings(event, settings, state);
+ return mode_settings(event, state);
}
return false;
}
-void world_clock2_face_resign(movement_settings_t *settings, void *context)
+void world_clock2_face_resign(void *context)
{
- (void) settings;
(void) context;
}
uint32_t previous_date_time;
} world_clock2_state_t;
-void world_clock2_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr);
-void world_clock2_face_activate(movement_settings_t *settings, void *context);
-bool world_clock2_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void world_clock2_face_resign(movement_settings_t *settings, void *context);
+void world_clock2_face_setup(uint8_t watch_face_index, void **context_ptr);
+void world_clock2_face_activate(void *context);
+bool world_clock2_face_loop(movement_event_t event, void *context);
+void world_clock2_face_resign(void *context);
#define world_clock2_face ((const watch_face_t){ \
world_clock2_face_setup, \
{{2,4}, {2,5}, {1,6}, {0,6}, {0,5}, {1,4}, {1,5}},
};
-void wyoscan_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void wyoscan_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(wyoscan_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void wyoscan_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void wyoscan_face_activate(void *context) {
wyoscan_state_t *state = (wyoscan_state_t *)context;
movement_request_tick_frequency(32);
state->total_frames = 64;
}
-bool wyoscan_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool wyoscan_face_loop(movement_event_t event, void *context) {
wyoscan_state_t *state = (wyoscan_state_t *)context;
watch_date_time date_time;
case EVENT_BACKGROUND_TASK:
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void wyoscan_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void wyoscan_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
uint32_t illuminated_segments[MAX_ILLUMINATED_SEGMENTS][2];
} wyoscan_state_t;
-void wyoscan_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void wyoscan_face_activate(movement_settings_t *settings, void *context);
-bool wyoscan_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void wyoscan_face_resign(movement_settings_t *settings, void *context);
-bool wyoscan_face_wants_background_task(movement_settings_t *settings, void *context);
+void wyoscan_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void wyoscan_face_activate(void *context);
+bool wyoscan_face_loop(movement_event_t event, void *context);
+void wyoscan_face_resign(void *context);
+bool wyoscan_face_wants_background_task(void *context);
#define wyoscan_face ((const watch_face_t){ \
wyoscan_face_setup, \
}
static void _activity_display_choice(activity_state_t *state);
-static void _activity_update_logging_screen(movement_settings_t *settings, activity_state_t *state);
+static void _activity_update_logging_screen(activity_state_t *state);
static uint8_t _activity_get_next_byte(uint8_t *next_byte);
-void activity_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr) {
- (void)settings;
+void activity_face_setup(uint8_t watch_face_index, void **context_ptr) {
(void)watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(activity_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void activity_face_activate(movement_settings_t *settings, void *context) {
- (void)settings;
+void activity_face_activate(void *context) {
(void)context;
// Not using this function. Calling _activity_activate from the event handler.
}
// Called from the ACTIVATE event handler in the loop
-static void _activity_activate(movement_settings_t *settings, activity_state_t *state) {
+static void _activity_activate(activity_state_t *state) {
// If waking from low-energy state and currently logging: update seconds values
// Those are not up-to-date because ticks have not been coming
if (state->le_state != 0 && state->mode == ACTM_LOGGING) {
uint32_t start_timestamp = watch_utility_date_time_to_unix_time(state->start_time, 0);
uint32_t total_seconds = now_timestamp - start_timestamp;
state->curr_total_sec = total_seconds;
- _activity_update_logging_screen(settings, state);
+ _activity_update_logging_screen(state);
}
// Regular activation: start from defaults
else {
// {2, 4}, // MID
};
-static void _activity_update_logging_screen(movement_settings_t *settings, activity_state_t *state) {
+static void _activity_update_logging_screen(activity_state_t *state) {
watch_duration_t duration;
watch_display_string("AC ", 0);
watch_display_string("AC dONE ", 0);
}
-static void _activity_handle_tick(movement_settings_t *settings, activity_state_t *state) {
+static void _activity_handle_tick(activity_state_t *state) {
// Display stopwatch-like duration while logging, alternating with time
if (state->mode == ACTM_LOGGING || state->mode == ACTM_PAUSED) {
++state->counter;
}
// Still logging: refresh display
else {
- _activity_update_logging_screen(settings, state);
+ _activity_update_logging_screen(state);
}
}
// Display countown animation, and exit face when down
}
}
-static void _activity_alarm_long(movement_settings_t *settings, activity_state_t *state) {
+static void _activity_alarm_long(activity_state_t *state) {
// On choose face: start logging activity
if (state->mode == ACTM_CHOOSE) {
// If buffer is full: Ignore this long press
state->counter = -1;
state->mode = ACTM_LOGGING;
watch_set_indicator(WATCH_INDICATOR_LAP);
- _activity_update_logging_screen(settings, state);
+ _activity_update_logging_screen(state);
}
// If logging or paused: end logging
else if (state->mode == ACTM_LOGGING || state->mode == ACTM_PAUSED) {
}
}
-static void _activity_alarm_short(movement_settings_t *settings, activity_state_t *state) {
+static void _activity_alarm_short(activity_state_t *state) {
// In the choose face, short ALARM cycles through activities
if (state->mode == ACTM_CHOOSE) {
state->type_ix = (state->type_ix + 1) % num_enabled_activities;
else if (state->mode == ACTM_LOGGING) {
state->mode = ACTM_PAUSED;
state->counter = 0;
- _activity_update_logging_screen(settings, state);
+ _activity_update_logging_screen(state);
}
// If paused: Update paused seconds count and return to logging
else if (state->mode == ACTM_PAUSED) {
state->mode = ACTM_LOGGING;
state->counter = 0;
- _activity_update_logging_screen(settings, state);
+ _activity_update_logging_screen(state);
}
// If chirping: stoppit
else if (state->mode == ACTM_CHIRPING) {
// Otherwise, we don't do light.
}
-bool activity_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool activity_face_loop(movement_event_t event, void *context) {
activity_state_t *state = (activity_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
- _activity_activate(settings, state);
+ _activity_activate(state);
break;
case EVENT_TICK:
- _activity_handle_tick(settings, state);
+ _activity_handle_tick(state);
break;
case EVENT_MODE_BUTTON_UP:
if (state->mode != ACTM_LOGGING && state->mode != ACTM_PAUSED && state->mode != ACTM_CHIRPING) {
// We also receive ALARM press that woke us up from LE state
// Don't want to act on that as if it were a real button press for us
if (state->le_state != 2)
- _activity_alarm_short(settings, state);
+ _activity_alarm_short(state);
else
state->le_state = 0;
break;
case EVENT_ALARM_LONG_PRESS:
- _activity_alarm_long(settings, state);
+ _activity_alarm_long(state);
break;
case EVENT_TIMEOUT:
if (state->mode != ACTM_LOGGING && state->mode != ACTM_PAUSED &&
watch_clear_indicator(WATCH_INDICATOR_PM);
}
else {
- _activity_update_logging_screen(settings, state);
+ _activity_update_logging_screen(state);
watch_start_tick_animation(500);
}
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void activity_face_resign(movement_settings_t *settings, void *context) {
- (void)settings;
+void activity_face_resign(void *context) {
(void)context;
// Face should only ever temporarily request a higher frequency, so by the time we're resigning,
#include "movement.h"
-void activity_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void activity_face_activate(movement_settings_t *settings, void *context);
-bool activity_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void activity_face_resign(movement_settings_t *settings, void *context);
+void activity_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void activity_face_activate(void *context);
+bool activity_face_loop(movement_event_t event, void *context);
+void activity_face_resign(void *context);
#define activity_face ((const watch_face_t){ \
activity_face_setup, \
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
}
-static void _alarm_face_draw(movement_settings_t *settings, alarm_state_t *state, uint8_t subsecond) {
+static void _alarm_face_draw(alarm_state_t *state, uint8_t subsecond) {
char buf[12];
uint8_t i = 0;
_alarm_set_signal(state);
}
-static void _alarm_initiate_setting(movement_settings_t *settings, alarm_state_t *state, uint8_t subsecond) {
+static void _alarm_initiate_setting(alarm_state_t *state, uint8_t subsecond) {
state->is_setting = true;
state->setting_state = 0;
movement_request_tick_frequency(4);
- _alarm_face_draw(settings, state, subsecond);
+ _alarm_face_draw(state, subsecond);
}
-static void _alarm_resume_setting(movement_settings_t *settings, alarm_state_t *state, uint8_t subsecond) {
+static void _alarm_resume_setting(alarm_state_t *state, uint8_t subsecond) {
state->is_setting = false;
movement_request_tick_frequency(1);
- _alarm_face_draw(settings, state, subsecond);
+ _alarm_face_draw(state, subsecond);
}
-static void _alarm_update_alarm_enabled(movement_settings_t *settings, alarm_state_t *state) {
+static void _alarm_update_alarm_enabled(alarm_state_t *state) {
// save indication for active alarms to movement settings
bool active_alarms = false;
watch_date_time now;
}
}
-void alarm_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr) {
- (void) settings;
+void alarm_face_setup(uint8_t watch_face_index, void **context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void alarm_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void alarm_face_activate(void *context) {
(void) context;
watch_set_colon();
}
-void alarm_face_resign(movement_settings_t *settings, void *context) {
+void alarm_face_resign(void *context) {
alarm_state_t *state = (alarm_state_t *)context;
state->is_setting = false;
- _alarm_update_alarm_enabled(settings, state);
+ _alarm_update_alarm_enabled(state);
watch_set_led_off();
state->alarm_quick_ticks = false;
_wait_ticks = -1;
movement_request_tick_frequency(1);
}
-bool alarm_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool alarm_face_wants_background_task(void *context) {
alarm_state_t *state = (alarm_state_t *)context;
watch_date_time now = watch_rtc_get_date_time();
// just a failsafe: never fire more than one alarm within a minute
}
state->alarm_handled_minute = -1;
// update the movement's alarm indicator five times an hour
- if (now.unit.minute % 12 == 0) _alarm_update_alarm_enabled(settings, state);
+ if (now.unit.minute % 12 == 0) _alarm_update_alarm_enabled(state);
return false;
}
-bool alarm_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool alarm_face_loop(movement_event_t event, void *context) {
alarm_state_t *state = (alarm_state_t *)context;
switch (event.event_type) {
}
// fall through
case EVENT_ACTIVATE:
- _alarm_face_draw(settings, state, event.subsecond);
+ _alarm_face_draw(state, event.subsecond);
break;
case EVENT_LIGHT_BUTTON_UP:
if (!state->is_setting) {
movement_illuminate_led();
- _alarm_initiate_setting(settings, state, event.subsecond);
+ _alarm_initiate_setting(state, event.subsecond);
break;
}
state->setting_state += 1;
if (state->setting_state >= ALARM_SETTING_STATES) {
// we have done a full settings cycle, so resume to normal
- _alarm_resume_setting(settings, state, event.subsecond);
+ _alarm_resume_setting(state, event.subsecond);
}
break;
case EVENT_LIGHT_LONG_PRESS:
if (state->is_setting) {
- _alarm_resume_setting(settings, state, event.subsecond);
+ _alarm_resume_setting(state, event.subsecond);
} else {
- _alarm_initiate_setting(settings, state, event.subsecond);
+ _alarm_initiate_setting(state, event.subsecond);
}
break;
case EVENT_ALARM_BUTTON_UP:
// auto enable an alarm if user sets anything
if (state->setting_state > alarm_setting_idx_alarm) state->alarm[state->alarm_idx].enabled = true;
}
- _alarm_face_draw(settings, state, event.subsecond);
+ _alarm_face_draw(state, event.subsecond);
break;
case EVENT_ALARM_LONG_PRESS:
if (!state->is_setting) {
break;
}
}
- _alarm_face_draw(settings, state, event.subsecond);
+ _alarm_face_draw(state, event.subsecond);
break;
case EVENT_ALARM_LONG_UP:
if (state->is_setting) {
state->alarm[state->alarm_playing_idx].beeps = 5;
state->alarm[state->alarm_playing_idx].pitch = 1;
state->alarm[state->alarm_playing_idx].enabled = false;
- _alarm_update_alarm_enabled(settings, state);
+ _alarm_update_alarm_enabled(state);
}
break;
case EVENT_TIMEOUT:
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
} alarm_state_t;
-void alarm_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void alarm_face_activate(movement_settings_t *settings, void *context);
-bool alarm_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void alarm_face_resign(movement_settings_t *settings, void *context);
-bool alarm_face_wants_background_task(movement_settings_t *settings, void *context);
+void alarm_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void alarm_face_activate(void *context);
+bool alarm_face_loop(movement_event_t event, void *context);
+void alarm_face_resign(void *context);
+bool alarm_face_wants_background_task(void *context);
#define alarm_face ((const watch_face_t){ \
alarm_face_setup, \
"NE" // Neptune
};
-static void _astronomy_face_recalculate(movement_settings_t *settings, astronomy_state_t *state) {
+static void _astronomy_face_recalculate(astronomy_state_t *state) {
#if __EMSCRIPTEN__
int16_t browser_lat = EM_ASM_INT({
return lat;
state->distance);
}
-static void _astronomy_face_update(movement_event_t event, movement_settings_t *settings, astronomy_state_t *state) {
+static void _astronomy_face_update(movement_event_t event, astronomy_state_t *state) {
char buf[16];
switch (state->mode) {
case ASTRONOMY_MODE_SELECTING_BODY:
watch_clear_display();
// this takes a moment and locks the UI, flash C for "Calculating"
watch_start_character_blink('C', 100);
- _astronomy_face_recalculate(settings, state);
+ _astronomy_face_recalculate(state);
watch_stop_blink();
state->mode = ASTRONOMY_MODE_DISPLAYING_ALT;
// fall through
}
}
-void astronomy_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void astronomy_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(astronomy_state_t));
}
}
-void astronomy_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void astronomy_face_activate(void *context) {
astronomy_state_t *state = (astronomy_state_t *)context;
movement_location_t movement_location = (movement_location_t) watch_get_backup_data(1);
int16_t lat_centi = (int16_t)movement_location.bit.latitude;
movement_request_tick_frequency(4);
}
-bool astronomy_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool astronomy_face_loop(movement_event_t event, void *context) {
astronomy_state_t *state = (astronomy_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
case EVENT_TICK:
- _astronomy_face_update(event, settings, state);
+ _astronomy_face_update(event, state);
break;
case EVENT_ALARM_BUTTON_UP:
switch (state->mode) {
state->mode++;
break;
}
- _astronomy_face_update(event, settings, state);
+ _astronomy_face_update(event, state);
break;
case EVENT_ALARM_LONG_PRESS:
if (state->mode == ASTRONOMY_MODE_SELECTING_BODY) {
// celestial body selected! this triggers a calculation in the update method.
state->mode = ASTRONOMY_MODE_CALCULATING;
movement_request_tick_frequency(1);
- _astronomy_face_update(event, settings, state);
+ _astronomy_face_update(event, state);
} else if (state->mode != ASTRONOMY_MODE_CALCULATING) {
// in all modes except "doing a calculation", return to the selection screen.
state->mode = ASTRONOMY_MODE_SELECTING_BODY;
movement_request_tick_frequency(4);
- _astronomy_face_update(event, settings, state);
+ _astronomy_face_update(event, state);
}
break;
case EVENT_TIMEOUT:
// TODO?
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void astronomy_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void astronomy_face_resign(void *context) {
astronomy_state_t *state = (astronomy_state_t *)context;
state->mode = ASTRONOMY_MODE_SELECTING_BODY;
}
double distance; // in AU
} astronomy_state_t;
-void astronomy_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void astronomy_face_activate(movement_settings_t *settings, void *context);
-bool astronomy_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void astronomy_face_resign(movement_settings_t *settings, void *context);
+void astronomy_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void astronomy_face_activate(void *context);
+bool astronomy_face_loop(movement_event_t event, void *context);
+void astronomy_face_resign(void *context);
#define astronomy_face ((const watch_face_t){ \
astronomy_face_setup, \
#include "blinky_face.h"
#include "watch.h"
-void blinky_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void blinky_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(blinky_face_state_t));
}
}
-void blinky_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void blinky_face_activate(void *context) {
blinky_face_state_t *state = (blinky_face_state_t *)context;
state->active = false;
}
watch_display_string(buf, 0);
}
-bool blinky_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool blinky_face_loop(movement_event_t event, void *context) {
blinky_face_state_t *state = (blinky_face_state_t *)context;
switch (event.event_type) {
if (!state->active) movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void blinky_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void blinky_face_resign(void *context) {
(void) context;
watch_set_led_off();
}
uint8_t color;
} blinky_face_state_t;
-void blinky_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void blinky_face_activate(movement_settings_t *settings, void *context);
-bool blinky_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void blinky_face_resign(movement_settings_t *settings, void *context);
+void blinky_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void blinky_face_activate(void *context);
+bool blinky_face_loop(movement_event_t event, void *context);
+void blinky_face_resign(void *context);
#define blinky_face ((const watch_face_t){ \
blinky_face_setup, \
static void beep_out (void);
static void beep_out_hold (void);
-void breathing_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void breathing_face_setup(uint8_t watch_face_index, void ** context_ptr) {
// These next two lines just silence the compiler warnings associated with unused parameters.
// We have no use for the settings or the watch_face_index, so we make that explicit here.
- (void) settings;
(void) watch_face_index;
// At boot, context_ptr will be NULL indicating that we don't have anyplace to store our context.
if (*context_ptr == NULL) {
}
}
-void breathing_face_activate(movement_settings_t *settings, void *context) {
+void breathing_face_activate(void *context) {
// same as above: silence the warning, we don't need to check the settings.
- (void) settings;
// we do however need to set some things in our context. Here we cast it to the correct type...
breathing_state_t *state = (breathing_state_t *)context;
// ...and set the initial state of our watch face.
}
}
-bool breathing_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool breathing_face_loop(movement_event_t event, void *context) {
breathing_state_t *state = (breathing_state_t *)context;
switch (event.event_type) {
// movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void breathing_face_resign(movement_settings_t *settings, void *context) {
+void breathing_face_resign(void *context) {
// our watch face, like most watch faces, has nothing special to do when resigning.
// watch faces that enable a peripheral or interact with a sensor may want to turn it off here.
- (void) settings;
(void) context;
}
#include "movement.h"
-void breathing_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void breathing_face_activate(movement_settings_t *settings, void *context);
-bool breathing_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void breathing_face_resign(movement_settings_t *settings, void *context);
+void breathing_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void breathing_face_activate(void *context);
+bool breathing_face_loop(movement_event_t event, void *context);
+void breathing_face_resign(void *context);
#define breathing_face ((const watch_face_t){ \
breathing_face_setup, \
return true;
}
-void butterfly_game_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void butterfly_game_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
#endif
}
-void butterfly_game_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void butterfly_game_face_activate(void *context) {
(void) context;
movement_request_tick_frequency(TICK_FREQ);
}
-bool butterfly_game_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool butterfly_game_face_loop(movement_event_t event, void *context) {
butterfly_game_state_t *state = (butterfly_game_state_t *)context;
switch (event.event_type) {
movement_move_to_face(0);
return true;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
}
-void butterfly_game_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void butterfly_game_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
uint8_t score_p2 : 5;
} butterfly_game_state_t;
-void butterfly_game_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void butterfly_game_face_activate(movement_settings_t *settings, void *context);
-bool butterfly_game_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void butterfly_game_face_resign(movement_settings_t *settings, void *context);
+void butterfly_game_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void butterfly_game_face_activate(void *context);
+bool butterfly_game_face_loop(movement_event_t event, void *context);
+void butterfly_game_face_resign(void *context);
#define butterfly_game_face ((const watch_face_t){ \
butterfly_game_face_setup, \
}
-void couch_to_5k_face_setup(movement_settings_t *settings, uint8_t
+void couch_to_5k_face_setup(uint8_t
watch_face_index, void ** context_ptr) {
- (void) settings;
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(couch_to_5k_state_t));
// watch wakes from deep sleep.
}
-void couch_to_5k_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void couch_to_5k_face_activate(void *context) {
(void) context;
// Handle any tasks related to your watch face coming on screen.
watch_set_colon();
}
-bool couch_to_5k_face_loop(movement_event_t event, movement_settings_t *settings,
+bool couch_to_5k_face_loop(movement_event_t event,
void *context) {
couch_to_5k_state_t *state = (couch_to_5k_state_t *)context;
static char buf[11];
// skips to the secondary watch face, if configured)
// You can override any of these behaviors by adding a case for
// these events to this switch statement.
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
// return true if the watch can enter standby mode. Generally speaking, you
return true;
}
-void couch_to_5k_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void couch_to_5k_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
uint16_t timer;
} couch_to_5k_state_t;
-void couch_to_5k_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void couch_to_5k_face_activate(movement_settings_t *settings, void *context);
-bool couch_to_5k_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void couch_to_5k_face_resign(movement_settings_t *settings, void *context);
+void couch_to_5k_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void couch_to_5k_face_activate(void *context);
+bool couch_to_5k_face_loop(movement_event_t event, void *context);
+void couch_to_5k_face_resign(void *context);
#define couch_to_5k_face ((const watch_face_t){ \
couch_to_5k_face_setup, \
#include "counter_face.h"
#include "watch.h"
-void counter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void counter_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(counter_state_t));
}
}
-void counter_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void counter_face_activate(void *context) {
counter_state_t *state = (counter_state_t *)context;
if (state->beep_on) {
watch_set_indicator(WATCH_INDICATOR_SIGNAL);
}
}
-bool counter_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool counter_face_loop(movement_event_t event, void *context) {
counter_state_t *state = (counter_state_t *)context;
// ignore timeout
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
watch_display_string(buf, 0);
}
-void counter_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void counter_face_resign(void *context) {
(void) context;
}
} counter_state_t;
-void counter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void counter_face_activate(movement_settings_t *settings, void *context);
-bool counter_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void counter_face_resign(movement_settings_t *settings, void *context);
+void counter_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void counter_face_activate(void *context);
+bool counter_face_loop(movement_event_t event, void *context);
+void counter_face_resign(void *context);
void print_counter(counter_state_t *state);
void beep_counter(counter_state_t *state);
bool animating;
} databank_state;
-void databank_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void databank_face_setup(uint8_t watch_face_index, void ** context_ptr) {
// These next two lines just silence the compiler warnings associated with unused parameters.
// We have no use for the settings or the watch_face_index, so we make that explicit here.
- (void) settings;
(void) context_ptr;
(void) watch_face_index;
// At boot, context_ptr will be NULL indicating that we don't have anyplace to store our context.
}
-void databank_face_activate(movement_settings_t *settings, void *context) {
+void databank_face_activate(void *context) {
// same as above: silence the warning, we don't need to check the settings.
- (void) settings;
(void) context;
// we do however need to set some things in our context. Here we cast it to the correct type...
databank_state.current_word = 0;
}
}
-bool databank_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool databank_face_loop(movement_event_t event, void *context) {
(void) context;
int max_words = (strlen(pi_data[databank_state.databank_page * 2 + 1]) - 1) / 6 + 1;
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void databank_face_resign(movement_settings_t *settings, void *context) {
+void databank_face_resign(void *context) {
// our watch face, like most watch faces, has nothing special to do when resigning.
// watch faces that enable a peripheral or interact with a sensor may want to turn it off here.
- (void) settings;
(void) context;
}
#include "movement.h"
-void databank_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void databank_face_activate(movement_settings_t *settings, void *context);
-bool databank_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void databank_face_resign(movement_settings_t *settings, void *context);
+void databank_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void databank_face_activate(void *context);
+bool databank_face_loop(movement_event_t event, void *context);
+void databank_face_resign(void *context);
#define databank_face ((const watch_face_t){ \
databank_face_setup, \
state->birth_day = 1;
}
-void day_one_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void day_one_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(day_one_state_t));
}
}
-void day_one_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void day_one_face_activate(void *context) {
day_one_state_t *state = (day_one_state_t *)context;
state->current_page = PAGE_DISPLAY;
state->birth_day = movement_birthdate.bit.day;
}
-bool day_one_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool day_one_face_loop(movement_event_t event, void *context) {
day_one_state_t *state = (day_one_state_t *)context;
char buf[9];
}
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void day_one_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void day_one_face_resign(void *context) {
day_one_state_t *state = (day_one_state_t *)context;
// if the user changed their birth date, store it to the birth date register
uint8_t ticks;
} day_one_state_t;
-void day_one_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void day_one_face_activate(movement_settings_t *settings, void *context);
-bool day_one_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void day_one_face_resign(movement_settings_t *settings, void *context);
+void day_one_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void day_one_face_activate(void *context);
+bool day_one_face_loop(movement_event_t event, void *context);
+void day_one_face_resign(void *context);
#define day_one_face ((const watch_face_t){ \
day_one_face_setup, \
const char settings_titles[SETTINGS_NUM][3] = { "YR", "MO", "DA", "HR", "M1" };
/* Local functions */
-static void _running_init(movement_settings_t *settings, deadline_state_t *state);
-static bool _running_loop(movement_event_t event, movement_settings_t *settings, void *context);
-static void _running_display(movement_event_t event, movement_settings_t *settings, deadline_state_t *state);
-static void _setting_init(movement_settings_t *settings, deadline_state_t *state);
-static bool _setting_loop(movement_event_t event, movement_settings_t *settings, void *context);
-static void _setting_display(movement_event_t event, movement_settings_t *settings, deadline_state_t *state, watch_date_time date);
+static void _running_init(deadline_state_t *state);
+static bool _running_loop(movement_event_t event, void *context);
+static void _running_display(movement_event_t event, deadline_state_t *state);
+static void _setting_init(deadline_state_t *state);
+static bool _setting_loop(movement_event_t event, void *context);
+static void _setting_display(movement_event_t event, deadline_state_t *state, watch_date_time date);
/* Utility functions */
-static void _background_alarm_play(movement_settings_t *settings, deadline_state_t *state);
-static void _background_alarm_schedule(movement_settings_t *settings, deadline_state_t *state);
-static void _background_alarm_cancel(movement_settings_t *settings, deadline_state_t *state);
-static void _increment_date(movement_settings_t *settings, deadline_state_t *state, watch_date_time date_time);
-static inline int32_t _get_tz_offset(movement_settings_t *settings);
+static void _background_alarm_play(deadline_state_t *state);
+static void _background_alarm_schedule(deadline_state_t *state);
+static void _background_alarm_cancel(deadline_state_t *state);
+static void _increment_date(deadline_state_t *state, watch_date_time date_time);
static inline void _change_tick_freq(uint8_t freq, deadline_state_t *state);
static inline bool _is_leap(int16_t y);
static inline int _days_in_month(int16_t mpnth, int16_t y);
static inline unsigned int _mod(int a, int b);
-static inline void _beep_button(movement_settings_t *settings);
-static inline void _beep_enable(movement_settings_t *settings);
-static inline void _beep_disable(movement_settings_t *settings);
-static inline void _reset_deadline(movement_settings_t *settings, deadline_state_t *state);
+static inline void _beep_button();
+static inline void _beep_enable();
+static inline void _beep_disable();
+static inline void _reset_deadline(deadline_state_t *state);
/* Check for leap year */
static inline bool _is_leap(int16_t y)
}
}
-/* Return time zone offset */
-static inline int32_t _get_tz_offset(movement_settings_t *settings)
-{
- return movement_get_current_timezone_offset();
-}
-
/* Beep for a button press*/
-static inline void _beep_button(movement_settings_t *settings)
+static inline void _beep_button()
{
// Play a beep as confirmation for a button press (if applicable)
if (!movement_button_should_sound())
}
/* Beep for entering settings */
-static inline void _beep_enable(movement_settings_t *settings)
+static inline void _beep_enable()
{
if (!movement_button_should_sound())
return;
}
/* Beep for leaving settings */
-static inline void _beep_disable(movement_settings_t *settings)
+static inline void _beep_disable()
{
if (!movement_button_should_sound())
return;
}
/* Determine index of closest deadline */
-static uint8_t _closest_deadline(movement_settings_t *settings, deadline_state_t *state)
+static uint8_t _closest_deadline(deadline_state_t *state)
{
watch_date_time now = watch_rtc_get_date_time();
- uint32_t now_ts = watch_utility_date_time_to_unix_time(now, _get_tz_offset(settings));
+ uint32_t now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
uint32_t min_ts = UINT32_MAX;
uint8_t min_index = 0;
}
/* Play background alarm */
-static void _background_alarm_play(movement_settings_t *settings, deadline_state_t *state)
+static void _background_alarm_play(deadline_state_t *state)
{
- (void) settings;
/* Use the default alarm from movement and move to foreground */
if (state->alarm_enabled) {
}
/* Schedule background alarm */
-static void _background_alarm_schedule(movement_settings_t *settings, deadline_state_t *state)
+static void _background_alarm_schedule(deadline_state_t *state)
{
/* We simply re-use the scheduling in the background task */
- deadline_face_wants_background_task(settings, state);
+ deadline_face_wants_background_task(state);
}
/* Cancel background alarm */
-static void _background_alarm_cancel(movement_settings_t *settings, deadline_state_t *state)
+static void _background_alarm_cancel(deadline_state_t *state)
{
- (void) settings;
movement_cancel_background_task_for_face(state->face_idx);
}
/* Reset deadline to tomorrow */
-static inline void _reset_deadline(movement_settings_t *settings, deadline_state_t *state)
+static inline void _reset_deadline(deadline_state_t *state)
{
/* Get current time and reset hours/minutes/seconds */
watch_date_time date_time = watch_rtc_get_date_time();
date_time.unit.hour = 0;
/* Add 24 hours to obtain first second of tomorrow */
- uint32_t ts = watch_utility_date_time_to_unix_time(date_time, _get_tz_offset(settings));
+ uint32_t ts = watch_utility_date_time_to_unix_time(date_time, movement_get_current_timezone_offset());
ts += 24 * 60 * 60;
state->deadlines[state->current_index] = ts;
}
/* Increment date in settings mode. Function taken from `set_time_face.c` */
-static void _increment_date(movement_settings_t *settings, deadline_state_t *state, watch_date_time date_time)
+static void _increment_date(deadline_state_t *state, watch_date_time date_time)
{
const uint8_t days_in_month[12] = { 31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31 };
break;
}
- uint32_t ts = watch_utility_date_time_to_unix_time(date_time, _get_tz_offset(settings));
+ uint32_t ts = watch_utility_date_time_to_unix_time(date_time, movement_get_current_timezone_offset());
state->deadlines[state->current_index] = ts;
}
/* Update display in running mode */
-static void _running_display(movement_event_t event, movement_settings_t *settings, deadline_state_t *state)
+static void _running_display(movement_event_t event, deadline_state_t *state)
{
(void) event;
- (void) settings;
/* Seconds, minutes, hours, days, months, years */
int16_t unit[] = { 0, 0, 0, 0, 0, 0 };
watch_clear_indicator(WATCH_INDICATOR_BELL);
watch_date_time now = watch_rtc_get_date_time();
- uint32_t now_ts = watch_utility_date_time_to_unix_time(now, _get_tz_offset(settings));
+ uint32_t now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
/* Deadline expired */
if (state->deadlines[state->current_index] < now_ts) {
}
/* Get date time structs */
- watch_date_time deadline = watch_utility_date_time_from_unix_time(state->deadlines[state->current_index], _get_tz_offset(settings)
+ watch_date_time deadline = watch_utility_date_time_from_unix_time(state->deadlines[state->current_index], movement_get_current_timezone_offset()
);
/* Calculate naive difference of dates */
}
/* Init running mode */
-static void _running_init(movement_settings_t *settings, deadline_state_t *state)
+static void _running_init(deadline_state_t *state)
{
- (void) settings;
(void) state;
watch_clear_indicator(WATCH_INDICATOR_24H);
}
/* Loop of running mode */
-static bool _running_loop(movement_event_t event, movement_settings_t *settings, void *context)
+static bool _running_loop(movement_event_t event, void *context)
{
deadline_state_t *state = (deadline_state_t *) context;
if (event.event_type != EVENT_BACKGROUND_TASK)
- _running_display(event, settings, state);
+ _running_display(event, state);
switch (event.event_type) {
case EVENT_ALARM_BUTTON_UP:
- _beep_button(settings);
+ _beep_button();
state->current_index = (state->current_index + 1) % DEADLINE_FACE_DATES;
- _running_display(event, settings, state);
+ _running_display(event, state);
break;
case EVENT_ALARM_LONG_PRESS:
- _beep_enable(settings);
- _setting_init(settings, state);
+ _beep_enable();
+ _setting_init(state);
state->mode = DEADLINE_FACE_SETTING;
break;
case EVENT_MODE_BUTTON_UP:
case EVENT_LIGHT_BUTTON_DOWN:
break;
case EVENT_LIGHT_LONG_PRESS:
- _beep_button(settings);
+ _beep_button();
state->alarm_enabled = !state->alarm_enabled;
if (state->alarm_enabled) {
_background_alarm_schedule(settings, context);
} else {
_background_alarm_cancel(settings, context);
}
- _running_display(event, settings, state);
+ _running_display(event, state);
break;
case EVENT_TIMEOUT:
movement_move_to_face(0);
break;
case EVENT_BACKGROUND_TASK:
- _background_alarm_play(settings, state);
+ _background_alarm_play(state);
break;
case EVENT_LOW_ENERGY_UPDATE:
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
/* Update display in settings mode */
-static void _setting_display(movement_event_t event, movement_settings_t *settings, deadline_state_t *state, watch_date_time date_time)
+static void _setting_display(movement_event_t event, deadline_state_t *state, watch_date_time date_time)
{
char buf[11];
}
/* Init setting mode */
-static void _setting_init(movement_settings_t *settings, deadline_state_t *state)
+static void _setting_init(deadline_state_t *state)
{
state->current_page = 0;
/* Init fresh deadline to next day */
if (state->deadlines[state->current_index] == 0) {
- _reset_deadline(settings, state);
+ _reset_deadline(state);
}
/* Ensure 1Hz updates only */
}
/* Loop of setting mode */
-static bool _setting_loop(movement_event_t event, movement_settings_t *settings, void *context)
+static bool _setting_loop(movement_event_t event, void *context)
{
deadline_state_t *state = (deadline_state_t *) context;
watch_date_time date_time;
- date_time = watch_utility_date_time_from_unix_time(state->deadlines[state->current_index], _get_tz_offset(settings));
+ date_time = watch_utility_date_time_from_unix_time(state->deadlines[state->current_index], movement_get_current_timezone_offset());
if (event.event_type != EVENT_BACKGROUND_TASK)
- _setting_display(event, settings, state, date_time);
+ _setting_display(event, state, date_time);
switch (event.event_type) {
case EVENT_TICK:
if (state->tick_freq == 8) {
if (watch_get_pin_level(BTN_ALARM)) {
- _increment_date(settings, state, date_time);
- _setting_display(event, settings, state, date_time);
+ _increment_date(state, date_time);
+ _setting_display(event, state, date_time);
} else {
_change_tick_freq(4, state);
}
_change_tick_freq(4, state);
break;
case EVENT_LIGHT_LONG_PRESS:
- _beep_button(settings);
- _reset_deadline(settings, state);
+ _beep_button();
+ _reset_deadline(state);
break;
case EVENT_LIGHT_BUTTON_DOWN:
break;
case EVENT_LIGHT_BUTTON_UP:
state->current_page = (state->current_page + 1) % SETTINGS_NUM;
- _setting_display(event, settings, state, date_time);
+ _setting_display(event, state, date_time);
break;
case EVENT_ALARM_BUTTON_UP:
_change_tick_freq(4, state);
- _increment_date(settings, state, date_time);
- _setting_display(event, settings, state, date_time);
+ _increment_date(state, date_time);
+ _setting_display(event, state, date_time);
break;
case EVENT_TIMEOUT:
- _beep_button(settings);
+ _beep_button();
_background_alarm_schedule(settings, context);
_change_tick_freq(1, state);
state->mode = DEADLINE_FACE_RUNNING;
movement_move_to_face(0);
break;
case EVENT_MODE_BUTTON_UP:
- _beep_disable(settings);
+ _beep_disable();
_background_alarm_schedule(settings, context);
- _running_init(settings, state);
- _running_display(event, settings, state);
+ _running_init(state);
+ _running_display(event, state);
state->mode = DEADLINE_FACE_RUNNING;
break;
case EVENT_BACKGROUND_TASK:
- _background_alarm_play(settings, state);
+ _background_alarm_play(state);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
/* Setup face */
-void deadline_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr)
+void deadline_face_setup(uint8_t watch_face_index, void **context_ptr)
{
- (void) settings;
(void) watch_face_index;
if (*context_ptr != NULL)
return; /* Skip setup if context available */
}
/* Activate face */
-void deadline_face_activate(movement_settings_t *settings, void *context)
+void deadline_face_activate(void *context)
{
- (void) settings;
deadline_state_t *state = (deadline_state_t *) context;
/* Set display options */
- _running_init(settings, state);
+ _running_init(state);
state->mode = DEADLINE_FACE_RUNNING;
- state->current_index = _closest_deadline(settings, state);
+ state->current_index = _closest_deadline(state);
}
/* Loop face */
-bool deadline_face_loop(movement_event_t event, movement_settings_t *settings, void *context)
+bool deadline_face_loop(movement_event_t event, void *context)
{
- (void) settings;
deadline_state_t *state = (deadline_state_t *) context;
switch (state->mode) {
case DEADLINE_FACE_SETTING:
}
/* Resign face */
-void deadline_face_resign(movement_settings_t *settings, void *context)
+void deadline_face_resign(void *context)
{
- (void) settings;
(void) context;
}
/* Want background task */
-bool deadline_face_wants_background_task(movement_settings_t *settings, void *context)
+bool deadline_face_wants_background_task(void *context)
{
deadline_state_t *state = (deadline_state_t *) context;
/* Determine closest deadline */
watch_date_time now = watch_rtc_get_date_time();
- uint32_t now_ts = watch_utility_date_time_to_unix_time(now, _get_tz_offset(settings));
- uint32_t next_ts = state->deadlines[_closest_deadline(settings, state)];
+ uint32_t now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
+ uint32_t next_ts = state->deadlines[_closest_deadline(state)];
/* No active deadline */
if (next_ts < now_ts)
return false;
/* Deadline within next minute. Let's set up an alarm */
- watch_date_time next = watch_utility_date_time_from_unix_time(next_ts, _get_tz_offset(settings));
+ watch_date_time next = watch_utility_date_time_from_unix_time(next_ts, movement_get_current_timezone_offset());
movement_request_wake();
movement_schedule_background_task_for_face(state->face_idx, next);
return false;
uint32_t deadlines[DEADLINE_FACE_DATES];
} deadline_state_t;
-void deadline_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr);
-void deadline_face_activate(movement_settings_t *settings, void *context);
-bool deadline_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void deadline_face_resign(movement_settings_t *settings, void *context);
-bool deadline_face_wants_background_task(movement_settings_t *settings, void *context);
+void deadline_face_setup(uint8_t watch_face_index, void **context_ptr);
+void deadline_face_activate(void *context);
+bool deadline_face_loop(movement_event_t event, void *context);
+void deadline_face_resign(void *context);
+bool deadline_face_wants_background_task(void *context);
#define deadline_face ((const watch_face_t){ \
deadline_face_setup, \
///////////////////////////////////////////////////////////////////////////////////////////////
/* Beep function */
-static inline void beep(movement_settings_t *settings) {
+static inline void beep() {
if (movement_button_should_sound()) watch_buzzer_play_note(BUZZER_NOTE_C7, 50);
}
}
/* Configuration at boot, the high score array can be initialized with your high scores if they're known */
-void discgolf_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void discgolf_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void discgolf_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void discgolf_face_activate(void *context) {
watch_clear_colon();
discgolf_state_t *state = (discgolf_state_t *)context;
movement_request_tick_frequency(4);
}
-bool discgolf_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool discgolf_face_loop(movement_event_t event, void *context) {
discgolf_state_t *state = (discgolf_state_t *)context;
state->mode = dg_idle;
break;
}
- beep(settings);
+ beep();
break;
case EVENT_ALARM_BUTTON_UP:
switch (state->mode) {
state->mode = dg_setting;
store_best(state);
reset(state);
- beep(settings);
+ beep();
}
break;
case EVENT_ALARM_LONG_PRESS:
/* Snap back to currently playing hole if we've established one*/
if ( (state->mode == dg_idle) && (state->hole != state->playing) && (state->playing <= holes[state->course]) ) {
state->hole = state->playing;
- beep(settings);
+ beep();
}
break;
default:
return true;
}
-void discgolf_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void discgolf_face_resign(void *context) {
(void) context;
watch_clear_indicator(WATCH_INDICATOR_LAP);
}
discgolf_mode_t mode; // Watch face mode
} discgolf_state_t;
-void discgolf_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void discgolf_face_activate(movement_settings_t *settings, void *context);
-bool discgolf_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void discgolf_face_resign(movement_settings_t *settings, void *context);
+void discgolf_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void discgolf_face_activate(void *context);
+bool discgolf_face_loop(movement_event_t event, void *context);
+void discgolf_face_resign(void *context);
#define discgolf_face ((const watch_face_t){ \
discgolf_face_setup, \
// PUBLIC WATCH FACE FUNCTIONS ////////////////////////////////////////////////
-void dual_timer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void dual_timer_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(dual_timer_state_t));
}
}
-void dual_timer_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void dual_timer_face_activate(void *context) {
(void) context;
if (_is_running) {
movement_schedule_background_task(distant_future);
}
}
-bool dual_timer_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool dual_timer_face_loop(movement_event_t event, void *context) {
dual_timer_state_t *state = (dual_timer_state_t *)context;
// timers stop at 99:23:59:59:99
dual_timer_display(state);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void dual_timer_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void dual_timer_face_resign(void *context) {
(void) context;
movement_cancel_background_task();
// handle any cleanup before your watch face goes off-screen.
bool show;
} dual_timer_state_t;
-void dual_timer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void dual_timer_face_activate(movement_settings_t *settings, void *context);
-bool dual_timer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void dual_timer_face_resign(movement_settings_t *settings, void *context);
+void dual_timer_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void dual_timer_face_activate(void *context);
+bool dual_timer_face_loop(movement_event_t event, void *context);
+void dual_timer_face_resign(void *context);
#if __EMSCRIPTEN__
void em_dual_timer_cb_handler(void *userData);
display_fuel(subsecond, state -> difficulty);
}
-void endless_runner_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void endless_runner_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(endless_runner_state_t));
}
}
-void endless_runner_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void endless_runner_face_activate(void *context) {
(void) context;
}
-bool endless_runner_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool endless_runner_face_loop(movement_event_t event, void *context) {
endless_runner_state_t *state = (endless_runner_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
display_time(watch_rtc_get_date_time(), movement_clock_mode_24h());
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void endless_runner_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void endless_runner_face_resign(void *context) {
(void) context;
}
/* 24 bits, likely aligned to 32 bits = 4 bytes */
} endless_runner_state_t;
-void endless_runner_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void endless_runner_face_activate(movement_settings_t *settings, void *context);
-bool endless_runner_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void endless_runner_face_resign(movement_settings_t *settings, void *context);
+void endless_runner_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void endless_runner_face_activate(void *context);
+bool endless_runner_face_loop(movement_event_t event, void *context);
+void endless_runner_face_resign(void *context);
#define endless_runner_face ((const watch_face_t){ \
endless_runner_face_setup, \
#include <string.h>
#include "flashlight_face.h"
-void flashlight_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void flashlight_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(flashlight_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void flashlight_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void flashlight_face_activate(void *context) {
(void) context;
watch_enable_digital_output(A2);
watch_set_pin_level(A2, false);
}
-bool flashlight_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool flashlight_face_loop(movement_event_t event, void *context) {
(void) context;
switch (event.event_type) {
movement_move_to_face(0);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void flashlight_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void flashlight_face_resign(void *context) {
(void) context;
watch_set_pin_level(A2, false);
uint8_t unused;
} flashlight_state_t;
-void flashlight_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void flashlight_face_activate(movement_settings_t *settings, void *context);
-bool flashlight_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void flashlight_face_resign(movement_settings_t *settings, void *context);
+void flashlight_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void flashlight_face_activate(void *context);
+bool flashlight_face_loop(movement_event_t event, void *context);
+void flashlight_face_resign(void *context);
#define flashlight_face ((const watch_face_t){ \
flashlight_face_setup, \
// WATCH FACE FUNCTIONS ///////////////////////////////////////////////////////
-void geomancy_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void geomancy_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
- (void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(geomancy_state_t));
memset(*context_ptr, 0, sizeof(geomancy_state_t));
}
}
-void geomancy_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void geomancy_face_activate(void *context) {
(void) context;
}
-bool geomancy_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool geomancy_face_loop(movement_event_t event, void *context) {
geomancy_state_t *state = (geomancy_state_t *)context;
switch (event.event_type) {
geomancy_face_display(state);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void geomancy_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void geomancy_face_resign(void *context) {
(void) context;
}
bool animate;
} geomancy_state_t;
-void geomancy_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void geomancy_face_activate(movement_settings_t *settings, void *context);
-bool geomancy_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void geomancy_face_resign(movement_settings_t *settings, void *context);
+void geomancy_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void geomancy_face_activate(void *context);
+bool geomancy_face_loop(movement_event_t event, void *context);
+void geomancy_face_resign(void *context);
#define geomancy_face ((const watch_face_t){ \
geomancy_face_setup, \
bool display_total;
} habit_state_t;
-void habit_face_setup(movement_settings_t *settings, uint8_t watch_face_index,
+void habit_face_setup(uint8_t watch_face_index,
void **context_ptr) {
- (void)settings;
(void)watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(habit_state_t));
}
}
-void habit_face_activate(movement_settings_t *settings, void *context) {
- (void)settings;
+void habit_face_activate(void *context) {
habit_state_t *state = (habit_state_t *)context;
display_state(state);
}
-bool habit_face_loop(movement_event_t event, movement_settings_t *settings,
+bool habit_face_loop(movement_event_t event,
void *context) {
habit_state_t *state = (habit_state_t *)context;
break;
}
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void habit_face_resign(movement_settings_t *settings, void *context) {
- (void)settings;
+void habit_face_resign(void *context) {
(void)context;
}
#include "movement.h"
-void habit_face_setup(movement_settings_t *settings, uint8_t watch_face_index,
+void habit_face_setup(uint8_t watch_face_index,
void **context_ptr);
-void habit_face_activate(movement_settings_t *settings, void *context);
-bool habit_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void habit_face_resign(movement_settings_t *settings, void *context);
+void habit_face_activate(void *context);
+bool habit_face_loop(movement_event_t event, void *context);
+void habit_face_resign(void *context);
#define habit_face ((const watch_face_t){ \
habit_face_setup, \
do_game_loop(HL_GUESS_LOWER);\r
}\r
\r
-void higher_lower_game_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr) {\r
- (void) settings;\r
+void higher_lower_game_face_setup(uint8_t watch_face_index, void **context_ptr) {\r
(void) watch_face_index;\r
\r
if (*context_ptr == NULL) {\r
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.\r
}\r
\r
-void higher_lower_game_face_activate(movement_settings_t *settings, void *context) {\r
- (void) settings;\r
+void higher_lower_game_face_activate(void *context) {\r
higher_lower_game_face_state_t *state = (higher_lower_game_face_state_t *) context;\r
(void) state;\r
// Handle any tasks related to your watch face coming on screen.\r
game_state = HL_GS_TITLE_SCREEN;\r
}\r
\r
-bool higher_lower_game_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {\r
+bool higher_lower_game_face_loop(movement_event_t event, void *context) {\r
higher_lower_game_face_state_t *state = (higher_lower_game_face_state_t *) context;\r
(void) state;\r
\r
// movement_move_to_face(0);\r
break;\r
default:\r
- return movement_default_loop_handler(event, settings);\r
+ return movement_default_loop_handler(event);\r
}\r
\r
// return true if the watch can enter standby mode. Generally speaking, you should always return true.\r
return true;\r
}\r
\r
-void higher_lower_game_face_resign(movement_settings_t *settings, void *context) {\r
- (void) settings;\r
+void higher_lower_game_face_resign(void *context) {\r
(void) context;\r
\r
// handle any cleanup before your watch face goes off-screen.\r
// Anything you need to keep track of, put it here!\r
} higher_lower_game_face_state_t;\r
\r
-void higher_lower_game_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);\r
-void higher_lower_game_face_activate(movement_settings_t *settings, void *context);\r
-bool higher_lower_game_face_loop(movement_event_t event, movement_settings_t *settings, void *context);\r
-void higher_lower_game_face_resign(movement_settings_t *settings, void *context);\r
+void higher_lower_game_face_setup(uint8_t watch_face_index, void ** context_ptr);\r
+void higher_lower_game_face_activate(void *context);\r
+bool higher_lower_game_face_loop(movement_event_t event, void *context);\r
+void higher_lower_game_face_resign(void *context);\r
\r
#define higher_lower_game_face ((const watch_face_t){ \\r
higher_lower_game_face_setup, \\r
return watch_utility_date_time_to_unix_time(now, 0);
}
-static inline void _button_beep(movement_settings_t *settings) {
+static inline void _button_beep() {
// play a beep as confirmation for a button press (if applicable)
if (movement_button_should_sound()) watch_buzzer_play_note(BUZZER_NOTE_C7, 50);
}
watch_set_indicator(WATCH_INDICATOR_BELL);
}
-void interval_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr) {
- (void) settings;
+void interval_face_setup(uint8_t watch_face_index, void **context_ptr) {
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(interval_face_state_t));
}
}
-void interval_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void interval_face_activate(void *context) {
interval_face_state_t *state = (interval_face_state_t *)context;
_erase_timer_flag = false;
state->is_active = true;
} else watch_set_colon();
}
-void interval_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void interval_face_resign(void *context) {
interval_face_state_t *state = (interval_face_state_t *)context;
if (state->face_state <= interval_state_setting) state->face_state = interval_state_waiting;
watch_set_led_off();
state->is_active = false;
}
-bool interval_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool interval_face_loop(movement_event_t event, void *context) {
interval_face_state_t *state = (interval_face_state_t *)context;
interval_timer_setting_t *timer = &state->timer[state->timer_idx];
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
interval_timer_setting_t timer[INTERVAL_TIMERS];
} interval_face_state_t;
-void interval_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void interval_face_activate(movement_settings_t *settings, void *context);
-bool interval_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void interval_face_resign(movement_settings_t *settings, void *context);
+void interval_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void interval_face_activate(void *context);
+bool interval_face_loop(movement_event_t event, void *context);
+void interval_face_resign(void *context);
#define interval_face ((const watch_face_t) { \
interval_face_setup, \
return false;
}
-void invaders_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void invaders_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(invaders_state_t));
#endif
}
-void invaders_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void invaders_face_activate(void *context) {
(void) context;
_current_state = invaders_state_activated;
_signals.suspend_buttons = false;
}
-bool invaders_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool invaders_face_loop(movement_event_t event, void *context) {
invaders_state_t *state = (invaders_state_t *)context;
switch (event.event_type) {
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
// You can override any of these behaviors by adding a case for these events to this switch statement.
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
// return true if the watch can enter standby mode. Generally speaking, you should always return true.
return true;
}
-void invaders_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void invaders_face_resign(void *context) {
(void) context;
_current_state = invaders_state_game_over;
}
bool sound_on;
} invaders_state_t;
-void invaders_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void invaders_face_activate(movement_settings_t *settings, void *context);
-bool invaders_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void invaders_face_resign(movement_settings_t *settings, void *context);
+void invaders_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void invaders_face_activate(void *context);
+bool invaders_face_loop(movement_event_t event, void *context);
+void invaders_face_resign(void *context);
#define invaders_face ((const watch_face_t){ \
invaders_face_setup, \
static int8_t calc_fail_seq[5] = {BUZZER_NOTE_C7, 10, BUZZER_NOTE_G6, 10, 0};
// Resets all state variables to 0
-static void reset_state(kitchen_conversions_state_t *state, movement_settings_t *settings)
+static void reset_state(kitchen_conversions_state_t *state)
{
state->pg = measurement;
state->measurement_i = 0;
state->light_held = false;
}
-void kitchen_conversions_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr)
+void kitchen_conversions_face_setup(uint8_t watch_face_index, void **context_ptr)
{
- (void)settings;
(void)watch_face_index;
if (*context_ptr == NULL)
{
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void kitchen_conversions_face_activate(movement_settings_t *settings, void *context)
+void kitchen_conversions_face_activate(void *context)
{
- (void)settings;
kitchen_conversions_state_t *state = (kitchen_conversions_state_t *)context;
// Handle any tasks related to your watch face coming on screen.
watch_display_string(get_unit_list(measurement_i)[list_i].name, 4);
}
-static void display(kitchen_conversions_state_t *state, movement_settings_t *settings, uint8_t subsec)
+static void display(kitchen_conversions_state_t *state, uint8_t subsec)
{
watch_clear_display();
}
}
-bool kitchen_conversions_face_loop(movement_event_t event, movement_settings_t *settings, void *context)
+bool kitchen_conversions_face_loop(movement_event_t event, void *context)
{
kitchen_conversions_state_t *state = (kitchen_conversions_state_t *)context;
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void kitchen_conversions_face_resign(movement_settings_t *settings, void *context)
+void kitchen_conversions_face_resign(void *context)
{
- (void)settings;
(void)context;
// handle any cleanup before your watch face goes off-screen.
bool light_held;
} kitchen_conversions_state_t;
-void kitchen_conversions_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr);
-void kitchen_conversions_face_activate(movement_settings_t *settings, void *context);
-bool kitchen_conversions_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void kitchen_conversions_face_resign(movement_settings_t *settings, void *context);
+void kitchen_conversions_face_setup(uint8_t watch_face_index, void **context_ptr);
+void kitchen_conversions_face_activate(void *context);
+bool kitchen_conversions_face_loop(movement_event_t event, void *context);
+void kitchen_conversions_face_resign(void *context);
#define kitchen_conversions_face ((const watch_face_t){ \
kitchen_conversions_face_setup, \
};
/* Beep function */
-static inline void beep(movement_settings_t *settings) {
+static inline void beep() {
if (movement_button_should_sound())
watch_buzzer_play_note(BUZZER_NOTE_E8, 75);
}
state->cycles.bit.longest_cycle = cycle_length;
}
-void menstrual_cycle_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void menstrual_cycle_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
- (void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(menstrual_cycle_state_t));
}
}
-void menstrual_cycle_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void menstrual_cycle_face_activate(void *context) {
menstrual_cycle_state_t *state = (menstrual_cycle_state_t *)context;
state->period_today = 0;
state->current_page = 0;
movement_request_tick_frequency(4); // we need to manually blink some pixels
}
-bool menstrual_cycle_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool menstrual_cycle_face_loop(movement_event_t event, void *context) {
menstrual_cycle_state_t *state = (menstrual_cycle_state_t *)context;
watch_date_time date_period;
uint8_t current_page = state->current_page;
movement_move_to_face(0);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
watch_display_string((char *)menstrual_cycle_face_titles[current_page], 0);
return true;
}
-void menstrual_cycle_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void menstrual_cycle_face_resign(void *context) {
(void) context;
}
\ No newline at end of file
bool reset_tracking;
} menstrual_cycle_state_t;
-void menstrual_cycle_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void menstrual_cycle_face_activate(movement_settings_t *settings, void *context);
-bool menstrual_cycle_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void menstrual_cycle_face_resign(movement_settings_t *settings, void *context);
+void menstrual_cycle_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void menstrual_cycle_face_activate(void *context);
+bool menstrual_cycle_face_loop(movement_event_t event, void *context);
+void menstrual_cycle_face_resign(void *context);
#define menstrual_cycle_face ((const watch_face_t){ \
menstrual_cycle_face_setup, \
static const int8_t _sound_seq_start[] = {BUZZER_NOTE_C8, 2, 0};
static const int8_t _sound_seq_beat[] = {BUZZER_NOTE_C6, 2, 0};
-void metronome_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void metronome_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(metronome_state_t));
}
}
-void metronome_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void metronome_face_activate(void *context) {
metronome_state_t *state = (metronome_state_t *)context;
movement_request_tick_frequency(2);
if (state->bpm == 0) {
watch_display_string(buf, 0);
}
-bool metronome_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool metronome_face_loop(movement_event_t event, void *context) {
metronome_state_t *state = (metronome_state_t *)context;
switch (event.event_type) {
case EVENT_LOW_ENERGY_UPDATE:
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void metronome_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void metronome_face_resign(void *context) {
(void) context;
}
bool soundOn;
} metronome_state_t;
-void metronome_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void metronome_face_activate(movement_settings_t *settings, void *context);
-bool metronome_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void metronome_face_resign(movement_settings_t *settings, void *context);
+void metronome_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void metronome_face_activate(void *context);
+bool metronome_face_loop(movement_event_t event, void *context);
+void metronome_face_resign(void *context);
#define metronome_face ((const watch_face_t){ \
metronome_face_setup, \
static const float phase_changes[] = {0, 1, 6.38264692644, 8.38264692644, 13.76529385288, 15.76529385288, 21.14794077932, 23.14794077932, 28.53058770576, 29.53058770576};
-void moon_phase_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void moon_phase_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(moon_phase_state_t));
}
}
-void moon_phase_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void moon_phase_face_activate(void *context) {
(void) context;
}
-static void _update(movement_settings_t *settings, moon_phase_state_t *state, uint32_t offset) {
+static void _update(moon_phase_state_t *state, uint32_t offset) {
(void)state;
char buf[11];
watch_date_time date_time = watch_rtc_get_date_time();
watch_display_string(buf, 2);
}
-bool moon_phase_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool moon_phase_face_loop(movement_event_t event, void *context) {
moon_phase_state_t *state = (moon_phase_state_t *)context;
watch_date_time date_time;
switch (event.event_type) {
case EVENT_ACTIVATE:
- _update(settings, state, state->offset);
+ _update(state, state->offset);
break;
case EVENT_TICK:
// only update once an hour
date_time = watch_rtc_get_date_time();
- if ((date_time.unit.minute == 0) && (date_time.unit.second == 0)) _update(settings, state, state->offset);
+ if ((date_time.unit.minute == 0) && (date_time.unit.second == 0)) _update(state, state->offset);
break;
case EVENT_LOW_ENERGY_UPDATE:
// update at the top of the hour OR if we're entering sleep mode with an offset.
// also, in sleep mode, always show the current moon phase (offset = 0).
- if (state->offset || (watch_rtc_get_date_time().unit.minute == 0)) _update(settings, state, 0);
+ if (state->offset || (watch_rtc_get_date_time().unit.minute == 0)) _update(state, 0);
// and kill the offset so when the wearer wakes up, it matches what's on screen.
state->offset = 0;
// finally: clear out the last two digits and replace them with the sleep mode indicator
// Pressing the alarm adds an offset of one day to the displayed value,
// so you can see moon phases in the future.
state->offset += 86400;
- _update(settings, state, state->offset);
+ _update(state, state->offset);
break;
case EVENT_ALARM_LONG_PRESS:
state->offset = 0;
- _update(settings, state, state->offset);
+ _update(state, state->offset);
break;
case EVENT_TIMEOUT:
// QUESTION: Should timeout reset offset to 0?
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void moon_phase_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void moon_phase_face_resign(void *context) {
moon_phase_state_t *state = (moon_phase_state_t *)context;
state->offset = 0;
}
uint32_t offset;
} moon_phase_state_t;
-void moon_phase_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void moon_phase_face_activate(movement_settings_t *settings, void *context);
-bool moon_phase_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void moon_phase_face_resign(movement_settings_t *settings, void *context);
+void moon_phase_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void moon_phase_face_activate(void *context);
+bool moon_phase_face_loop(movement_event_t event, void *context);
+void moon_phase_face_resign(void *context);
#define moon_phase_face ((const watch_face_t){ \
moon_phase_face_setup, \
return;
}
-void morsecalc_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void morsecalc_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(morsecalc_state_t));
return;
}
-void morsecalc_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void morsecalc_face_activate(void *context) {
morsecalc_state_t *mcs = (morsecalc_state_t *) context;
mcs->mc = 0;
morsecalc_display_stack(mcs);
return;
}
-bool morsecalc_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool morsecalc_face_loop(movement_event_t event, void *context) {
morsecalc_state_t *mcs = (morsecalc_state_t *) context;
switch(event.event_type) {
// input
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void morsecalc_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void morsecalc_face_resign(void *context) {
morsecalc_state_t *mcs = (morsecalc_state_t *) context;
mcs->led_is_on = 0;
watch_set_led_off();
*/
static const char MORSECODE_TREE[] = " etianmsurwdkgohvf\0l\0pjbxcyzq\0C\x35\x34V\x33\0R\0\x32W\0+\0\0\0\0\x31\x36=/\0\0S(\0\x37\0\0\0\x38\0\x39\x30\0\0\0\0\0E\0\0\0\0\0\0?_\0\0\0\0\"\0\0.\0\0\0\0@\0\0\0'\0\0-\0\0\0\0\0\0\0\0;!\0)\0\0\0\0\0,\0\0\0\0:\0\0\0\0\0\0";
-void morsecalc_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void morsecalc_face_activate(movement_settings_t *settings, void *context);
-bool morsecalc_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void morsecalc_face_resign(movement_settings_t *settings, void *context);
+void morsecalc_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void morsecalc_face_activate(void *context);
+bool morsecalc_face_loop(movement_event_t event, void *context);
+void morsecalc_face_resign(void *context);
typedef struct {
calc_state_t *cs;
"NE" // Neptune
};
-static void _orrery_face_recalculate(movement_settings_t *settings, orrery_state_t *state) {
+static void _orrery_face_recalculate(orrery_state_t *state) {
watch_date_time date_time = watch_rtc_get_date_time();
uint32_t timestamp = watch_utility_date_time_to_unix_time(date_time, movement_get_current_timezone_offset());
date_time = watch_utility_date_time_from_unix_time(timestamp, 0);
state->coords[2] = r[2];
}
-static void _orrery_face_update(movement_event_t event, movement_settings_t *settings, orrery_state_t *state) {
+static void _orrery_face_update(movement_event_t event, orrery_state_t *state) {
char buf[11];
switch (state->mode) {
case ORRERY_MODE_SELECTING_BODY:
watch_clear_display();
// this takes a moment and locks the UI, flash C for "Calculating"
watch_start_character_blink('C', 100);
- _orrery_face_recalculate(settings, state);
+ _orrery_face_recalculate(state);
watch_stop_blink();
state->mode = ORRERY_MODE_DISPLAYING_X;
// fall through
}
}
-void orrery_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void orrery_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(orrery_state_t));
}
}
-void orrery_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void orrery_face_activate(void *context) {
(void) context;
movement_request_tick_frequency(4);
}
-bool orrery_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool orrery_face_loop(movement_event_t event, void *context) {
orrery_state_t *state = (orrery_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
case EVENT_TICK:
- _orrery_face_update(event, settings, state);
+ _orrery_face_update(event, state);
break;
case EVENT_ALARM_BUTTON_UP:
switch (state->mode) {
state->mode++;
break;
}
- _orrery_face_update(event, settings, state);
+ _orrery_face_update(event, state);
break;
case EVENT_ALARM_LONG_PRESS:
if (state->mode == ORRERY_MODE_SELECTING_BODY) {
// celestial body selected! this triggers a calculation in the update method.
state->mode = ORRERY_MODE_CALCULATING;
movement_request_tick_frequency(1);
- _orrery_face_update(event, settings, state);
+ _orrery_face_update(event, state);
} else if (state->mode != ORRERY_MODE_CALCULATING) {
// in all modes except "doing a calculation", return to the selection screen.
state->mode = ORRERY_MODE_SELECTING_BODY;
movement_request_tick_frequency(4);
- _orrery_face_update(event, settings, state);
+ _orrery_face_update(event, state);
}
break;
case EVENT_TIMEOUT:
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void orrery_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void orrery_face_resign(void *context) {
orrery_state_t *state = (orrery_state_t *)context;
state->mode = ORRERY_MODE_SELECTING_BODY;
}
uint8_t animation_state;
} orrery_state_t;
-void orrery_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void orrery_face_activate(movement_settings_t *settings, void *context);
-bool orrery_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void orrery_face_resign(movement_settings_t *settings, void *context);
+void orrery_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void orrery_face_activate(void *context);
+bool orrery_face_loop(movement_event_t event, void *context);
+void orrery_face_resign(void *context);
#define orrery_face ((const watch_face_t){ \
orrery_face_setup, \
static const char* _text_looping;
static const char title_text[] = "Periodic Table";
-void periodic_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr)
+void periodic_face_setup(uint8_t watch_face_index, void **context_ptr)
{
- (void)settings;
(void)watch_face_index;
if (*context_ptr == NULL)
{
}
}
-void periodic_face_activate(movement_settings_t *settings, void *context)
+void periodic_face_activate(void *context)
{
- (void)settings;
periodic_state_t *state = (periodic_state_t *)context;
state->atomic_num = 0;
}
}
-bool periodic_face_loop(movement_event_t event, movement_settings_t *settings, void *context)
+bool periodic_face_loop(movement_event_t event, void *context)
{
periodic_state_t *state = (periodic_state_t *)context;
switch (event.event_type)
watch_start_tick_animation(500);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void periodic_face_resign(movement_settings_t *settings, void *context)
+void periodic_face_resign(void *context)
{
- (void)settings;
(void)context;
// handle any cleanup before your watch face goes off-screen.
uint8_t selection_index;
} periodic_state_t;
-void periodic_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void periodic_face_activate(movement_settings_t *settings, void *context);
-bool periodic_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void periodic_face_resign(movement_settings_t *settings, void *context);
+void periodic_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void periodic_face_activate(void *context);
+bool periodic_face_loop(movement_event_t event, void *context);
+void periodic_face_resign(void *context);
#define periodic_face ((const watch_face_t){ \
periodic_face_setup, \
* This function calculates the start and end of the current phase based on a given geographic location.
* It also calculates the start of the next following phase.
*/
-static void _planetary_solar_phases(movement_settings_t *settings, planetary_hours_state_t *state) {
+static void _planetary_solar_phases(planetary_hours_state_t *state) {
uint8_t phase, h;
double sunrise, sunset;
double hour_duration, next_hour_duration;
* This function calculates the current planetary hour and divides it up into relative minutes and seconds.
* It also calculates the current planetary ruler of the hour and of the day.
*/
-static void _planetary_hours(movement_settings_t *settings, planetary_hours_state_t *state) {
+static void _planetary_hours(planetary_hours_state_t *state) {
char buf[14];
char ruler[3];
uint8_t weekday, planet, planetary_hour;
// when current phase ends calculate the next phase
if ( watch_utility_date_time_to_unix_time(utc_now, 0) >= state->phase_end ) {
- _planetary_solar_phases(settings, state);
+ _planetary_solar_phases(state);
return;
}
// PUBLIC WATCH FACE FUNCTIONS ////////////////////////////////////////////////
-void planetary_hours_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void planetary_hours_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
- (void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(planetary_hours_state_t));
memset(*context_ptr, 0, sizeof(planetary_hours_state_t));
}
}
-void planetary_hours_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void planetary_hours_face_activate(void *context) {
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
#if __EMSCRIPTEN__
#endif
planetary_hours_state_t *state = (planetary_hours_state_t *)context;
- _planetary_solar_phases(settings, state);
+ _planetary_solar_phases(state);
}
-bool planetary_hours_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool planetary_hours_face_loop(movement_event_t event, void *context) {
planetary_hours_state_t *state = (planetary_hours_state_t *)context;
switch (event.event_type) {
// Show your initial UI here.
watch_clear_indicator(WATCH_INDICATOR_PM);
watch_clear_indicator(WATCH_INDICATOR_24H);
- _planetary_hours(settings, state);
+ _planetary_hours(state);
break;
case EVENT_LIGHT_BUTTON_UP:
state->ruler = (state->ruler + 1) % 3;
- _planetary_hours(settings, state);
+ _planetary_hours(state);
break;
case EVENT_LIGHT_LONG_PRESS:
state->skip_to_current = true;
- _planetary_hours(settings, state);
+ _planetary_hours(state);
break;
case EVENT_ALARM_BUTTON_UP:
state->hour++;
- _planetary_hours(settings, state);
+ _planetary_hours(state);
break;
case EVENT_ALARM_LONG_PRESS:
state->hour--;
- _planetary_hours(settings, state);
+ _planetary_hours(state);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void planetary_hours_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void planetary_hours_face_resign(void *context) {
(void) context;
}
sunrise_sunset_state_t sunstate;
} planetary_hours_state_t;
-void planetary_hours_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void planetary_hours_face_activate(movement_settings_t *settings, void *context);
-bool planetary_hours_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void planetary_hours_face_resign(movement_settings_t *settings, void *context);
+void planetary_hours_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void planetary_hours_face_activate(void *context);
+bool planetary_hours_face_loop(movement_event_t event, void *context);
+void planetary_hours_face_resign(void *context);
#define planetary_hours_face ((const watch_face_t){ \
planetary_hours_face_setup, \
/** @details solar phase can be a day phase between sunrise and sunset or an alternating night phase.
* This function calculates the start and end of the current phase based on a given geographic location.
*/
-static void _planetary_solar_phase(movement_settings_t *settings, planetary_time_state_t *state) {
+static void _planetary_solar_phase(planetary_time_state_t *state) {
uint8_t phase;
double sunrise, sunset;
uint32_t now_epoch, sunrise_epoch, sunset_epoch, midnight_epoch;
* This function calculates the current planetary hour and divides it up into relative minutes and seconds.
* It also calculates the current planetary ruler of the hour and of the day.
*/
-static void _planetary_time(movement_event_t event, movement_settings_t *settings, planetary_time_state_t *state) {
+static void _planetary_time(movement_event_t event, planetary_time_state_t *state) {
char buf[14];
char ruler[3];
double night_hour_count = 0.0;
// when current phase ends calculate the next phase
if ( watch_utility_date_time_to_unix_time(state->scratch, 0) >= state->phase_end ) {
- _planetary_solar_phase(settings, state);
+ _planetary_solar_phase(state);
return;
}
// PUBLIC WATCH FACE FUNCTIONS ////////////////////////////////////////////////
-void planetary_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void planetary_time_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
- (void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(planetary_time_state_t));
memset(*context_ptr, 0, sizeof(planetary_time_state_t));
}
}
-void planetary_time_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void planetary_time_face_activate(void *context) {
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
#if __EMSCRIPTEN__
planetary_time_state_t *state = (planetary_time_state_t *)context;
// calculate phase
- _planetary_solar_phase(settings, state);
+ _planetary_solar_phase(state);
}
-bool planetary_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool planetary_time_face_loop(movement_event_t event, void *context) {
planetary_time_state_t *state = (planetary_time_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
- _planetary_time(event, settings, state);
+ _planetary_time(event, state);
if ( state->freq > 1 )
// for hours with shorter seconds let's increase the tick to not skip seconds in the display
movement_request_tick_frequency( 8 );
break;
case EVENT_TICK:
- _planetary_time(event, settings, state);
+ _planetary_time(event, state);
break;
case EVENT_LIGHT_BUTTON_UP:
state->ruler = (state->ruler + 1) % 3;
watch_start_tick_animation(500);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void planetary_time_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void planetary_time_face_resign(void *context) {
(void) context;
movement_request_tick_frequency( 1 );
}
watch_date_time scratch;
} planetary_time_state_t;
-void planetary_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void planetary_time_face_activate(movement_settings_t *settings, void *context);
-bool planetary_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void planetary_time_face_resign(movement_settings_t *settings, void *context);
+void planetary_time_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void planetary_time_face_activate(void *context);
+bool planetary_time_face_loop(movement_event_t event, void *context);
+void planetary_time_face_resign(void *context);
#define planetary_time_face ((const watch_face_t){ \
planetary_time_face_setup, \
// ---------------------------
// Standard watch face methods
// ---------------------------
-void probability_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void probability_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(probability_state_t));
#endif
}
-void probability_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void probability_face_activate(void *context) {
probability_state_t *state = (probability_state_t *)context;
state->dice_sides = DEFAULT_DICE_SIDES;
watch_display_string("PR", 0);
}
-bool probability_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool probability_face_loop(movement_event_t event, void *context) {
probability_state_t *state = (probability_state_t *)context;
if (state->is_rolling && event.event_type != EVENT_TICK) {
watch_display_string("SLEEP ", 4);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void probability_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void probability_face_resign(void *context) {
(void) context;
}
bool is_rolling;
} probability_state_t;
-void probability_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void probability_face_activate(movement_settings_t *settings, void *context);
-bool probability_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void probability_face_resign(movement_settings_t *settings, void *context);
+void probability_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void probability_face_activate(void *context);
+bool probability_face_loop(movement_event_t event, void *context);
+void probability_face_resign(void *context);
#define probability_face ((const watch_face_t){ \
probability_face_setup, \
pulsometer_display_calibration(pulsometer);
}
-void pulsometer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void pulsometer_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void pulsometer_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void pulsometer_face_activate(void *context) {
pulsometer_state_t *pulsometer = context;
pulsometer_display_measurement(pulsometer);
}
-bool pulsometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool pulsometer_face_loop(movement_event_t event, void *context) {
pulsometer_state_t *pulsometer = (pulsometer_state_t *) context;
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void pulsometer_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void pulsometer_face_resign(void *context) {
(void) context;
}
#include "movement.h"
-void pulsometer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void pulsometer_face_activate(movement_settings_t *settings, void *context);
-bool pulsometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void pulsometer_face_resign(movement_settings_t *settings, void *context);
+void pulsometer_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void pulsometer_face_activate(void *context);
+bool pulsometer_face_loop(movement_event_t event, void *context);
+void pulsometer_face_resign(void *context);
#define pulsometer_face ((const watch_face_t){ \
pulsometer_face_setup, \
// MOVEMENT WATCH FACE FUNCTIONS //////////////////////////////////////////////
-void randonaut_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void randonaut_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(randonaut_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void randonaut_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void randonaut_face_activate(void *context) {
randonaut_state_t *state = (randonaut_state_t *)context;
_get_location_from_file(state);
state->face.mode = 0;
// Handle any tasks related to your watch face coming on screen.
}
-bool randonaut_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool randonaut_face_loop(movement_event_t event, void *context) {
randonaut_state_t *state = (randonaut_state_t *)context;
switch (event.event_type) {
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
// You can override any of these behaviors by adding a case for these events to this switch statement.
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
_randonaut_face_display(state);
return true;
}
-void randonaut_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void randonaut_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
char scratchpad[10];
} randonaut_state_t;
-void randonaut_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void randonaut_face_activate(movement_settings_t *settings, void *context);
-bool randonaut_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void randonaut_face_resign(movement_settings_t *settings, void *context);
+void randonaut_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void randonaut_face_activate(void *context);
+bool randonaut_face_loop(movement_event_t event, void *context);
+void randonaut_face_resign(void *context);
#define randonaut_face ((const watch_face_t){ \
randonaut_face_setup, \
#define RATEMETER_FACE_FREQUENCY_FACTOR (4ul) // refresh rate will be 2 to this power Hz (0 for 1 Hz, 2 for 4 Hz, etc.)
#define RATEMETER_FACE_FREQUENCY (1 << RATEMETER_FACE_FREQUENCY_FACTOR)
-void ratemeter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void ratemeter_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(ratemeter_state_t));
}
-void ratemeter_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void ratemeter_face_activate(void *context) {
memset(context, 0, sizeof(ratemeter_state_t));
}
-bool ratemeter_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool ratemeter_face_loop(movement_event_t event, void *context) {
ratemeter_state_t *ratemeter_state = (ratemeter_state_t *)context;
char buf[14];
switch (event.event_type) {
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void ratemeter_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void ratemeter_face_resign(void *context) {
(void) context;
}
int16_t ticks;
} ratemeter_state_t;
-void ratemeter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void ratemeter_face_activate(movement_settings_t *settings, void *context);
-bool ratemeter_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void ratemeter_face_resign(movement_settings_t *settings, void *context);
+void ratemeter_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void ratemeter_face_activate(void *context);
+bool ratemeter_face_loop(movement_event_t event, void *context);
+void ratemeter_face_resign(void *context);
#define ratemeter_face ((const watch_face_t){ \
ratemeter_face_setup, \
static void show_fn(calculator_state_t *state, uint8_t subsecond);
-void rpn_calculator_alt_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void rpn_calculator_alt_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
#define PUSH(x) (s->stack[++s->stack_size - 1] = x)
#define POP() (s->stack[s->stack_size-- - 1])
-void rpn_calculator_alt_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void rpn_calculator_alt_face_activate(void *context) {
calculator_state_t *s = (calculator_state_t *)context;
s->min = s->max = NAN;
}
}
}
-bool rpn_calculator_alt_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool rpn_calculator_alt_face_loop(movement_event_t event, void *context) {
calculator_state_t *s = (calculator_state_t *)context;
- (void) settings;
int proposed_stack_size;
case EVENT_LOW_ENERGY_UPDATE:
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void rpn_calculator_alt_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void rpn_calculator_alt_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
enum calculator_mode mode;
} calculator_state_t;
-void rpn_calculator_alt_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void rpn_calculator_alt_face_activate(movement_settings_t *settings, void *context);
-bool rpn_calculator_alt_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void rpn_calculator_alt_face_resign(movement_settings_t *settings, void *context);
+void rpn_calculator_alt_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void rpn_calculator_alt_face_activate(void *context);
+bool rpn_calculator_alt_face_loop(movement_event_t event, void *context);
+void rpn_calculator_alt_face_resign(void *context);
#define rpn_calculator_alt_face ((const watch_face_t){ \
rpn_calculator_alt_face_setup, \
watch_display_string(buf, 0);
}
-void rpn_calculator_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void rpn_calculator_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(rpn_calculator_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void rpn_calculator_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void rpn_calculator_face_activate(void *context) {
(void) context;
// Handle any tasks related to your watch face coming on screen.
}
-bool rpn_calculator_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool rpn_calculator_face_loop(movement_event_t event, void *context) {
rpn_calculator_state_t *state = (rpn_calculator_state_t *)context;
case EVENT_LOW_ENERGY_UPDATE:
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void rpn_calculator_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void rpn_calculator_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
uint8_t selection;
} rpn_calculator_state_t;
-void rpn_calculator_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void rpn_calculator_face_activate(movement_settings_t *settings, void *context);
-bool rpn_calculator_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void rpn_calculator_face_resign(movement_settings_t *settings, void *context);
+void rpn_calculator_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void rpn_calculator_face_activate(void *context);
+bool rpn_calculator_face_loop(movement_event_t event, void *context);
+void rpn_calculator_face_resign(void *context);
#define rpn_calculator_face ((const watch_face_t){ \
rpn_calculator_face_setup, \
#define sl_SELECTIONS 6
#define DEFAULT_MINUTES { 5,4,1,0,0,0 }
-static inline int32_t get_tz_offset(movement_settings_t *settings) {
+static inline int32_t get_tz_offset() {
return movement_get_current_timezone_offset();
}
watch_set_indicator(WATCH_INDICATOR_LAP);
}
-static void draw(sailing_state_t *state, uint8_t subsecond, movement_settings_t *settings) {
- (void) settings;
+static void draw(sailing_state_t *state, uint8_t subsecond) {
char tmp[24];
char buf[16];
watch_display_string(buf, 0);
}
-static void ring(sailing_state_t *state, movement_settings_t *settings) {
+static void ring(sailing_state_t *state) {
// if ring is called in background (while on another face), a button press can interrupt and cancel the execution.
// To reduce the probability of cancelling all future alarms, the new alarm is set as soon as possible after calling ring.
movement_cancel_background_task();
beepflag++;
}
-static void start(sailing_state_t *state, movement_settings_t *settings) {//gets called by starting / switching to next signal
+static void start(sailing_state_t *state) {//gets called by starting / switching to next signal
while (beepseconds[beepflag] < state->minutes[state->index]*60) {
state->index++;
}
return;
}
-void sailing_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void sailing_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void sailing_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void sailing_face_activate(void *context) {
sailing_state_t *state = (sailing_state_t *)context;
if(state->mode == sl_running) {
watch_date_time now = watch_rtc_get_date_time();
}
-bool sailing_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool sailing_face_loop(movement_event_t event, void *context) {
sailing_state_t *state = (sailing_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void sailing_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void sailing_face_resign(void *context) {
sailing_state_t *state = (sailing_state_t *)context;
if (state->mode == sl_setting) {
state->selection = 0;
} sailing_state_t;
-void sailing_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void sailing_face_activate(movement_settings_t *settings, void *context);
-bool sailing_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void sailing_face_resign(movement_settings_t *settings, void *context);
+void sailing_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void sailing_face_activate(void *context);
+bool sailing_face_loop(movement_event_t event, void *context);
+void sailing_face_resign(void *context);
#define sailing_face ((const watch_face_t){ \
sailing_face_setup, \
watch_display_string(buf, 3);
}
-void ships_bell_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr) {
- (void) settings;
+void ships_bell_face_setup(uint8_t watch_face_index, void **context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void ships_bell_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void ships_bell_face_activate(void *context) {
ships_bell_state_t *state = (ships_bell_state_t *) context;
if (state->bell_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
watch_set_colon();
}
-bool ships_bell_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool ships_bell_face_loop(movement_event_t event, void *context) {
ships_bell_state_t *state = (ships_bell_state_t *) context;
}
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void ships_bell_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void ships_bell_face_resign(void *context) {
(void) context;
}
-bool ships_bell_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool ships_bell_face_wants_background_task(void *context) {
ships_bell_state_t *state = (ships_bell_state_t *) context;
if (!state->bell_enabled) return false;
uint8_t on_watch;
} ships_bell_state_t;
-void ships_bell_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void ships_bell_face_activate(movement_settings_t *settings, void *context);
-bool ships_bell_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void ships_bell_face_resign(movement_settings_t *settings, void *context);
-bool ships_bell_face_wants_background_task(movement_settings_t *settings, void *context);
+void ships_bell_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void ships_bell_face_activate(void *context);
+bool ships_bell_face_loop(movement_event_t event, void *context);
+void ships_bell_face_resign(void *context);
+bool ships_bell_face_wants_background_task(void *context);
#define ships_bell_face ((const watch_face_t){ \
ships_bell_face_setup, \
}
}
-void simon_face_setup(movement_settings_t *settings, uint8_t watch_face_index,
+void simon_face_setup(uint8_t watch_face_index,
void **context_ptr) {
- (void)settings;
(void)watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(simon_state_t));
#endif
}
-void simon_face_activate(movement_settings_t *settings, void *context) {
+void simon_face_activate(void *context) {
(void) settings;
(void) context;
simon_state_t *state = (simon_state_t *)context;
_timer = 0;
}
-bool simon_face_loop(movement_event_t event, movement_settings_t *settings,
+bool simon_face_loop(movement_event_t event,
void *context) {
simon_state_t *state = (simon_state_t *)context;
case EVENT_LOW_ENERGY_UPDATE:
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void simon_face_resign(movement_settings_t *settings, void *context) {
- (void)settings;
+void simon_face_resign(void *context) {
(void)context;
watch_set_led_off();
watch_set_buzzer_off();
SimonPlayingState playing_state;
} simon_state_t;
-void simon_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr);
-void simon_face_activate(movement_settings_t *settings, void *context);
-bool simon_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void simon_face_resign(movement_settings_t *settings, void *context);
+void simon_face_setup(uint8_t watch_face_index, void **context_ptr);
+void simon_face_activate(void *context);
+bool simon_face_loop(movement_event_t event, void *context);
+void simon_face_resign(void *context);
#define simon_face \
((const watch_face_t){ \
#include <math.h>
#include "simple_calculator_face.h"
-void simple_calculator_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void simple_calculator_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(simple_calculator_state_t));
number->thousands = 0;
}
-void simple_calculator_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void simple_calculator_face_activate(void *context) {
simple_calculator_state_t *state = (simple_calculator_state_t *)context;
state->placeholder = PLACEHOLDER_ONES;
state->mode = MODE_ENTERING_FIRST_NUM;
state->placeholder = PLACEHOLDER_ONES;
}
-bool simple_calculator_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool simple_calculator_face_loop(movement_event_t event, void *context) {
simple_calculator_state_t *state = (simple_calculator_state_t *)context;
char display_string[10];
char temp_display_string[10]; // Temporary buffer for blinking effect
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void simple_calculator_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void simple_calculator_face_resign(void *context) {
(void) context;
movement_request_tick_frequency(1);
}
calculator_placeholder_t placeholder;
} simple_calculator_state_t;
-void simple_calculator_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void simple_calculator_face_activate(movement_settings_t *settings, void *context);
-bool simple_calculator_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void simple_calculator_face_resign(movement_settings_t *settings, void *context);
+void simple_calculator_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void simple_calculator_face_activate(void *context);
+bool simple_calculator_face_loop(movement_event_t event, void *context);
+void simple_calculator_face_resign(void *context);
#define simple_calculator_face ((const watch_face_t){ \
simple_calculator_face_setup, \
#define SIMPLE_COIN_FLIP_REQUIRE_LONG_PRESS_FOR_REFLIP true
-void simple_coin_flip_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void simple_coin_flip_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(simple_coin_flip_state_t));
}
}
-void simple_coin_flip_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void simple_coin_flip_face_activate(void *context) {
(void) context;
}
watch_set_pixel(2, 4);
}
-bool simple_coin_flip_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool simple_coin_flip_face_loop(movement_event_t event, void *context) {
simple_coin_flip_state_t *state = (simple_coin_flip_state_t *)context;
switch (event.event_type) {
movement_move_to_face(0);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void simple_coin_flip_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void simple_coin_flip_face_resign(void *context) {
(void) context;
}
uint8_t animation_frame;
} simple_coin_flip_state_t;
-void simple_coin_flip_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void simple_coin_flip_face_activate(movement_settings_t *settings, void *context);
-bool simple_coin_flip_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void simple_coin_flip_face_resign(movement_settings_t *settings, void *context);
+void simple_coin_flip_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void simple_coin_flip_face_activate(void *context);
+bool simple_coin_flip_face_loop(movement_event_t event, void *context);
+void simple_coin_flip_face_resign(void *context);
#define simple_coin_flip_face ((const watch_face_t){ \
simple_coin_flip_face_setup, \
memset(state->moveable_dests, 0xff, sizeof(state->moveable_dests));
}
-void smallchess_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void smallchess_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(smallchess_face_state_t));
}
}
-void smallchess_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void smallchess_face_activate(void *context) {
(void) context;
}
}
}
-bool smallchess_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool smallchess_face_loop(movement_event_t event, void *context) {
smallchess_face_state_t *state = (smallchess_face_state_t *)context;
switch (event.event_type) {
case EVENT_LIGHT_BUTTON_DOWN:
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void smallchess_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void smallchess_face_resign(void *context) {
(void) context;
watch_set_led_off();
}
uint8_t ai_from_square, ai_to_square;
} smallchess_face_state_t;
-void smallchess_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void smallchess_face_activate(movement_settings_t *settings, void *context);
-bool smallchess_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void smallchess_face_resign(movement_settings_t *settings, void *context);
+void smallchess_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void smallchess_face_activate(void *context);
+bool smallchess_face_loop(movement_event_t event, void *context);
+void smallchess_face_resign(void *context);
#define smallchess_face ((const watch_face_t){ \
smallchess_face_setup, \
return result;
}
-static void calculate_datetimes(solstice_state_t *state, movement_settings_t *settings) {
+static void calculate_datetimes(solstice_state_t *state) {
for (int i = 0; i < 4; i++) {
// TODO: handle DST changes
state->datetimes[i] = jde_to_date_time(calculate_solstice_equinox(2020 + state->year, i) + (movement_get_current_timezone_offset() / (3600.0*24.0)));
}
}
-void solstice_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void solstice_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(solstice_state_t));
}
}
-void solstice_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void solstice_face_activate(void *context) {
(void) context;
}
watch_display_string(buf, 0);
}
-static void show_date_time(movement_settings_t *settings, solstice_state_t *state) {
+static void show_date_time(solstice_state_t *state) {
char buf[11];
watch_date_time date_time = state->datetimes[state->index];
if (!movement_clock_mode_24h()) {
watch_display_string(buf, 0);
}
-bool solstice_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool solstice_face_loop(movement_event_t event, void *context) {
solstice_state_t *state = (solstice_state_t *)context;
switch (event.event_type) {
case EVENT_ALARM_LONG_PRESS:
- show_date_time(settings, state);
+ show_date_time(state);
break;
case EVENT_LIGHT_BUTTON_UP:
if (state->index == 0) {
movement_move_to_face(0);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void solstice_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void solstice_face_resign(void *context) {
(void) context;
}
uint8_t index;
} solstice_state_t;
-void solstice_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void solstice_face_activate(movement_settings_t *settings, void *context);
-bool solstice_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void solstice_face_resign(movement_settings_t *settings, void *context);
+void solstice_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void solstice_face_activate(void *context);
+bool solstice_face_loop(movement_event_t event, void *context);
+void solstice_face_resign(void *context);
#define solstice_face ((const watch_face_t){ \
solstice_face_setup, \
#endif
-static inline void _button_beep(movement_settings_t *settings) {
+static inline void _button_beep() {
// play a beep as confirmation for a button press (if applicable)
if (movement_button_should_sound()) watch_buzzer_play_note(BUZZER_NOTE_C7, 50);
}
_colon = true;
}
-void stock_stopwatch_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void stock_stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(stock_stopwatch_state_t));
}
}
-void stock_stopwatch_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void stock_stopwatch_face_activate(void *context) {
(void) context;
if (_is_running) {
// The background task will keep the watch from entering low energy mode while the stopwatch is on screen.
}
}
-bool stock_stopwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool stock_stopwatch_face_loop(movement_event_t event, void *context) {
stock_stopwatch_state_t *state = (stock_stopwatch_state_t *)context;
// handle overflow of fast ticks
_draw();
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void stock_stopwatch_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void stock_stopwatch_face_resign(void *context) {
(void) context;
// cancel the keepalive task
movement_cancel_background_task();
bool light_on_button; // determines whether the light button actually triggers the led
} stock_stopwatch_state_t;
-void stock_stopwatch_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void stock_stopwatch_face_activate(movement_settings_t *settings, void *context);
-bool stock_stopwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void stock_stopwatch_face_resign(movement_settings_t *settings, void *context);
+void stock_stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void stock_stopwatch_face_activate(void *context);
+bool stock_stopwatch_face_loop(movement_event_t event, void *context);
+void stock_stopwatch_face_resign(void *context);
#if __EMSCRIPTEN__
void em_cb_handler(void *userData);
.unit = {0, 0, 0, 1, 1, 63}
};
-void stopwatch_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(stopwatch_state_t));
}
}
-void stopwatch_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void stopwatch_face_activate(void *context) {
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
stopwatch_state_t *stopwatch_state = (stopwatch_state_t *)context;
}
}
-bool stopwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool stopwatch_face_loop(movement_event_t event, void *context) {
stopwatch_state_t *stopwatch_state = (stopwatch_state_t *)context;
switch (event.event_type) {
}
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void stopwatch_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void stopwatch_face_resign(void *context) {
(void) context;
// regardless of whether we're running or stopped, cancel the task
uint32_t seconds_counted; // set this value when paused, and show that instead.
} stopwatch_state_t;
-void stopwatch_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void stopwatch_face_activate(movement_settings_t *settings, void *context);
-bool stopwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void stopwatch_face_resign(movement_settings_t *settings, void *context);
+void stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void stopwatch_face_activate(void *context);
+bool stopwatch_face_loop(movement_event_t event, void *context);
+void stopwatch_face_resign(void *context);
#define stopwatch_face ((const watch_face_t){ \
stopwatch_face_setup, \
state->rise_set_expires = watch_utility_date_time_from_unix_time(timestamp + 60, 0);
}
-static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_sunset_state_t *state) {
+static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
char buf[14];
double rise, set, minutes, seconds;
bool show_next_match = false;
}
}
-void sunrise_sunset_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void sunrise_sunset_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(sunrise_sunset_state_t));
}
}
-void sunrise_sunset_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void sunrise_sunset_face_activate(void *context) {
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
#if __EMSCRIPTEN__
state->working_longitude = _sunrise_sunset_face_struct_from_latlon(movement_location.bit.longitude);
}
-bool sunrise_sunset_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool sunrise_sunset_face_loop(movement_event_t event, void *context) {
sunrise_sunset_state_t *state = (sunrise_sunset_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
break;
case EVENT_LOW_ENERGY_UPDATE:
case EVENT_TICK:
if (date_time.reg >= state->rise_set_expires.reg) {
// and on the off chance that this happened before EVENT_TIMEOUT snapped us back to rise/set 0, go back now
state->rise_index = 0;
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
}
} else {
_sunrise_sunset_face_update_settings_display(event, state);
}
if (state->page == 0) {
movement_request_tick_frequency(1);
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
}
break;
case EVENT_LIGHT_LONG_PRESS:
case EVENT_LIGHT_BUTTON_UP:
if (state->page == 0 && _location_count > 1) {
state->longLatToUse = (state->longLatToUse + 1) % _location_count;
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
}
break;
case EVENT_ALARM_BUTTON_UP:
_sunrise_sunset_face_update_settings_display(event, context);
} else {
state->rise_index = (state->rise_index + 1) % 2;
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
}
break;
case EVENT_ALARM_LONG_PRESS:
if (state->page == 0) {
if (state->longLatToUse != 0) {
state->longLatToUse = 0;
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
break;
}
state->page++;
state->active_digit = 0;
state->page = 0;
_sunrise_sunset_face_update_location_register(state);
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
}
break;
case EVENT_TIMEOUT:
state->page = 0;
state->rise_index = 0;
movement_request_tick_frequency(1);
- _sunrise_sunset_face_update(settings, state);
+ _sunrise_sunset_face_update(state);
}
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void sunrise_sunset_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void sunrise_sunset_face_resign(void *context) {
sunrise_sunset_state_t *state = (sunrise_sunset_state_t *)context;
state->page = 0;
state->active_digit = 0;
uint8_t longLatToUse;
} sunrise_sunset_state_t;
-void sunrise_sunset_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void sunrise_sunset_face_activate(movement_settings_t *settings, void *context);
-bool sunrise_sunset_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void sunrise_sunset_face_resign(movement_settings_t *settings, void *context);
+void sunrise_sunset_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void sunrise_sunset_face_activate(void *context);
+bool sunrise_sunset_face_loop(movement_event_t event, void *context);
+void sunrise_sunset_face_resign(void *context);
#define sunrise_sunset_face ((const watch_face_t){ \
sunrise_sunset_face_setup, \
return retval;
}
-void tachymeter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void)settings;
+void tachymeter_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void)watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(tachymeter_state_t));
}
}
-void tachymeter_face_activate(movement_settings_t *settings, void *context) {
- (void)settings;
+void tachymeter_face_activate(void *context) {
(void)context;
movement_request_tick_frequency(4); // 4Hz
}
}
}
-bool tachymeter_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void)settings;
+bool tachymeter_face_loop(movement_event_t event, void *context) {
tachymeter_state_t *state = (tachymeter_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
// return true if the watch can enter standby mode. If you are PWM'ing an LED or buzzing the buzzer here,
return true;
}
-void tachymeter_face_resign(movement_settings_t *settings, void *context) {
- (void)settings;
+void tachymeter_face_resign(void *context) {
(void)context;
// handle any cleanup before your watch face goes off-screen.
}
uint32_t total_speed; // 3600 * 100 * distance / total_time
} tachymeter_state_t;
-void tachymeter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void tachymeter_face_activate(movement_settings_t *settings, void *context);
-bool tachymeter_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void tachymeter_face_resign(movement_settings_t *settings, void *context);
+void tachymeter_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void tachymeter_face_activate(void *context);
+bool tachymeter_face_loop(movement_event_t event, void *context);
+void tachymeter_face_resign(void *context);
#define tachymeter_face ((const watch_face_t){ \
tachymeter_face_setup, \
#define TALLY_FACE_PRESETS_SIZE() (sizeof(_tally_default) / sizeof(int16_t))
-void tally_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void tally_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(tally_state_t));
}
}
-void tally_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void tally_face_activate(void *context) {
(void) context;
_quick_ticks_running = false;
}
return state->tally_idx == _tally_default[state->tally_default_idx];
}
-bool tally_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool tally_face_loop(movement_event_t event, void *context) {
tally_state_t *state = (tally_state_t *)context;
static bool using_led = false;
// ignore timeout
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
watch_display_string(buf, 0);
}
-void tally_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void tally_face_resign(void *context) {
(void) context;
}
//#define TALLY_FACE_PRESETS_YUGIOH
-void tally_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void tally_face_activate(movement_settings_t *settings, void *context);
-bool tally_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void tally_face_resign(movement_settings_t *settings, void *context);
+void tally_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void tally_face_activate(void *context);
+bool tally_face_loop(movement_event_t event, void *context);
+void tally_face_resign(void *context);
void print_tally(tally_state_t *state, bool sound_on);
// ---------------------------
// Standard watch face methods
// ---------------------------
-void tarot_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void tarot_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(tarot_state_t));
#endif
}
-void tarot_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void tarot_face_activate(void *context) {
tarot_state_t *state = (tarot_state_t *)context;
watch_display_string("TA", 0);
state->major_arcana_only = true;
}
-bool tarot_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool tarot_face_loop(movement_event_t event, void *context) {
tarot_state_t *state = (tarot_state_t *)context;
if (state->is_picking && event.event_type != EVENT_TICK) {
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void tarot_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void tarot_face_resign(void *context) {
(void) context;
}
bool is_picking;
} tarot_state_t;
-void tarot_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void tarot_face_activate(movement_settings_t *settings, void *context);
-bool tarot_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void tarot_face_resign(movement_settings_t *settings, void *context);
+void tarot_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void tarot_face_activate(void *context);
+bool tarot_face_loop(movement_event_t event, void *context);
+void tarot_face_resign(void *context);
#define tarot_face ((const watch_face_t){ \
tarot_face_setup, \
filesystem_write_file("tempchart.ini", (char*)&tempchart_state, sizeof(tempchart_state));
}
-void tempchart_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void tempchart_face_setup(uint8_t watch_face_index, void ** context_ptr) {
// These next two lines just silence the compiler warnings associated with unused parameters.
// We have no use for the settings or the watch_face_index, so we make that explicit here.
- (void) settings;
(void) context_ptr;
(void) watch_face_index;
// At boot, context_ptr will be NULL indicating that we don't have anyplace to store our context.
}
-void tempchart_face_activate(movement_settings_t *settings, void *context) {
+void tempchart_face_activate(void *context) {
// same as above: silence the warning, we don't need to check the settings.
- (void) settings;
(void) context;
}
watch_display_string(buf, 0);
}
-bool tempchart_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool tempchart_face_loop(movement_event_t event, void *context) {
(void) context;
switch (event.event_type) {
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void tempchart_face_resign(movement_settings_t *settings, void *context) {
+void tempchart_face_resign(void *context) {
// our watch face, like most watch faces, has nothing special to do when resigning.
// watch faces that enable a peripheral or interact with a sensor may want to turn it off here.
- (void) settings;
(void) context;
}
//background freq correction
-bool tempchart_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool tempchart_face_wants_background_task(void *context) {
(void) context;
watch_date_time date_time = watch_rtc_get_date_time();
#include "movement.h"
-void tempchart_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void tempchart_face_activate(movement_settings_t *settings, void *context);
-bool tempchart_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void tempchart_face_resign(movement_settings_t *settings, void *context);
-bool tempchart_face_wants_background_task(movement_settings_t *settings, void *context);
+void tempchart_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void tempchart_face_activate(void *context);
+bool tempchart_face_loop(movement_event_t event, void *context);
+void tempchart_face_resign(void *context);
+bool tempchart_face_wants_background_task(void *context);
#define tempchart_face ((const watch_face_t){ \
}
}
-void time_left_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void time_left_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(time_left_state_t));
}
}
-void time_left_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void time_left_face_activate(void *context) {
time_left_state_t *state = (time_left_state_t *)context;
// stash the current year, useful in birthday setting mode
state->birth_date_when_activated.reg = state->birth_date.reg;
}
-bool time_left_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool time_left_face_loop(movement_event_t event, void *context) {
time_left_state_t *state = (time_left_state_t *)context;
switch (event.event_type) {
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void time_left_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void time_left_face_resign(void *context) {
time_left_state_t *state = (time_left_state_t *)context;
if (state->current_page >= TIME_LEFT_FACE_SETTINGS_STATE) _resume_setting(state);
movement_birthdate_t target_date;
} time_left_state_t;
-void time_left_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void time_left_face_activate(movement_settings_t *settings, void *context);
-bool time_left_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void time_left_face_resign(movement_settings_t *settings, void *context);
+void time_left_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void time_left_face_activate(void *context);
+bool time_left_face_loop(movement_event_t event, void *context);
+void time_left_face_resign(void *context);
#define time_left_face ((const watch_face_t){ \
time_left_face_setup, \
static uint8_t _beeps_to_play; // temporary counter for ring signals playing
-static inline int32_t _get_tz_offset(movement_settings_t *settings) {
- return movement_get_current_timezone_offset();
-}
-
static void _signal_callback() {
if (_beeps_to_play) {
_beeps_to_play--;
}
}
-static void _start(timer_state_t *state, movement_settings_t *settings, bool with_beep) {
+static void _start(timer_state_t *state, bool with_beep) {
if (state->timers[state->current_timer].value == 0) return;
watch_date_time now = watch_rtc_get_date_time();
- state->now_ts = watch_utility_date_time_to_unix_time(now, _get_tz_offset(settings));
+ state->now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
if (state->mode == pausing)
state->target_ts = state->now_ts + state->paused_left;
else
state->timers[state->current_timer].unit.hours,
state->timers[state->current_timer].unit.minutes,
state->timers[state->current_timer].unit.seconds);
- watch_date_time target_dt = watch_utility_date_time_from_unix_time(state->target_ts, _get_tz_offset(settings));
+ watch_date_time target_dt = watch_utility_date_time_from_unix_time(state->target_ts, movement_get_current_timezone_offset());
state->mode = running;
movement_schedule_background_task_for_face(state->watch_face_index, target_dt);
watch_set_indicator(WATCH_INDICATOR_BELL);
return false;
}
-void timer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void timer_face_setup(uint8_t watch_face_index, void ** context_ptr) {
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(timer_state_t));
}
}
-void timer_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void timer_face_activate(void *context) {
timer_state_t *state = (timer_state_t *)context;
watch_display_string("TR", 0);
watch_set_colon();
if(state->mode == running) {
watch_date_time now = watch_rtc_get_date_time();
- state->now_ts = watch_utility_date_time_to_unix_time(now, _get_tz_offset(settings));
+ state->now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
watch_set_indicator(WATCH_INDICATOR_BELL);
} else {
state->pausing_seconds = 1;
}
}
-bool timer_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool timer_face_loop(movement_event_t event, void *context) {
timer_state_t *state = (timer_state_t *)context;
uint8_t subsecond = event.subsecond;
movement_cancel_background_task();
break;
case pausing:
- _start(state, settings, false);
+ _start(statemovement_get_current_timezone_offset(), false);
break;
case waiting: {
uint8_t last_timer = state->current_timer;
state->current_timer = (state->current_timer + 1) % TIMER_SLOTS;
_set_next_valid_timer(state);
// start the time immediately if there is only one valid timer slot
- if (last_timer == state->current_timer) _start(state, settings, true);
+ if (last_timer == state->current_timer) _start(statemovement_get_current_timezone_offset(), true);
break;
}
case setting:
_beeps_to_play = 4;
watch_buzzer_play_sequence((int8_t *)_sound_seq_beep, _signal_callback);
_reset(state);
- if (state->timers[state->current_timer].unit.repeat) _start(state, settings, false);
+ if (state->timers[state->current_timer].unit.repeat) _start(statemovement_get_current_timezone_offset(), false);
break;
case EVENT_ALARM_LONG_PRESS:
switch(state->mode) {
}
break;
case waiting:
- _start(state, settings, true);
+ _start(statemovement_get_current_timezone_offset(), true);
break;
case pausing:
case running:
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void timer_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void timer_face_resign(void *context) {
timer_state_t *state = (timer_state_t *)context;
if (state->mode == setting) {
state->settings_state = 0;
bool quick_cycle : 1;
} timer_state_t;
-void timer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void timer_face_activate(movement_settings_t *settings, void *context);
-bool timer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void timer_face_resign(movement_settings_t *settings, void *context);
+void timer_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void timer_face_activate(void *context);
+bool timer_face_loop(movement_event_t event, void *context);
+void timer_face_resign(void *context);
#define timer_face ((const watch_face_t){ \
timer_face_setup, \
static uint8_t focus_min = 25;
static uint8_t break_min = 5;
-static inline int32_t get_tz_offset(movement_settings_t *settings) {
- return movement_get_current_timezone_offset();
-}
-
static uint8_t get_length(tomato_state_t *state) {
uint8_t length;
if (state->kind == tomato_focus) {
return length;
}
-static void tomato_start(tomato_state_t *state, movement_settings_t *settings) {
+static void tomato_start(tomato_state_t *state) {
watch_date_time now = watch_rtc_get_date_time();
int8_t length = (int8_t) get_length(state);
state->mode = tomato_run;
- state->now_ts = watch_utility_date_time_to_unix_time(now, get_tz_offset(settings));
+ state->now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
state->target_ts = watch_utility_offset_timestamp(state->now_ts, 0, length, 0);
- watch_date_time target_dt = watch_utility_date_time_from_unix_time(state->target_ts, get_tz_offset(settings));
+ watch_date_time target_dt = watch_utility_date_time_from_unix_time(state->target_ts, movement_get_current_timezone_offset());
movement_schedule_background_task(target_dt);
watch_set_indicator(WATCH_INDICATOR_BELL);
}
}
}
-void tomato_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void tomato_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void tomato_face_activate(movement_settings_t *settings, void *context) {
+void tomato_face_activate(void *context) {
tomato_state_t *state = (tomato_state_t *)context;
if (state->mode == tomato_run) {
watch_date_time now = watch_rtc_get_date_time();
- state->now_ts = watch_utility_date_time_to_unix_time(now, get_tz_offset(settings));
+ state->now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
watch_set_indicator(WATCH_INDICATOR_BELL);
}
watch_set_colon();
state->visible = true;
}
-bool tomato_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool tomato_face_loop(movement_event_t event, void *context) {
tomato_state_t *state = (tomato_state_t *)context;
switch (event.event_type) {
tomato_reset(state);
break;
case tomato_ready:
- tomato_start(state, settings);
+ tomato_start(state);
break;
}
tomato_draw(state);
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void tomato_face_resign(movement_settings_t *settings, void *context) {
+void tomato_face_resign(void *context) {
tomato_state_t *state = (tomato_state_t *)context;
state->visible = false;
- (void) settings;
(void) context;
}
bool visible;
} tomato_state_t;
-void tomato_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void tomato_face_activate(movement_settings_t *settings, void *context);
-bool tomato_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void tomato_face_resign(movement_settings_t *settings, void *context);
+void tomato_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void tomato_face_activate(void *context);
+bool tomato_face_loop(movement_event_t event, void *context);
+void tomato_face_resign(void *context);
#define tomato_face ((const watch_face_t){ \
tomato_face_setup, \
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
-void toss_up_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void toss_up_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
- (void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(toss_up_state_t));
memset(*context_ptr, 0, sizeof(toss_up_state_t));
}
}
-void toss_up_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void toss_up_face_activate(void *context) {
(void) context;
}
-bool toss_up_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool toss_up_face_loop(movement_event_t event, void *context) {
toss_up_state_t *state = (toss_up_state_t *)context;
uint8_t i = 0;
switch (event.event_type) {
_toss_up_face_display(state);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void toss_up_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void toss_up_face_resign(void *context) {
(void) context;
}
uint32_t get_true_entropy(void);
uint8_t divine_bit(void);
uint8_t roll_dice(uint8_t sides);
-void toss_up_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void toss_up_face_activate(movement_settings_t *settings, void *context);
-bool toss_up_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void toss_up_face_resign(movement_settings_t *settings, void *context);
+void toss_up_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void toss_up_face_activate(void *context);
+bool toss_up_face_loop(movement_event_t event, void *context);
+void toss_up_face_resign(void *context);
#define toss_up_face ((const watch_face_t){ \
toss_up_face_setup, \
totp_display(totp_state);
}
-static inline uint32_t totp_compute_base_timestamp(movement_settings_t *settings) {
+static inline uint32_t totp_compute_base_timestamp() {
return watch_utility_date_time_to_unix_time(watch_rtc_get_date_time(), movement_get_current_timezone_offset());
}
-void totp_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void totp_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
totp_validate_key_lengths();
}
}
-void totp_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void totp_face_activate(void *context) {
totp_state_t *totp = (totp_state_t *) context;
- totp->timestamp = totp_compute_base_timestamp(settings);
+ totp->timestamp = totp_compute_base_timestamp();
totp->steps = 0;
totp->current_code = 0;
totp->current_index = 0;
totp_generate_and_display(totp);
}
-bool totp_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool totp_face_loop(movement_event_t event, void *context) {
totp_state_t *totp_state = (totp_state_t *) context;
movement_illuminate_led();
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void totp_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void totp_face_resign(void *context) {
(void) context;
}
size_t current_decoded_key_length;
} totp_state_t;
-void totp_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void totp_face_activate(movement_settings_t *settings, void *context);
-bool totp_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void totp_face_resign(movement_settings_t *settings, void *context);
+void totp_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void totp_face_activate(void *context);
+bool totp_face_loop(movement_event_t event, void *context);
+void totp_face_resign(void *context);
#define totp_face ((const watch_face_t){ \
totp_face_setup, \
}
}
-void totp_face_lfs_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void totp_face_lfs_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(totp_lfs_state_t));
totp_state->steps = totp_state->timestamp / record->period;
}
-void totp_face_lfs_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void totp_face_lfs_activate(void *context) {
memset(context, 0, sizeof(totp_lfs_state_t));
totp_lfs_state_t *totp_state = (totp_lfs_state_t *)context;
watch_display_string(buf, 0);
}
-bool totp_face_lfs_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool totp_face_lfs_loop(movement_event_t event, void *context) {
totp_lfs_state_t *totp_state = (totp_lfs_state_t *)context;
movement_illuminate_led();
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void totp_face_lfs_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void totp_face_lfs_resign(void *context) {
(void) context;
}
uint8_t current_index;
} totp_lfs_state_t;
-void totp_face_lfs_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void totp_face_lfs_activate(movement_settings_t *settings, void *context);
-bool totp_face_lfs_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void totp_face_lfs_resign(movement_settings_t *settings, void *context);
+void totp_face_lfs_setup(uint8_t watch_face_index, void ** context_ptr);
+void totp_face_lfs_activate(void *context);
+bool totp_face_lfs_loop(movement_event_t event, void *context);
+void totp_face_lfs_resign(void *context);
#define totp_face_lfs ((const watch_face_t){ \
totp_face_lfs_setup, \
watch_display_string(notes[state->note_ind].name, 8);
}
-void tuning_tones_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void tuning_tones_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
tuning_tones_state_t *state = malloc(sizeof *state);
}
}
-void tuning_tones_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void tuning_tones_face_activate(void *context) {
(void) context;
}
}
}
-bool tuning_tones_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool tuning_tones_face_loop(movement_event_t event, void *context) {
tuning_tones_state_t *state = (tuning_tones_state_t *)context;
switch (event.event_type) {
case EVENT_LOW_ENERGY_UPDATE:
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return !state->playing;
}
-void tuning_tones_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void tuning_tones_face_resign(void *context) {
tuning_tones_state_t *state = (tuning_tones_state_t *)context;
if (state->playing) {
size_t note_ind;
} tuning_tones_state_t;
-void tuning_tones_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void tuning_tones_face_activate(movement_settings_t *settings, void *context);
-bool tuning_tones_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void tuning_tones_face_resign(movement_settings_t *settings, void *context);
+void tuning_tones_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void tuning_tones_face_activate(void *context);
+bool tuning_tones_face_loop(movement_event_t event, void *context);
+void tuning_tones_face_resign(void *context);
#define tuning_tones_face ((const watch_face_t){ \
tuning_tones_face_setup, \
//
static
-void _wake_face_update_display(movement_settings_t *settings, wake_face_state_t *state) {
- (void) settings;
+void _wake_face_update_display(wake_face_state_t *state) {
uint8_t hour = state->hour;
watch_clear_display();
// Exported
//
-void wake_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr) {
- (void) settings;
+void wake_face_setup(uint8_t watch_face_index, void **context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void wake_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void wake_face_activate(void *context) {
(void) context;
}
-void wake_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void wake_face_resign(void *context) {
(void) context;
}
-bool wake_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool wake_face_wants_background_task(void *context) {
wake_face_state_t *state = (wake_face_state_t *)context;
bool rc = false;
return rc;
}
-bool wake_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool wake_face_loop(movement_event_t event, void *context) {
wake_face_state_t *state = (wake_face_state_t *)context;
switch (event.event_type) {
case EVENT_ACTIVATE:
case EVENT_TICK:
- _wake_face_update_display(settings, state);
+ _wake_face_update_display(state);
break;
case EVENT_LIGHT_BUTTON_UP:
state->hour = (state->hour + 1) % 24;
- _wake_face_update_display(settings, state);
+ _wake_face_update_display(state);
break;
case EVENT_LIGHT_LONG_PRESS:
state->hour = (state->hour + 6) % 24;
- _wake_face_update_display(settings, state);
+ _wake_face_update_display(state);
break;
case EVENT_ALARM_BUTTON_UP:
state->minute = (state->minute + 10) % 60;
- _wake_face_update_display(settings, state);
+ _wake_face_update_display(state);
break;
case EVENT_ALARM_LONG_PRESS:
state->mode ^= 1;
- _wake_face_update_display(settings, state);
+ _wake_face_update_display(state);
break;
case EVENT_BACKGROUND_TASK:
movement_play_alarm();
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
uint32_t mode : 1;
} wake_face_state_t;
-void wake_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr);
-void wake_face_activate(movement_settings_t *settings, void *context);
-bool wake_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void wake_face_resign(movement_settings_t *settings, void *context);
-bool wake_face_wants_background_task(movement_settings_t *settings, void *context);
+void wake_face_setup(uint8_t watch_face_index, void **context_ptr);
+void wake_face_activate(void *context);
+bool wake_face_loop(movement_event_t event, void *context);
+void wake_face_resign(void *context);
+bool wake_face_wants_background_task(void *context);
#define wake_face ((const watch_face_t){ \
wake_face_setup, \
static bool _light_button_press;
-void wareki_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void wareki_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
//printf("wareki_setup() \n");
- (void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(wareki_state_t));
memset(*context_ptr, 0, sizeof(wareki_state_t));
}
-void wareki_activate(movement_settings_t *settings, void *context) {
+void wareki_activate(void *context) {
//printf("wareki_activate() \n");
- (void) settings;
wareki_state_t *state = (wareki_state_t *)context;
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
}
-bool wareki_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool wareki_loop(movement_event_t event, void *context) {
wareki_state_t *state = (wareki_state_t *)context;
state->real_year = watch_rtc_get_date_time().unit.year + WATCH_RTC_REFERENCE_YEAR;
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
// You can override any of these behaviors by adding a case for these events to this switch statement.
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void wareki_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void wareki_resign(void *context) {
(void) context;
}
} wareki_state_t;
-void wareki_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void wareki_activate(movement_settings_t *settings, void *context);
-bool wareki_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void wareki_resign(movement_settings_t *settings, void *context);
+void wareki_setup(uint8_t watch_face_index, void ** context_ptr);
+void wareki_activate(void *context);
+bool wareki_loop(movement_event_t event, void *context);
+void wareki_resign(void *context);
void addYear(wareki_state_t* state,int count);
void subYear(wareki_state_t* state,int count);
}
#endif
-void wordle_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void wordle_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(wordle_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void wordle_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void wordle_face_activate(void *context) {
wordle_state_t *state = (wordle_state_t *)context;
#if WORDLE_USE_DAILY_STREAK != 0
uint32_t now = get_day_unix_time();
display_title(state);
}
-bool wordle_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool wordle_face_loop(movement_event_t event, void *context) {
wordle_state_t *state = (wordle_state_t *)context;
switch (event.event_type) {
display_title(state);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void wordle_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void wordle_face_resign(void *context) {
(void) context;
}
uint32_t day_last_game_started;
} wordle_state_t;
-void wordle_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void wordle_face_activate(movement_settings_t *settings, void *context);
-bool wordle_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void wordle_face_resign(movement_settings_t *settings, void *context);
+void wordle_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void wordle_face_activate(void *context);
+bool wordle_face_loop(movement_event_t event, void *context);
+void wordle_face_resign(void *context);
#define wordle_face ((const watch_face_t){ \
wordle_face_setup, \
#include <string.h>
#include "beeps_face.h"
-void beeps_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void beeps_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(beeps_state_t));
}
}
-void beeps_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void beeps_face_activate(void *context) {
(void) context;
}
watch_display_string(buf, 0);
}
-bool beeps_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool beeps_face_loop(movement_event_t event, void *context) {
beeps_state_t *state = (beeps_state_t *)context;
switch (event.event_type) {
}
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void beeps_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void beeps_face_resign(void *context) {
(void) context;
}
uint8_t frequency;
} beeps_state_t;
-void beeps_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void beeps_face_activate(movement_settings_t *settings, void *context);
-bool beeps_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void beeps_face_resign(movement_settings_t *settings, void *context);
+void beeps_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void beeps_face_activate(void *context);
+bool beeps_face_loop(movement_event_t event, void *context);
+void beeps_face_resign(void *context);
#define beeps_face ((const watch_face_t){ \
beeps_face_setup, \
#include "character_set_face.h"
#include "watch.h"
-void character_set_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void character_set_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(char));
}
-void character_set_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void character_set_face_activate(void *context) {
char *c = (char *)context;
*c = '@';
movement_request_tick_frequency(0);
}
-bool character_set_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool character_set_face_loop(movement_event_t event, void *context) {
char *c = (char *)context;
char buf[11];
switch (event.event_type) {
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void character_set_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void character_set_face_resign(void *context) {
(void) context;
}
#include "movement.h"
-void character_set_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void character_set_face_activate(movement_settings_t *settings, void *context);
-bool character_set_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void character_set_face_resign(movement_settings_t *settings, void *context);
+void character_set_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void character_set_face_activate(void *context);
+bool character_set_face_loop(movement_event_t event, void *context);
+void character_set_face_resign(void *context);
#define character_set_face ((const watch_face_t){ \
character_set_face_setup, \
static uint8_t *nanosec_buffer = 0;
static uint16_t nanosec_buffer_size = 0;
-void chirpy_demo_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr) {
- (void)settings;
+void chirpy_demo_face_setup(uint8_t watch_face_index, void **context_ptr) {
(void)watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(chirpy_demo_state_t));
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void chirpy_demo_face_activate(movement_settings_t *settings, void *context) {
- (void)settings;
+void chirpy_demo_face_activate(void *context) {
chirpy_demo_state_t *state = (chirpy_demo_state_t *)context;
memset(context, 0, sizeof(chirpy_demo_state_t));
state->tick_state.tick_fun = _cdf_countdown_tick;
}
-bool chirpy_demo_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void)settings;
+bool chirpy_demo_face_loop(movement_event_t event, void *context) {
chirpy_demo_state_t *state = (chirpy_demo_state_t *)context;
switch (event.event_type) {
return true;
}
-void chirpy_demo_face_resign(movement_settings_t *settings, void *context) {
- (void)settings;
+void chirpy_demo_face_resign(void *context) {
(void)context;
if (nanosec_buffer != 0) {
#include "movement.h"
-void chirpy_demo_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void chirpy_demo_face_activate(movement_settings_t *settings, void *context);
-bool chirpy_demo_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void chirpy_demo_face_resign(movement_settings_t *settings, void *context);
+void chirpy_demo_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void chirpy_demo_face_activate(void *context);
+bool chirpy_demo_face_loop(movement_event_t event, void *context);
+void chirpy_demo_face_resign(void *context);
#define chirpy_demo_face ((const watch_face_t){ \
chirpy_demo_face_setup, \
DEMO_FACE_NUM_FACES
} demo_face_index_t;
-void demo_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void demo_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(demo_face_index_t));
}
}
-void demo_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void demo_face_activate(void *context) {
(void) context;
movement_request_tick_frequency(0);
// ensure the watch never enters low energy mode
movement_set_backlight_dwell(3);
}
-bool demo_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool demo_face_loop(movement_event_t event, void *context) {
demo_face_index_t *screen = (demo_face_index_t *)context;
switch (event.event_type) {
case EVENT_ALARM_BUTTON_UP:
// ignore timeout
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void demo_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void demo_face_resign(void *context) {
(void) context;
}
#include "movement.h"
-void demo_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void demo_face_activate(movement_settings_t *settings, void *context);
-bool demo_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void demo_face_resign(movement_settings_t *settings, void *context);
+void demo_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void demo_face_activate(void *context);
+bool demo_face_loop(movement_event_t event, void *context);
+void demo_face_resign(void *context);
#define demo_face ((const watch_face_t){ \
demo_face_setup, \
while (RTC->MODE2.SYNCBUSY.bit.ENABLE);
}
-void frequency_correction_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void frequency_correction_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(frequency_correction_state_t));
}
}
-void frequency_correction_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void frequency_correction_face_activate(void *context) {
frequency_correction_state_t *state = (frequency_correction_state_t *)context;
_enable_output(state->period_event_output);
}
-bool frequency_correction_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool frequency_correction_face_loop(movement_event_t event, void *context) {
frequency_correction_state_t *state = (frequency_correction_state_t *)context;
int8_t freqcorr;
watch_start_tick_animation(500);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void frequency_correction_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void frequency_correction_face_resign(void *context) {
(void) context;
_disable_output();
#else
-void frequency_correction_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void frequency_correction_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
(void) context_ptr;
}
-void frequency_correction_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void frequency_correction_face_activate(void *context) {
(void) context;
}
-bool frequency_correction_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool frequency_correction_face_loop(movement_event_t event, void *context) {
(void) context;
(void) event;
return true;
}
-void frequency_correction_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void frequency_correction_face_resign(void *context) {
(void) context;
}
uint8_t period_event_output;
} frequency_correction_state_t;
-void frequency_correction_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void frequency_correction_face_activate(movement_settings_t *settings, void *context);
-bool frequency_correction_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void frequency_correction_face_resign(movement_settings_t *settings, void *context);
+void frequency_correction_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void frequency_correction_face_activate(void *context);
+bool frequency_correction_face_loop(movement_event_t event, void *context);
+void frequency_correction_face_resign(void *context);
#define frequency_correction_face ((const watch_face_t){ \
frequency_correction_face_setup, \
#include "hello_there_face.h"
#include "watch.h"
-void hello_there_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void hello_there_face_setup(uint8_t watch_face_index, void ** context_ptr) {
// These next two lines just silence the compiler warnings associated with unused parameters.
// We have no use for the settings or the watch_face_index, so we make that explicit here.
- (void) settings;
(void) watch_face_index;
// At boot, context_ptr will be NULL indicating that we don't have anyplace to store our context.
if (*context_ptr == NULL) {
}
}
-void hello_there_face_activate(movement_settings_t *settings, void *context) {
+void hello_there_face_activate(void *context) {
// same as above: silence the warning, we don't need to check the settings.
- (void) settings;
// we do however need to set some things in our context. Here we cast it to the correct type...
hello_there_state_t *state = (hello_there_state_t *)context;
// ...and set the initial state of our watch face. We start out displaying the word 'Hello',
state->animating = true;
}
-bool hello_there_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool hello_there_face_loop(movement_event_t event, void *context) {
hello_there_state_t *state = (hello_there_state_t *)context;
switch (event.event_type) {
movement_move_to_face(0);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void hello_there_face_resign(movement_settings_t *settings, void *context) {
+void hello_there_face_resign(void *context) {
// our watch face, like most watch faces, has nothing special to do when resigning.
// watch faces that enable a peripheral or interact with a sensor may want to turn it off here.
- (void) settings;
(void) context;
}
bool animating;
} hello_there_state_t;
-void hello_there_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void hello_there_face_activate(movement_settings_t *settings, void *context);
-bool hello_there_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void hello_there_face_resign(movement_settings_t *settings, void *context);
+void hello_there_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void hello_there_face_activate(void *context);
+bool hello_there_face_loop(movement_event_t event, void *context);
+void hello_there_face_resign(void *context);
#define hello_there_face ((const watch_face_t){ \
hello_there_face_setup, \
// Pressing the alarm button enters the log mode, where the main display shows the number of interrupts detected in each of the last
// 24 hours (the hour is shown in the top right digit and AM/PM indicator, if the clock is set to 12 hour mode)
-static void _lis2dw_logging_face_update_display(movement_settings_t *settings, lis2dw_logger_state_t *logger_state, lis2dw_wakeup_source wakeup_source) {
+static void _lis2dw_logging_face_update_display(lis2dw_logger_state_t *logger_state, lis2dw_wakeup_source wakeup_source) {
char buf[14];
char time_indication_character;
int8_t pos;
logger_state->z_interrupts_this_hour = 0;
}
-void lis2dw_logging_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void lis2dw_logging_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(lis2dw_logger_state_t));
}
}
-void lis2dh_logging_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void lis2dh_logging_face_activate(void *context) {
lis2dh_logger_state_t *logger_state = (lis2dh_logger_state_t *)context;
logger_state->display_index = 0;
logger_state->log_ticks = 0;
watch_enable_digital_input(A4);
}
-bool lis2dw_logging_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool lis2dw_logging_face_loop(movement_event_t event, void *context) {
lis2dw_logger_state_t *logger_state = (lis2dw_logger_state_t *)context;
lis2dw_wakeup_source wakeup_source = 0;
lis2dw_interrupt_source interrupt_source = 0;
case EVENT_LIGHT_BUTTON_DOWN:
logger_state->axis_index = (logger_state->axis_index + 1) % 4;
logger_state->log_ticks = 255;
- _lis2dw_logging_face_update_display(settings, logger_state, wakeup_source);
+ _lis2dw_logging_face_update_display(logger_state, wakeup_source);
break;
case EVENT_ALARM_BUTTON_UP:
if (logger_state->log_ticks) logger_state->display_index = (logger_state->display_index + 1) % LIS2DW_LOGGING_NUM_DATA_POINTS;
logger_state->log_ticks = 255;
logger_state->axis_index = 0;
- _lis2dw_logging_face_update_display(settings, logger_state, wakeup_source);
+ _lis2dw_logging_face_update_display(logger_state, wakeup_source);
break;
case EVENT_ACTIVATE:
case EVENT_TICK:
} else {
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
}
- _lis2dw_logging_face_update_display(settings, logger_state, wakeup_source);
+ _lis2dw_logging_face_update_display(logger_state, wakeup_source);
break;
case EVENT_BACKGROUND_TASK:
_lis2dw_logging_face_log_data(logger_state);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void lis2dw_logging_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void lis2dw_logging_face_resign(void *context) {
(void) context;
watch_disable_digital_input(A4);
}
-bool lis2dw_logging_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool lis2dw_logging_face_wants_background_task(void *context) {
lis2dw_logger_state_t *logger_state = (lis2dw_logger_state_t *)context;
watch_date_time date_time = watch_rtc_get_date_time();
lis2dw_logger_data_point_t data[LIS2DW_LOGGING_NUM_DATA_POINTS];
} lis2dw_logger_state_t;
-void lis2dw_logging_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void lis2dw_logging_face_activate(movement_settings_t *settings, void *context);
-bool lis2dw_logging_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void lis2dw_logging_face_resign(movement_settings_t *settings, void *context);
-bool lis2dw_logging_face_wants_background_task(movement_settings_t *settings, void *context);
+void lis2dw_logging_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void lis2dw_logging_face_activate(void *context);
+bool lis2dw_logging_face_loop(movement_event_t event, void *context);
+void lis2dw_logging_face_resign(void *context);
+bool lis2dw_logging_face_wants_background_task(void *context);
#define lis2dw_logging_face ((const watch_face_t){ \
lis2dw_logging_face_setup, \
watch_display_string(buf, 0);
}
-void voltage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void voltage_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
(void) context_ptr;
}
-void voltage_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void voltage_face_activate(void *context) {
(void) context;
}
-bool voltage_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool voltage_face_loop(movement_event_t event, void *context) {
(void) context;
watch_date_time date_time;
switch (event.event_type) {
}
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void voltage_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void voltage_face_resign(void *context) {
(void) context;
}
#include "movement.h"
-void voltage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void voltage_face_activate(movement_settings_t *settings, void *context);
-bool voltage_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void voltage_face_resign(movement_settings_t *settings, void *context);
+void voltage_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void voltage_face_activate(void *context);
+bool voltage_face_loop(movement_event_t event, void *context);
+void voltage_face_resign(void *context);
#define voltage_face ((const watch_face_t){ \
voltage_face_setup, \
lis2dw_configure_wakeup_int1(threshold, false, true);
}
-void accel_interrupt_count_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void accel_interrupt_count_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(accel_interrupt_count_state_t));
}
}
-void accel_interrupt_count_face_activate(movement_settings_t *settings, void *context) {
+void accel_interrupt_count_face_activate(void *context) {
accel_interrupt_count_state_t *state = (accel_interrupt_count_state_t *)context;
// never in settings mode at the start
movement_set_low_energy_timeout(0);
}
-bool accel_interrupt_count_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool accel_interrupt_count_face_loop(movement_event_t event, void *context) {
accel_interrupt_count_state_t *state = (accel_interrupt_count_state_t *)context;
if (state->is_setting) {
state->is_setting = false;
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
} else {
}
return false;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
}
return true;
}
-void accel_interrupt_count_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void accel_interrupt_count_face_resign(void *context) {
(void) context;
}
-bool accel_interrupt_count_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool accel_interrupt_count_face_wants_background_task(void *context) {
(void) context;
return false;
}
bool is_setting;
} accel_interrupt_count_state_t;
-void accel_interrupt_count_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void accel_interrupt_count_face_activate(movement_settings_t *settings, void *context);
-bool accel_interrupt_count_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void accel_interrupt_count_face_resign(movement_settings_t *settings, void *context);
-bool accel_interrupt_count_face_wants_background_task(movement_settings_t *settings, void *context);
+void accel_interrupt_count_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void accel_interrupt_count_face_activate(void *context);
+bool accel_interrupt_count_face_loop(movement_event_t event, void *context);
+void accel_interrupt_count_face_resign(void *context);
+bool accel_interrupt_count_face_wants_background_task(void *context);
#define accel_interrupt_count_face ((const watch_face_t){ \
accel_interrupt_count_face_setup, \
static void update(accelerometer_data_acquisition_state_t *state);
static void update_settings(accelerometer_data_acquisition_state_t *state);
static void advance_current_setting(accelerometer_data_acquisition_state_t *state);
-static void start_reading(accelerometer_data_acquisition_state_t *state, movement_settings_t *settings);
+static void start_reading(accelerometer_data_acquisition_state_t *state);
static void continue_reading(accelerometer_data_acquisition_state_t *state);
static void finish_reading(accelerometer_data_acquisition_state_t *state);
static bool wait_for_flash_ready(void);
static void write_page(accelerometer_data_acquisition_state_t *state);
static void log_data_point(accelerometer_data_acquisition_state_t *state, lis2dw_reading_t reading, uint8_t centiseconds);
-void accelerometer_data_acquisition_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void accelerometer_data_acquisition_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
accelerometer_data_acquisition_state_t *state = (accelerometer_data_acquisition_state_t *)*context_ptr;
if (*context_ptr == NULL) {
}
-void accelerometer_data_acquisition_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void accelerometer_data_acquisition_face_activate(void *context) {
accelerometer_data_acquisition_state_t *state = (accelerometer_data_acquisition_state_t *)context;
state->next_available_page = get_next_available_page();
}
-bool accelerometer_data_acquisition_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool accelerometer_data_acquisition_face_loop(movement_event_t event, void *context) {
accelerometer_data_acquisition_state_t *state = (accelerometer_data_acquisition_state_t *)context;
switch (event.event_type) {
state->reading_ticks = SECONDS_TO_RECORD + 1;
// also beep if the user asked for it
if (state->beep_with_countdown) watch_buzzer_play_note(BUZZER_NOTE_C6, 75);
- start_reading(state, settings);
+ start_reading(state);
} else if (state->countdown_ticks < 3) {
// beep for last two ticks before reading
if (state->beep_with_countdown) watch_buzzer_play_note(BUZZER_NOTE_C5, 75);
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void accelerometer_data_acquisition_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void accelerometer_data_acquisition_face_resign(void *context) {
accelerometer_data_acquisition_state_t *state = (accelerometer_data_acquisition_state_t *)context;
if (state->reading_ticks) {
state->reading_ticks = 0;
}
}
-static void start_reading(accelerometer_data_acquisition_state_t *state, movement_settings_t *settings) {
+static void start_reading(accelerometer_data_acquisition_state_t *state) {
printf("Start reading\n");
watch_enable_i2c();
lis2dw_begin();
uint16_t pos;
} accelerometer_data_acquisition_state_t;
-void accelerometer_data_acquisition_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void accelerometer_data_acquisition_face_activate(movement_settings_t *settings, void *context);
-bool accelerometer_data_acquisition_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void accelerometer_data_acquisition_face_resign(movement_settings_t *settings, void *context);
+void accelerometer_data_acquisition_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void accelerometer_data_acquisition_face_activate(void *context);
+bool accelerometer_data_acquisition_face_loop(movement_event_t event, void *context);
+void accelerometer_data_acquisition_face_resign(void *context);
#define accelerometer_data_acquisition_face ((const watch_face_t){ \
accelerometer_data_acquisition_face_setup, \
}
}
-void alarm_thermometer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void alarm_thermometer_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(alarm_thermometer_state_t));
}
}
-void alarm_thermometer_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void alarm_thermometer_face_activate(void *context) {
alarm_thermometer_state_t *state = (alarm_thermometer_state_t *)context;
state->mode = MODE_NORMAL;
_alarm_thermometer_face_clear(state->last);
watch_display_string("AT", 0);
}
-bool alarm_thermometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool alarm_thermometer_face_loop(movement_event_t event, void *context) {
alarm_thermometer_state_t *state = (alarm_thermometer_state_t *)context;
switch (event.event_type) {
}
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void alarm_thermometer_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void alarm_thermometer_face_resign(void *context) {
(void) context;
}
alarm_thermometer_mode_t mode;
} alarm_thermometer_state_t;
-void alarm_thermometer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void alarm_thermometer_face_activate(movement_settings_t *settings, void *context);
-bool alarm_thermometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void alarm_thermometer_face_resign(movement_settings_t *settings, void *context);
+void alarm_thermometer_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void alarm_thermometer_face_activate(void *context);
+bool alarm_thermometer_face_loop(movement_event_t event, void *context);
+void alarm_thermometer_face_resign(void *context);
#define alarm_thermometer_face ((const watch_face_t){ \
alarm_thermometer_face_setup, \
uint16_t lightmeter_mod(uint16_t m, uint16_t n) { return (m%n + n)%n; }
-void lightmeter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void lightmeter_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(lightmeter_state_t));
}
}
-void lightmeter_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void lightmeter_face_activate(void *context) {
lightmeter_state_t *state = (lightmeter_state_t*) context;
state->waiting_for_conversion = 0;
lightmeter_show_ev(state); // Print most current reading
return;
}
-bool lightmeter_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool lightmeter_face_loop(movement_event_t event, void *context) {
lightmeter_state_t *state = (lightmeter_state_t*) context;
opt3001_Config_t c;
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void lightmeter_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void lightmeter_face_resign(void *context) {
(void) context;
opt3001_writeConfig(lightmeter_addr, lightmeter_off);
watch_disable_i2c();
uint16_t lightmeter_mod(uint16_t m, uint16_t n);
-void lightmeter_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void lightmeter_face_activate(movement_settings_t *settings, void *context);
+void lightmeter_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void lightmeter_face_activate(void *context);
void lightmeter_show_ev(lightmeter_state_t *state);
-bool lightmeter_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void lightmeter_face_resign(movement_settings_t *settings, void *context);
+bool lightmeter_face_loop(movement_event_t event, void *context);
+void lightmeter_face_resign(void *context);
static const uint8_t lightmeter_addr = 0x44;
}
-void minmax_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void minmax_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(minmax_state_t));
}
-void minmax_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void minmax_face_activate(void *context) {
minmax_state_t *state = (minmax_state_t *)context;
state->show_min = true;
watch_display_string("MN", 0); // Start with minimum temp
}
-bool minmax_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool minmax_face_loop(movement_event_t event, void *context) {
minmax_state_t *state = (minmax_state_t *)context;
float temp_c;
_minmax_face_log_data(state);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void minmax_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void minmax_face_resign(void *context) {
(void) context;
}
-bool minmax_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool minmax_face_wants_background_task(void *context) {
(void) context;
// this will get called at the top of each minute; always request bg task
return true;
float hourly_maxs[LOGGING_DATA_POINTS];
} minmax_state_t;
-void minmax_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void minmax_face_activate(movement_settings_t *settings, void *context);
-bool minmax_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void minmax_face_resign(movement_settings_t *settings, void *context);
-bool minmax_face_wants_background_task(movement_settings_t *settings, void *context);
+void minmax_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void minmax_face_activate(void *context);
+bool minmax_face_loop(movement_event_t event, void *context);
+void minmax_face_resign(void *context);
+bool minmax_face_wants_background_task(void *context);
#define minmax_face ((const watch_face_t){ \
minmax_face_setup, \
watch_display_string(buf, 0);
}
-void thermistor_logging_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void thermistor_logging_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(thermistor_logger_state_t));
}
}
-void thermistor_logging_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void thermistor_logging_face_activate(void *context) {
thermistor_logger_state_t *logger_state = (thermistor_logger_state_t *)context;
logger_state->display_index = 0;
logger_state->ts_ticks = 0;
}
-bool thermistor_logging_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool thermistor_logging_face_loop(movement_event_t event, void *context) {
thermistor_logger_state_t *logger_state = (thermistor_logger_state_t *)context;
switch (event.event_type) {
case EVENT_TIMEOUT:
_thermistor_logging_face_log_data(logger_state);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void thermistor_logging_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void thermistor_logging_face_resign(void *context) {
(void) context;
}
-bool thermistor_logging_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool thermistor_logging_face_wants_background_task(void *context) {
(void) context;
// this will get called at the top of each minute, so all we check is if we're at the top of the hour as well.
// if we are, we ask for a background task.
thermistor_logger_data_point_t data[THERMISTOR_LOGGING_NUM_DATA_POINTS];
} thermistor_logger_state_t;
-void thermistor_logging_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void thermistor_logging_face_activate(movement_settings_t *settings, void *context);
-bool thermistor_logging_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void thermistor_logging_face_resign(movement_settings_t *settings, void *context);
-bool thermistor_logging_face_wants_background_task(movement_settings_t *settings, void *context);
+void thermistor_logging_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void thermistor_logging_face_activate(void *context);
+bool thermistor_logging_face_loop(movement_event_t event, void *context);
+void thermistor_logging_face_resign(void *context);
+bool thermistor_logging_face_wants_background_task(void *context);
#define thermistor_logging_face ((const watch_face_t){ \
thermistor_logging_face_setup, \
thermistor_driver_disable();
}
-void thermistor_readout_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void thermistor_readout_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
(void) context_ptr;
}
-void thermistor_readout_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void thermistor_readout_face_activate(void *context) {
(void) context;
watch_display_string("TE", 0);
}
-bool thermistor_readout_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool thermistor_readout_face_loop(movement_event_t event, void *context) {
(void) context;
watch_date_time date_time = watch_rtc_get_date_time();
switch (event.event_type) {
}
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void thermistor_readout_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void thermistor_readout_face_resign(void *context) {
(void) context;
}
#include "movement.h"
-void thermistor_readout_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void thermistor_readout_face_activate(movement_settings_t *settings, void *context);
-bool thermistor_readout_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void thermistor_readout_face_resign(movement_settings_t *settings, void *context);
+void thermistor_readout_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void thermistor_readout_face_activate(void *context);
+bool thermistor_readout_face_loop(movement_event_t event, void *context);
+void thermistor_readout_face_resign(void *context);
#define thermistor_readout_face ((const watch_face_t){ \
thermistor_readout_face_setup, \
thermistor_driver_disable();
}
-void thermistor_testing_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void thermistor_testing_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
(void) context_ptr;
// force one setting: never enter low energy mode.
movement_set_low_energy_timeout(0);
}
-void thermistor_testing_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void thermistor_testing_face_activate(void *context) {
(void) context;
watch_display_string("TE", 0);
movement_request_tick_frequency(8);
}
-bool thermistor_testing_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool thermistor_testing_face_loop(movement_event_t event, void *context) {
(void) context;
switch (event.event_type) {
case EVENT_ALARM_BUTTON_DOWN:
_thermistor_testing_face_update_display(movement_use_imperial_units());
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void thermistor_testing_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void thermistor_testing_face_resign(void *context) {
(void) context;
}
#include "movement.h"
-void thermistor_testing_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void thermistor_testing_face_activate(movement_settings_t *settings, void *context);
-bool thermistor_testing_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void thermistor_testing_face_resign(movement_settings_t *settings, void *context);
+void thermistor_testing_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void thermistor_testing_face_activate(void *context);
+bool thermistor_testing_face_loop(movement_event_t event, void *context);
+void thermistor_testing_face_resign(void *context);
#define thermistor_testing_face ((const watch_face_t){ \
thermistor_testing_face_setup, \
int total_adjustment;
int8_t finetune_page;
-void finetune_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void finetune_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
(void) context_ptr;
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
}
-void finetune_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void finetune_face_activate(void *context) {
(void) context;
// Handle any tasks related to your watch face coming on screen.
movement_move_to_face(0); // Go to main face after saving settings
}
-bool finetune_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool finetune_face_loop(movement_event_t event, void *context) {
- (void) settings;
(void) context;
switch (event.event_type) {
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void finetune_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void finetune_face_resign(void *context) {
(void) context;
if (total_adjustment != 0) {
uint8_t unused;
} finetune_state_t;
-void finetune_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void finetune_face_activate(movement_settings_t *settings, void *context);
-bool finetune_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void finetune_face_resign(movement_settings_t *settings, void *context);
+void finetune_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void finetune_face_activate(void *context);
+bool finetune_face_loop(movement_event_t event, void *context);
+void finetune_face_resign(void *context);
#define finetune_face ((const watch_face_t){ \
finetune_face_setup, \
nanosec_changed = false;
}
-void nanosec_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+void nanosec_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
- (void) settings;
if (*context_ptr == NULL) {
if (filesystem_get_file_size("nanosec.ini") != sizeof(nanosec_state)) {
}
}
-void nanosec_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void nanosec_face_activate(void *context) {
(void) context;
// Handle any tasks related to your watch face coming on screen.
}
-bool nanosec_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool nanosec_face_loop(movement_event_t event, void *context) {
(void) context;
switch (event.event_type) {
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void nanosec_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void nanosec_face_resign(void *context) {
(void) context;
nanosec_ui_save();
}
// Background freq correction
-bool nanosec_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool nanosec_face_wants_background_task(void *context) {
(void) context;
if (nanosec_state.correction_profile == 0)
return 0; // No need for background correction if we are on profile 0 - static hardware correction.
int16_t aging_ppm_pa; // multiplied by 100. Aging per year.
} nanosec_state_t;
-void nanosec_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void nanosec_face_activate(movement_settings_t *settings, void *context);
-bool nanosec_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void nanosec_face_resign(movement_settings_t *settings, void *context);
-bool nanosec_face_wants_background_task(movement_settings_t *settings, void *context);
+void nanosec_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void nanosec_face_activate(void *context);
+bool nanosec_face_loop(movement_event_t event, void *context);
+void nanosec_face_resign(void *context);
+bool nanosec_face_wants_background_task(void *context);
void nanosec_ui_save(void);
void nanosec_save(void);
float nanosec_get_aging(void);
// PUBLIC WATCH FACE FUNCTIONS ////////////////////////////////////////////////
-void place_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void place_face_activate(movement_settings_t *settings, void *context);
-bool place_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void place_face_resign(movement_settings_t *settings, void *context);
+void place_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void place_face_activate(void *context);
+bool place_face_loop(movement_event_t event, void *context);
+void place_face_resign(void *context);
void place_latlon_to_olc(char *pluscode, double latitude, double longitude);
void place_latlon_to_geohash(char *geohash, double latitude, double longitude);
filesystem_write_file(filename, (char*)&savefile, sizeof(savefile_t));
}
-static void load(save_load_state_t *state, movement_settings_t *settings) {
+static void load(save_load_state_t *state) {
watch_store_backup_data(state->slot[state->index].b0, 0);
watch_store_backup_data(state->slot[state->index].b1, 1);
watch_store_backup_data(state->slot[state->index].b2, 2);
}
}
-void save_load_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void save_load_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(save_load_state_t));
}
}
-void save_load_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void save_load_face_activate(void *context) {
save_load_state_t *state = (save_load_state_t *)context;
state->index = 0;
state->update_timeout = 0;
}
}
-bool save_load_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool save_load_face_loop(movement_event_t event, void *context) {
save_load_state_t *state = (save_load_state_t *)context;
switch (event.event_type) {
break;
case EVENT_ALARM_LONG_PRESS:
if (state->slot[state->index].version) {
- load(state, settings);
+ load(state);
watch_display_string("Loaded", 4);
state->update_timeout = 3;
}
movement_move_to_face(0);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void save_load_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void save_load_face_resign(void *context) {
(void) context;
// handle any cleanup before your watch face goes off-screen.
savefile_t slot[SAVE_LOAD_SLOTS];
} save_load_state_t;
-void save_load_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void save_load_face_activate(movement_settings_t *settings, void *context);
-bool save_load_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void save_load_face_resign(movement_settings_t *settings, void *context);
+void save_load_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void save_load_face_activate(void *context);
+bool save_load_face_loop(movement_event_t event, void *context);
+void save_load_face_resign(void *context);
#define save_load_face ((const watch_face_t){ \
save_load_face_setup, \
watch_date_time date_time_settings;
-void set_time_hackwatch_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void set_time_hackwatch_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(uint8_t));
}
-void set_time_hackwatch_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void set_time_hackwatch_face_activate(void *context) {
*((uint8_t *)context) = 3;
movement_request_tick_frequency(32);
date_time_settings = watch_rtc_get_date_time();
}
-bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool set_time_hackwatch_face_loop(movement_event_t event, void *context) {
uint8_t current_page = *((uint8_t *)context);
if (event.subsecond == 15) // Delay displayed time update by ~0.5 seconds, to align phase exactly to main clock at 1Hz
// don't light up every time light is hit
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void set_time_hackwatch_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void set_time_hackwatch_face_resign(void *context) {
(void) context;
watch_set_led_off();
movement_store_settings();
#include "movement.h"
-void set_time_hackwatch_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void set_time_hackwatch_face_activate(movement_settings_t *settings, void *context);
-bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void set_time_hackwatch_face_resign(movement_settings_t *settings, void *context);
+void set_time_hackwatch_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void set_time_hackwatch_face_activate(void *context);
+bool set_time_hackwatch_face_loop(movement_event_t event, void *context);
+void set_time_hackwatch_face_resign(void *context);
#define set_time_hackwatch_face ((const watch_face_t){ \
set_time_hackwatch_face_setup, \
const uint8_t BEAT_REFRESH_FREQUENCY = 8;
-void beats_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void beats_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
(void) context_ptr;
if (*context_ptr == NULL) {
}
}
-void beats_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void beats_face_activate(void *context) {
beats_face_state_t *state = (beats_face_state_t *)context;
state->next_subsecond_update = 0;
state->last_centibeat_displayed = 0;
movement_request_tick_frequency(BEAT_REFRESH_FREQUENCY);
}
-bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool beats_face_loop(movement_event_t event, void *context) {
beats_face_state_t *state = (beats_face_state_t *)context;
if (event.event_type == EVENT_TICK && event.subsecond != state->next_subsecond_update) {
return true; // math is hard, don't do it if we don't have to.
watch_display_text(WATCH_POSITION_FULL, buf);
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void beats_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void beats_face_resign(void *context) {
(void) context;
}
} beats_face_state_t;
uint32_t clock2beats(uint32_t hours, uint32_t minutes, uint32_t seconds, uint32_t subseconds, int16_t utc_offset);
-void beats_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void beats_face_activate(movement_settings_t *settings, void *context);
-bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void beats_face_resign(movement_settings_t *settings, void *context);
+void beats_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void beats_face_activate(void *context);
+bool beats_face_loop(movement_event_t event, void *context);
+void beats_face_resign(void *context);
#define beats_face ((const watch_face_t){ \
beats_face_setup, \
}
}
-static void clock_indicate_alarm(movement_settings_t *settings) {
+static void clock_indicate_alarm() {
clock_indicate(WATCH_INDICATOR_SIGNAL, movement_alarm_enabled());
}
clock_indicate(WATCH_INDICATOR_BELL, clock->time_signal_enabled);
}
-static void clock_indicate_24h(movement_settings_t *settings) {
+static void clock_indicate_24h() {
clock_indicate(WATCH_INDICATOR_24H, !!movement_clock_mode_24h());
}
return date_time.unit.hour >= 12;
}
-static void clock_indicate_pm(movement_settings_t *settings, watch_date_time date_time) {
+static void clock_indicate_pm(watch_date_time date_time) {
if (movement_clock_mode_24h()) { return; }
clock_indicate(WATCH_INDICATOR_PM, clock_is_pm(date_time));
}
}
}
-static void clock_display_clock(movement_settings_t *settings, clock_state_t *clock, watch_date_time current) {
+static void clock_display_clock(clock_state_t *clock, watch_date_time current) {
if (!clock_display_some(current, clock->date_time.previous)) {
if (movement_clock_mode_24h() == MOVEMENT_CLOCK_MODE_12H) {
- clock_indicate_pm(settings, current);
+ clock_indicate_pm(current);
current = clock_24h_to_12h(current);
}
clock_display_all(current, movement_clock_mode_24h() == MOVEMENT_CLOCK_MODE_024H);
}
}
-void clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void clock_face_activate(movement_settings_t *settings, void *context) {
+void clock_face_activate(void *context) {
clock_state_t *clock = (clock_state_t *) context;
clock_stop_tick_tock_animation();
clock_indicate_time_signal(clock);
- clock_indicate_alarm(settings);
- clock_indicate_24h(settings);
+ clock_indicate_alarm();
+ clock_indicate_24h();
watch_set_colon();
clock->date_time.previous.reg = 0xFFFFFFFF;
}
-bool clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool clock_face_loop(movement_event_t event, void *context) {
clock_state_t *state = (clock_state_t *) context;
watch_date_time current;
case EVENT_ACTIVATE:
current = watch_rtc_get_date_time();
- clock_display_clock(settings, state, current);
+ clock_display_clock(state, current);
clock_check_battery_periodically(state, current);
movement_play_signal();
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void clock_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void clock_face_resign(void *context) {
(void) context;
}
-bool clock_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool clock_face_wants_background_task(void *context) {
clock_state_t *state = (clock_state_t *) context;
if (!state->time_signal_enabled) return false;
#include "movement.h"
-void clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void clock_face_activate(movement_settings_t *settings, void *context);
-bool clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void clock_face_resign(movement_settings_t *settings, void *context);
-bool clock_face_wants_background_task(movement_settings_t *settings, void *context);
+void clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void clock_face_activate(void *context);
+bool clock_face_loop(movement_event_t event, void *context);
+void clock_face_resign(void *context);
+bool clock_face_wants_background_task(void *context);
#define clock_face ((const watch_face_t) { \
clock_face_setup, \
else watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
}
-void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void simple_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void simple_clock_face_activate(movement_settings_t *settings, void *context) {
+void simple_clock_face_activate(void *context) {
simple_clock_state_t *state = (simple_clock_state_t *)context;
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
state->previous_date_time = 0xFFFFFFFF;
}
-bool simple_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool simple_clock_face_loop(movement_event_t event, void *context) {
simple_clock_state_t *state = (simple_clock_state_t *)context;
char buf[11];
movement_play_signal();
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-void simple_clock_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void simple_clock_face_resign(void *context) {
(void) context;
}
-bool simple_clock_face_wants_background_task(movement_settings_t *settings, void *context) {
- (void) settings;
+bool simple_clock_face_wants_background_task(void *context) {
simple_clock_state_t *state = (simple_clock_state_t *)context;
if (!state->signal_enabled) return false;
bool alarm_enabled;
} simple_clock_state_t;
-void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void simple_clock_face_activate(movement_settings_t *settings, void *context);
-bool simple_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void simple_clock_face_resign(movement_settings_t *settings, void *context);
-bool simple_clock_face_wants_background_task(movement_settings_t *settings, void *context);
+void simple_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void simple_clock_face_activate(void *context);
+bool simple_clock_face_loop(movement_event_t event, void *context);
+void simple_clock_face_resign(void *context);
+bool simple_clock_face_wants_background_task(void *context);
#define simple_clock_face ((const watch_face_t){ \
simple_clock_face_setup, \
state->current_offset = movement_get_current_timezone_offset_for_zone(state->settings.bit.timezone_index);
}
-void world_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void world_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(world_clock_state_t));
}
}
-void world_clock_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void world_clock_face_activate(void *context) {
world_clock_state_t *state = (world_clock_state_t *)context;
state->current_screen = 0;
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
}
-static bool world_clock_face_do_display_mode(movement_event_t event, movement_settings_t *settings, world_clock_state_t *state) {
+static bool world_clock_face_do_display_mode(movement_event_t event, world_clock_state_t *state) {
char buf[11];
uint32_t previous_date_time;
state->current_screen = 1;
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
return true;
}
-static bool _world_clock_face_do_settings_mode(movement_event_t event, movement_settings_t *settings, world_clock_state_t *state) {
+static bool _world_clock_face_do_settings_mode(movement_event_t event, world_clock_state_t *state) {
switch (event.event_type) {
case EVENT_MODE_BUTTON_UP:
if (state->backup_register) watch_store_backup_data(state->settings.reg, state->backup_register);
state->current_screen = 0;
if (state->backup_register) watch_store_backup_data(state->settings.reg, state->backup_register);
event.event_type = EVENT_ACTIVATE;
- return world_clock_face_do_display_mode(event, settings, state);
+ return world_clock_face_do_display_mode(event, state);
}
break;
case EVENT_ALARM_BUTTON_DOWN:
return true;
}
-bool world_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool world_clock_face_loop(movement_event_t event, void *context) {
world_clock_state_t *state = (world_clock_state_t *)context;
if (state->current_screen == 0) {
- return world_clock_face_do_display_mode(event, settings, state);
+ return world_clock_face_do_display_mode(event, state);
} else {
- return _world_clock_face_do_settings_mode(event, settings, state);
+ return _world_clock_face_do_settings_mode(event, state);
}
}
-void world_clock_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void world_clock_face_resign(void *context) {
(void) context;
}
int32_t current_offset;
} world_clock_state_t;
-void world_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void world_clock_face_activate(movement_settings_t *settings, void *context);
-bool world_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void world_clock_face_resign(movement_settings_t *settings, void *context);
+void world_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void world_clock_face_activate(void *context);
+bool world_clock_face_loop(movement_event_t event, void *context);
+void world_clock_face_resign(void *context);
uint8_t world_clock_face_get_weekday(uint16_t day, uint16_t month, uint16_t year);
state->seconds = state->set_seconds;
}
-static inline void button_beep(movement_settings_t *settings) {
+static inline void button_beep() {
// play a beep as confirmation for a button press (if applicable)
if (movement_button_should_sound())
watch_buzzer_play_note(BUZZER_NOTE_C7, 50);
}
-static void schedule_countdown(countdown_state_t *state, movement_settings_t *settings) {
- (void) settings;
+static void schedule_countdown(countdown_state_t *state) {
// Calculate the new state->now_ts but don't update it until we've updated the target -
// avoid possible race where the old target is compared to the new time and immediately triggers
movement_schedule_background_task_for_face(state->watch_face_index, target_dt);
}
-static void auto_repeat(countdown_state_t *state, movement_settings_t *settings) {
+static void auto_repeat(countdown_state_t *state) {
movement_play_alarm();
load_countdown(state);
- schedule_countdown(state, settings);
+ schedule_countdown(state);
}
-static void start(countdown_state_t *state, movement_settings_t *settings) {
+static void start(countdown_state_t *state) {
state->mode = cd_running;
- schedule_countdown(state, settings);
+ schedule_countdown(state);
}
reset(state);
}
-static void times_up(movement_settings_t *settings, countdown_state_t *state) {
+static void times_up(countdown_state_t *state) {
if(state->repeat) {
- auto_repeat(state, settings);
+ auto_repeat(state);
}
else {
ring(state);
return;
}
-void countdown_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void countdown_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
}
}
-void countdown_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void countdown_face_activate(void *context) {
countdown_state_t *state = (countdown_state_t *)context;
if(state->mode == cd_running) {
watch_date_time now = watch_rtc_get_date_time();
quick_ticks_running = false;
}
-bool countdown_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
- (void) settings;
+bool countdown_face_loop(movement_event_t event, void *context) {
countdown_state_t *state = (countdown_state_t *)context;
switch (event.event_type) {
break;
case cd_paused:
reset(state);
- button_beep(settings);
+ button_beep();
break;
case cd_setting:
state->selection++;
state->mode = cd_reset;
store_countdown(state);
movement_request_tick_frequency(1);
- button_beep(settings);
+ button_beep();
}
break;
}
switch(state->mode) {
case cd_running:
pause(state);
- button_beep(settings);
+ button_beep();
break;
case cd_reset:
case cd_paused:
if (!(state->hours == 0 && state->minutes == 0 && state->seconds == 0)) {
// Only start the timer if we have a valid time.
- start(state, settings);
- button_beep(settings);
+ start(state);
+ button_beep();
watch_set_indicator(WATCH_INDICATOR_SIGNAL);
}
break;
// long press in reset mode enters settings
state->mode = cd_setting;
movement_request_tick_frequency(4);
- button_beep(settings);
+ button_beep();
break;
case cd_setting:
// long press in settings mode starts quick ticks for adjusting the time
}
} else {
// Toggle auto-repeat
- button_beep(settings);
+ button_beep();
state->repeat = !state->repeat;
if(state->repeat)
watch_set_indicator(WATCH_INDICATOR_BELL);
abort_quick_ticks(state);
break;
case EVENT_BACKGROUND_TASK:
- times_up(settings, state);
+ times_up(state);
break;
case EVENT_TIMEOUT:
if (state->mode == cd_setting) {
state->mode = cd_reset;
store_countdown(state);
movement_request_tick_frequency(1);
- button_beep(settings);
+ button_beep();
}
break;
case EVENT_LOW_ENERGY_UPDATE:
// intentionally squelch the light default event; we only show the light when cd is running or reset
break;
default:
- movement_default_loop_handler(event, settings);
+ movement_default_loop_handler(event);
break;
}
return true;
}
-void countdown_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void countdown_face_resign(void *context) {
countdown_state_t *state = (countdown_state_t *)context;
if (state->mode == cd_setting) {
state->selection = 0;
} countdown_state_t;
-void countdown_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void countdown_face_activate(movement_settings_t *settings, void *context);
-bool countdown_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void countdown_face_resign(movement_settings_t *settings, void *context);
+void countdown_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void countdown_face_activate(void *context);
+bool countdown_face_loop(movement_event_t event, void *context);
+void countdown_face_resign(void *context);
#define countdown_face ((const watch_face_t){ \
countdown_face_setup, \
"LT blue ", // Light: blue component (for watches with blue LED)
};
-void preferences_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void preferences_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(preferences_state_t));
}
}
-void preferences_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void preferences_face_activate(void *context) {
preferences_state_t *state = (preferences_state_t *)context;
state->current_page = 0;
movement_request_tick_frequency(4); // we need to manually blink some pixels
}
-bool preferences_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool preferences_face_loop(movement_event_t event, void *context) {
preferences_state_t *state = (preferences_state_t *)context;
movement_color_t color; // to use in the switch if we need it
movement_move_to_face(0);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
if (state->current_page == PREFERENCES_PAGE_LED_RED ||
}
}
-void preferences_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void preferences_face_resign(void *context) {
(void) context;
movement_force_led_off();
movement_store_settings();
preferences_page_t current_page;
} preferences_state_t;
-void preferences_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void preferences_face_activate(movement_settings_t *settings, void *context);
-bool preferences_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void preferences_face_resign(movement_settings_t *settings, void *context);
+void preferences_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void preferences_face_activate(void *context);
+bool preferences_face_loop(movement_event_t event, void *context);
+void preferences_face_resign(void *context);
#define preferences_face ((const watch_face_t){ \
preferences_face_setup, \
static bool _quick_ticks_running;
-static void _handle_alarm_button(movement_settings_t *settings, watch_date_time date_time, uint8_t current_page) {
+static void _handle_alarm_button(watch_date_time date_time, uint8_t current_page) {
// handles short or long pressing of the alarm button
switch (current_page) {
}
}
-void set_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
- (void) settings;
+void set_time_face_setup(uint8_t watch_face_index, void ** context_ptr) {
(void) watch_face_index;
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(uint8_t));
}
-void set_time_face_activate(movement_settings_t *settings, void *context) {
- (void) settings;
+void set_time_face_activate(void *context) {
*((uint8_t *)context) = 0;
movement_request_tick_frequency(4);
_quick_ticks_running = false;
}
-bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
+bool set_time_face_loop(movement_event_t event, void *context) {
uint8_t current_page = *((uint8_t *)context);
watch_date_time date_time = watch_rtc_get_date_time();
switch (event.event_type) {
case EVENT_TICK:
if (_quick_ticks_running) {
- if (HAL_GPIO_BTN_ALARM_read()) _handle_alarm_button(settings, date_time, current_page);
+ if (HAL_GPIO_BTN_ALARM_read()) _handle_alarm_button(date_time, current_page);
else _abort_quick_ticks();
}
break;
break;
case EVENT_ALARM_BUTTON_UP:
_abort_quick_ticks();
- _handle_alarm_button(settings, date_time, current_page);
+ _handle_alarm_button(date_time, current_page);
break;
case EVENT_TIMEOUT:
_abort_quick_ticks();
movement_move_to_face(0);
break;
default:
- return movement_default_loop_handler(event, settings);
+ return movement_default_loop_handler(event);
}
char buf[11];
return true;
}
-void set_time_face_resign(movement_settings_t *settings, void *context) {
- (void) settings;
+void set_time_face_resign(void *context) {
(void) context;
watch_set_led_off();
movement_store_settings();
#include "movement.h"
-void set_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
-void set_time_face_activate(movement_settings_t *settings, void *context);
-bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
-void set_time_face_resign(movement_settings_t *settings, void *context);
+void set_time_face_setup(uint8_t watch_face_index, void ** context_ptr);
+void set_time_face_activate(void *context);
+bool set_time_face_loop(movement_event_t event, void *context);
+void set_time_face_resign(void *context);
#define set_time_face ((const watch_face_t){ \
set_time_face_setup, \