Mercurial > public > ostc4
comparison Small_CPU/Src/scheduler.c @ 936:3029f0332f4f Evo_2_23
GNSS introduced power saving mode:
In the previous implementation the modul always did a cold start. In the new one the power saving functions of the module are activated. The module will be switched to intervall mode while entering sleep. If the computer remains in sleep for a long time then the GNSS modul will be switchen of completly.
author | Ideenmodellierer |
---|---|
date | Sun, 08 Dec 2024 22:03:07 +0100 |
parents | effadaa3a1f7 |
children | d461d9e89e3c |
comparison
equal
deleted
inserted
replaced
935:f2494a708f52 | 936:3029f0332f4f |
---|---|
35 #include "batteryCharger.h" | 35 #include "batteryCharger.h" |
36 #include "spi.h" | 36 #include "spi.h" |
37 #include "rtc.h" | 37 #include "rtc.h" |
38 #include "dma.h" | 38 #include "dma.h" |
39 #include "adc.h" | 39 #include "adc.h" |
40 #include "gpio.h" | |
40 #include "calc_crush.h" | 41 #include "calc_crush.h" |
41 #include "stm32f4xx_hal_rtc_ex.h" | 42 #include "stm32f4xx_hal_rtc_ex.h" |
42 #include "decom.h" | 43 #include "decom.h" |
43 #include "tm_stm32f4_otp.h" | 44 #include "tm_stm32f4_otp.h" |
44 #include "externalInterface.h" | 45 #include "externalInterface.h" |
1098 void scheduleSleepMode(void) | 1099 void scheduleSleepMode(void) |
1099 { | 1100 { |
1100 global.dataSendToMaster.mode = 0; | 1101 global.dataSendToMaster.mode = 0; |
1101 global.deviceDataSendToMaster.mode = 0; | 1102 global.deviceDataSendToMaster.mode = 0; |
1102 secondsCount = 0; | 1103 secondsCount = 0; |
1103 | 1104 #ifdef ENABLE_GPIO_V2 |
1105 uint16_t deepSleepCntDwn = 21600; /* 12 hours in 2 second steps */ | |
1106 GPIO_InitTypeDef GPIO_InitStruct; | |
1107 #endif | |
1104 /* prevent button wake up problem while in sleep_prepare | 1108 /* prevent button wake up problem while in sleep_prepare |
1105 * sleep prepare does I2C_DeInit() | 1109 * sleep prepare does I2C_DeInit() |
1106 */ | 1110 */ |
1107 if(global.mode != MODE_SLEEP) | 1111 if(global.mode != MODE_SLEEP) |
1108 MX_I2C1_Init(); | 1112 MX_I2C1_Init(); |
1177 || (global.lifeData.pressure_ambient_bar > START_DIVE_IMMEDIATLY_BAR)) | 1181 || (global.lifeData.pressure_ambient_bar > START_DIVE_IMMEDIATLY_BAR)) |
1178 { | 1182 { |
1179 global.mode = MODE_BOOT; | 1183 global.mode = MODE_BOOT; |
1180 } | 1184 } |
1181 scheduleUpdateLifeData(2000); | 1185 scheduleUpdateLifeData(2000); |
1186 #ifdef ENABLE_GPIO_V2 | |
1187 if(deepSleepCntDwn) | |
1188 { | |
1189 deepSleepCntDwn--; | |
1190 if(deepSleepCntDwn == 0) | |
1191 { | |
1192 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; | |
1193 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
1194 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
1195 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_POWER_CONTROL_PIN | GPS_BCKP_CONTROL_PIN); | |
1196 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); | |
1197 GPIO_GPS_OFF(); | |
1198 uartGnss_SetState(UART_GNSS_INIT); | |
1199 } | |
1200 } | |
1201 #endif | |
1182 } | 1202 } |
1183 while(global.mode == MODE_SLEEP); | 1203 while(global.mode == MODE_SLEEP); |
1184 /* new section for system after Standby */ | 1204 /* new section for system after Standby */ |
1185 scheduleUpdateLifeData(-1); | 1205 scheduleUpdateLifeData(-1); |
1186 clearDecoNow = 0; | 1206 clearDecoNow = 0; |