Revert PR #387 - fixes LE state restoration
This commit caused state restored from backup registers to be overwritten. It is thereby reverted until a better solution is found or movement is refactored. This reverts commit 524098b9258232964d7756d4d44f16b006d340bf. Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com> References: https://github.com/joeycastillo/Sensor-Watch/pull/474
This commit is contained in:
parent
673f90b724
commit
be969c4deb
@ -106,31 +106,6 @@ of debounce time.
|
|||||||
#define MOVEMENT_DEFAULT_LED_DURATION 1
|
#define MOVEMENT_DEFAULT_LED_DURATION 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Default to no set location latitude
|
|
||||||
#ifndef MOVEMENT_DEFAULT_LATITUDE
|
|
||||||
#define MOVEMENT_DEFAULT_LATITUDE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Default to no set location longitude
|
|
||||||
#ifndef MOVEMENT_DEFAULT_LONGITUDE
|
|
||||||
#define MOVEMENT_DEFAULT_LONGITUDE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Default to no set birthdate year
|
|
||||||
#ifndef MOVEMENT_DEFAULT_BIRTHDATE_YEAR
|
|
||||||
#define MOVEMENT_DEFAULT_BIRTHDATE_YEAR 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Default to no set birthdate month
|
|
||||||
#ifndef MOVEMENT_DEFAULT_BIRTHDATE_MONTH
|
|
||||||
#define MOVEMENT_DEFAULT_BIRTHDATE_MONTH 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Default to no set birthdate day
|
|
||||||
#ifndef MOVEMENT_DEFAULT_BIRTHDATE_DAY
|
|
||||||
#define MOVEMENT_DEFAULT_BIRTHDATE_DAY 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Default to having DST get set
|
// Default to having DST get set
|
||||||
#ifndef MOVEMENT_DEFAULT_DST_ACTIVE
|
#ifndef MOVEMENT_DEFAULT_DST_ACTIVE
|
||||||
#define MOVEMENT_DEFAULT_DST_ACTIVE true
|
#define MOVEMENT_DEFAULT_DST_ACTIVE true
|
||||||
@ -541,11 +516,6 @@ void app_init(void) {
|
|||||||
movement_state.settings.bit.to_interval = MOVEMENT_DEFAULT_TIMEOUT_INTERVAL;
|
movement_state.settings.bit.to_interval = MOVEMENT_DEFAULT_TIMEOUT_INTERVAL;
|
||||||
movement_state.settings.bit.le_interval = MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL;
|
movement_state.settings.bit.le_interval = MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL;
|
||||||
movement_state.settings.bit.led_duration = MOVEMENT_DEFAULT_LED_DURATION;
|
movement_state.settings.bit.led_duration = MOVEMENT_DEFAULT_LED_DURATION;
|
||||||
movement_state.location.bit.latitude = MOVEMENT_DEFAULT_LATITUDE;
|
|
||||||
movement_state.location.bit.longitude = MOVEMENT_DEFAULT_LONGITUDE;
|
|
||||||
movement_state.birthdate.bit.year = MOVEMENT_DEFAULT_BIRTHDATE_YEAR;
|
|
||||||
movement_state.birthdate.bit.month = MOVEMENT_DEFAULT_BIRTHDATE_MONTH;
|
|
||||||
movement_state.birthdate.bit.day = MOVEMENT_DEFAULT_BIRTHDATE_DAY;
|
|
||||||
movement_state.settings.bit.dst_active = MOVEMENT_DEFAULT_DST_ACTIVE;
|
movement_state.settings.bit.dst_active = MOVEMENT_DEFAULT_DST_ACTIVE;
|
||||||
|
|
||||||
#ifdef MAKEFILE_TIMEZONE
|
#ifdef MAKEFILE_TIMEZONE
|
||||||
@ -584,14 +554,10 @@ void app_init(void) {
|
|||||||
|
|
||||||
void app_wake_from_backup(void) {
|
void app_wake_from_backup(void) {
|
||||||
movement_state.settings.reg = watch_get_backup_data(0);
|
movement_state.settings.reg = watch_get_backup_data(0);
|
||||||
movement_state.location.reg = watch_get_backup_data(1);
|
|
||||||
movement_state.birthdate.reg = watch_get_backup_data(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_setup(void) {
|
void app_setup(void) {
|
||||||
watch_store_backup_data(movement_state.settings.reg, 0);
|
watch_store_backup_data(movement_state.settings.reg, 0);
|
||||||
watch_store_backup_data(movement_state.location.reg, 1);
|
|
||||||
watch_store_backup_data(movement_state.birthdate.reg, 2);
|
|
||||||
|
|
||||||
static bool is_first_launch = true;
|
static bool is_first_launch = true;
|
||||||
|
|
||||||
|
@ -245,8 +245,6 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
// properties stored in BACKUP register
|
// properties stored in BACKUP register
|
||||||
movement_settings_t settings;
|
movement_settings_t settings;
|
||||||
movement_location_t location;
|
|
||||||
movement_birthdate_t birthdate;
|
|
||||||
|
|
||||||
// transient properties
|
// transient properties
|
||||||
int16_t current_face_idx;
|
int16_t current_face_idx;
|
||||||
|
@ -76,15 +76,15 @@ const watch_face_t watch_faces[] = {
|
|||||||
/* Set the timeout before switching to low energy mode
|
/* Set the timeout before switching to low energy mode
|
||||||
* Valid values are:
|
* Valid values are:
|
||||||
* 0: Never
|
* 0: Never
|
||||||
* 1: 10 mins
|
* 1: 1 hour
|
||||||
* 2: 1 hour
|
* 2: 2 hours
|
||||||
* 3: 2 hours
|
* 3: 6 hours
|
||||||
* 4: 6 hours
|
* 4: 12 hours
|
||||||
* 5: 12 hours
|
* 5: 1 day
|
||||||
* 6: 1 day
|
* 6: 2 days
|
||||||
* 7: 7 days
|
* 7: 7 days
|
||||||
*/
|
*/
|
||||||
#define MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL 2
|
#define MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL 1
|
||||||
|
|
||||||
/* Set the led duration
|
/* Set the led duration
|
||||||
* Valid values are:
|
* Valid values are:
|
||||||
@ -95,22 +95,6 @@ const watch_face_t watch_faces[] = {
|
|||||||
*/
|
*/
|
||||||
#define MOVEMENT_DEFAULT_LED_DURATION 1
|
#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
|
|
||||||
|
|
||||||
/* The wearers birthdate
|
|
||||||
* Valid values:
|
|
||||||
* Year: 1 - 4095
|
|
||||||
* Month: 1 - 12
|
|
||||||
* Day: 1 - 31
|
|
||||||
*/
|
|
||||||
#define MOVEMENT_DEFAULT_BIRTHDATE_YEAR 0
|
|
||||||
#define MOVEMENT_DEFAULT_BIRTHDATE_MONTH 0
|
|
||||||
#define MOVEMENT_DEFAULT_BIRTHDATE_DAY 0
|
|
||||||
|
|
||||||
/* Set if using DST
|
/* Set if using DST
|
||||||
* Valid values are:
|
* Valid values are:
|
||||||
* false: Don't allow the watch to use DST
|
* false: Don't allow the watch to use DST
|
||||||
|
Loading…
x
Reference in New Issue
Block a user