mirror of
https://github.com/joeycastillo/second-movement.git
synced 2026-02-05 03:25:50 +00:00
Added default location
This commit is contained in:
16
movement.c
16
movement.c
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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_
|
||||
|
||||
Reference in New Issue
Block a user