Mercurial > public > ostc4
comparison Small_CPU/Src/scheduler.c @ 414:6886aeeca454 Improment_NVM
Added compile switch for restoring of last known date after power lost:
In case timing date was lost the RTC has to be set to a proper time anyhow. Maybe this function does not add as much value as expected... => Added compile switch (deactivated) to allow easy reactivation if this function is wanted.
author | ideenmodellierer |
---|---|
date | Tue, 14 Jan 2020 21:38:45 +0100 |
parents | 2e2d34c1cc99 |
children | 4b000e2386c2 |
comparison
equal
deleted
inserted
replaced
413:65c7b009136f | 414:6886aeeca454 |
---|---|
40 #include "calc_crush.h" | 40 #include "calc_crush.h" |
41 #include "stm32f4xx_hal_rtc_ex.h" | 41 #include "stm32f4xx_hal_rtc_ex.h" |
42 #include "decom.h" | 42 #include "decom.h" |
43 #include "tm_stm32f4_otp.h" | 43 #include "tm_stm32f4_otp.h" |
44 | 44 |
45 /* uncomment to enable restoting of last known date in case of a power loss (RTC looses timing data) */ | |
46 /* #define RESTORE_LAST_KNOWN_DATE */ | |
45 | 47 |
46 #define INVALID_PREASURE_VALUE (100.0f) | 48 #define INVALID_PREASURE_VALUE (100.0f) |
47 #define START_DIVE_MOUNTAIN_MODE_BAR (0.88f) | 49 #define START_DIVE_MOUNTAIN_MODE_BAR (0.88f) |
48 #define START_DIVE_IMMEDIATLY_BAR (1.16f) | 50 #define START_DIVE_IMMEDIATLY_BAR (1.16f) |
49 | 51 |
1243 { | 1245 { |
1244 /* max values */ | 1246 /* max values */ |
1245 if(global.deviceData.hoursOfOperation.value_int32 < DeviceDataFlash.hoursOfOperation.value_int32) | 1247 if(global.deviceData.hoursOfOperation.value_int32 < DeviceDataFlash.hoursOfOperation.value_int32) |
1246 { | 1248 { |
1247 scheduleCopyDeviceData(&global.deviceData.hoursOfOperation, &DeviceDataFlash.hoursOfOperation); | 1249 scheduleCopyDeviceData(&global.deviceData.hoursOfOperation, &DeviceDataFlash.hoursOfOperation); |
1250 #ifdef RESTORE_LAST_KNOWN_DATE | |
1248 scheduleCheckDate(); | 1251 scheduleCheckDate(); |
1252 #endif | |
1249 } | 1253 } |
1250 if(global.deviceData.batteryChargeCompleteCycles.value_int32 < DeviceDataFlash.batteryChargeCompleteCycles.value_int32) | 1254 if(global.deviceData.batteryChargeCompleteCycles.value_int32 < DeviceDataFlash.batteryChargeCompleteCycles.value_int32) |
1251 { | 1255 { |
1252 scheduleCopyDeviceData(&global.deviceData.batteryChargeCompleteCycles, &DeviceDataFlash.batteryChargeCompleteCycles); | 1256 scheduleCopyDeviceData(&global.deviceData.batteryChargeCompleteCycles, &DeviceDataFlash.batteryChargeCompleteCycles); |
1253 } | 1257 } |