Added default location

This commit is contained in:
David Volovskiy
2025-07-05 16:20:19 -04:00
parent 15217b5716
commit c24f69450f
2 changed files with 22 additions and 0 deletions

View File

@ -203,6 +203,15 @@ static void _movement_handle_scheduled_tasks(void) {
}
}
static void movement_set_location_to_filesystem(movement_location_t new_location) {
movement_location_t maybe_location = {0};
filesystem_read_file("location.u32", (char *) &maybe_location.reg, sizeof(movement_location_t));
if (new_location.reg != maybe_location.reg) {
filesystem_write_file("location.u32", (char *) &new_location.reg, sizeof(movement_location_t));
}
}
void movement_request_tick_frequency(uint8_t freq) {
// Movement uses the 128 Hz tick internally
if (freq == 128) return;
@ -661,6 +670,13 @@ void app_init(void) {
#endif
movement_state.settings.bit.led_duration = MOVEMENT_DEFAULT_LED_DURATION;
#if defined(MOVEMENT_DEFAULT_LATITUDE) && defined(MOVEMENT_DEFAULT_LONGITUDE)
movement_set_location_to_filesystem((movement_location_t){
.bit.latitude = MOVEMENT_DEFAULT_LATITUDE,
.bit.longitude = MOVEMENT_DEFAULT_LONGITUDE
});
#endif
movement_store_settings();
}

View File

@ -100,4 +100,10 @@ const watch_face_t watch_faces[] = {
*/
#define MOVEMENT_DEFAULT_LED_DURATION 1
/* The latitude and longitude used for the wearers location
* Set signed values in 1/100ths of a degree
*/
#define MOVEMENT_DEFAULT_LATITUDE 0
#define MOVEMENT_DEFAULT_LONGITUDE 0
#endif // MOVEMENT_CONFIG_H_