Mercurial > public > ostc4
comparison Small_CPU/Src/scheduler.c @ 947:96cf6c53c934 Evo_2_23
GNSS sleep mode:
Backup voltage is now enabled during initialization. Power saving interval has been changed to 20 second active in a 60 minutes cycle.
author | Ideenmodellierer |
---|---|
date | Sun, 22 Dec 2024 21:14:41 +0100 |
parents | 06aaccaf2e02 |
children | e9c37071933b |
comparison
equal
deleted
inserted
replaced
946:80ae8ea7f0a0 | 947:96cf6c53c934 |
---|---|
1107 global.dataSendToMaster.mode = 0; | 1107 global.dataSendToMaster.mode = 0; |
1108 global.deviceDataSendToMaster.mode = 0; | 1108 global.deviceDataSendToMaster.mode = 0; |
1109 secondsCount = 0; | 1109 secondsCount = 0; |
1110 #ifdef ENABLE_GPIO_V2 | 1110 #ifdef ENABLE_GPIO_V2 |
1111 uint16_t deepSleepCntDwn = 21600; /* 12 hours in 2 second steps */ | 1111 uint16_t deepSleepCntDwn = 21600; /* 12 hours in 2 second steps */ |
1112 uint8_t deepSleep = 0; | |
1112 GPIO_InitTypeDef GPIO_InitStruct; | 1113 GPIO_InitTypeDef GPIO_InitStruct; |
1113 #endif | 1114 #endif |
1114 /* prevent button wake up problem while in sleep_prepare | 1115 /* prevent button wake up problem while in sleep_prepare |
1115 * sleep prepare does I2C_DeInit() | 1116 * sleep prepare does I2C_DeInit() |
1116 */ | 1117 */ |
1191 if(deepSleepCntDwn) | 1192 if(deepSleepCntDwn) |
1192 { | 1193 { |
1193 deepSleepCntDwn--; | 1194 deepSleepCntDwn--; |
1194 if(deepSleepCntDwn == 0) | 1195 if(deepSleepCntDwn == 0) |
1195 { | 1196 { |
1197 deepSleep = 1; | |
1196 GPIO_GPS_OFF(); | 1198 GPIO_GPS_OFF(); |
1197 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; | 1199 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
1198 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | 1200 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; |
1199 GPIO_InitStruct.Pull = GPIO_NOPULL; | 1201 GPIO_InitStruct.Pull = GPIO_NOPULL; |
1200 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_POWER_CONTROL_PIN); | 1202 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_POWER_CONTROL_PIN); |
1201 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); | 1203 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); |
1202 | |
1203 uartGnss_SetState(UART_GNSS_INIT); | 1204 uartGnss_SetState(UART_GNSS_INIT); |
1204 } | 1205 } |
1205 } | 1206 } |
1206 else | 1207 else |
1207 { | 1208 { |
1208 if(global.lifeData.battery_voltage < 3.5) /* switch off backup voltage if battery gets low */ | 1209 if((deepSleep = 1) && (global.lifeData.battery_voltage < 3.5)) /* switch off backup voltage if battery gets low */ |
1209 { | 1210 { |
1211 deepSleep = 2; | |
1210 GPIO_GPS_BCKP_OFF(); | 1212 GPIO_GPS_BCKP_OFF(); |
1211 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_BCKP_CONTROL_PIN); | 1213 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_BCKP_CONTROL_PIN); |
1212 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); | 1214 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); |
1213 __HAL_RCC_GPIOB_CLK_DISABLE(); | 1215 __HAL_RCC_GPIOB_CLK_DISABLE(); |
1214 } | 1216 } |
1221 clearDecoNow = 0; | 1223 clearDecoNow = 0; |
1222 setButtonsNow = 0; | 1224 setButtonsNow = 0; |
1223 reinitGlobals(); | 1225 reinitGlobals(); |
1224 ReInit_battery_charger_status_pins(); | 1226 ReInit_battery_charger_status_pins(); |
1225 #ifdef ENABLE_GPIO_V2 | 1227 #ifdef ENABLE_GPIO_V2 |
1226 if(deepSleepCntDwn == 0) | 1228 if(deepSleep != 0) |
1227 { | 1229 { |
1228 GPIO_GNSS_Init(); | 1230 GPIO_GNSS_Init(); |
1229 } | 1231 } |
1230 #endif | 1232 #endif |
1231 } | 1233 } |
1791 { | 1793 { |
1792 global.dataSendToMaster.data[0].gnssInfo.coord.fLat = GNSS_Handle.fLat; | 1794 global.dataSendToMaster.data[0].gnssInfo.coord.fLat = GNSS_Handle.fLat; |
1793 global.dataSendToMaster.data[0].gnssInfo.coord.fLon = GNSS_Handle.fLon; | 1795 global.dataSendToMaster.data[0].gnssInfo.coord.fLon = GNSS_Handle.fLon; |
1794 global.dataSendToMaster.data[0].gnssInfo.fixType = GNSS_Handle.fixType; | 1796 global.dataSendToMaster.data[0].gnssInfo.fixType = GNSS_Handle.fixType; |
1795 global.dataSendToMaster.data[0].gnssInfo.numSat = GNSS_Handle.numSat; | 1797 global.dataSendToMaster.data[0].gnssInfo.numSat = GNSS_Handle.numSat; |
1798 global.dataSendToMaster.data[0].gnssInfo.DateTime.year = (uint8_t) (GNSS_Handle.year - 2000); | |
1799 global.dataSendToMaster.data[0].gnssInfo.DateTime.month = GNSS_Handle.month; | |
1800 global.dataSendToMaster.data[0].gnssInfo.DateTime.day = GNSS_Handle.day; | |
1801 global.dataSendToMaster.data[0].gnssInfo.DateTime.hour = GNSS_Handle.hour; | |
1802 global.dataSendToMaster.data[0].gnssInfo.DateTime.min = GNSS_Handle.min; | |
1803 global.dataSendToMaster.data[0].gnssInfo.DateTime.sec = GNSS_Handle.sec; | |
1804 | |
1796 global.dataSendToMaster.data[0].gnssInfo.alive = GNSS_Handle.alive; | 1805 global.dataSendToMaster.data[0].gnssInfo.alive = GNSS_Handle.alive; |
1797 | 1806 |
1798 memcpy(&global.dataSendToMaster.data[0].gnssInfo.signalQual,&GNSS_Handle.statSat, sizeof(GNSS_Handle.statSat)); | 1807 memcpy(&global.dataSendToMaster.data[0].gnssInfo.signalQual,&GNSS_Handle.statSat, sizeof(GNSS_Handle.statSat)); |
1799 } | 1808 } |
1800 | 1809 |