refactor: watch faces no longer need a pointer to settings!

This commit is contained in:
joeycastillo
2024-09-29 09:59:49 -04:00
parent 3bd8f8d51f
commit e88359d1d5
201 changed files with 1180 additions and 1553 deletions

View File

@@ -27,10 +27,9 @@
#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) {
@@ -39,9 +38,8 @@ void hello_there_face_setup(movement_settings_t *settings, uint8_t watch_face_in
}
}
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',
@@ -50,8 +48,7 @@ void hello_there_face_activate(movement_settings_t *settings, void *context) {
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) {
@@ -87,16 +84,15 @@ bool hello_there_face_loop(movement_event_t event, movement_settings_t *settings
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;
}