comparison Small_CPU/Src/scheduler.c @ 942:06aaccaf2e02 Evo_2_23

Power down gnss module during dive: The gnss modul will now be send to powerdown at the start of the dive. After end of dive the module returns to normal operation. For development / test purpose a new simulated dive profile has been added.
author Ideenmodellierer
date Mon, 16 Dec 2024 19:09:00 +0100
parents 4a406e873a95
children 96cf6c53c934
comparison
equal deleted inserted replaced
941:6d8ae8fbccf5 942:06aaccaf2e02
167 global.dataSendToMaster.footer.checkCode[2] = 0xE3; 167 global.dataSendToMaster.footer.checkCode[2] = 0xE3;
168 global.dataSendToMaster.footer.checkCode[1] = 0xE2; 168 global.dataSendToMaster.footer.checkCode[1] = 0xE2;
169 global.dataSendToMaster.footer.checkCode[0] = 0xE1; 169 global.dataSendToMaster.footer.checkCode[0] = 0xE1;
170 global.dataSendToMaster.sensorErrors = 0; 170 global.dataSendToMaster.sensorErrors = 0;
171 171
172 global.dataSendToMaster.data[0].gnssInfo.coord.fLat = 0.0;
173 global.dataSendToMaster.data[0].gnssInfo.coord.fLon = 0.0;
174 global.dataSendToMaster.data[0].gnssInfo.fixType = 0;
175 global.dataSendToMaster.data[0].gnssInfo.numSat = 0;
176
172 global.sync_error_count = 0; 177 global.sync_error_count = 0;
173 global.check_sync_not_running = 0; 178 global.check_sync_not_running = 0;
174 179
175 global.deviceDataSendToMaster.RTE_VERSION_high = firmwareVersionHigh();//RTE_VERSION_HIGH; 180 global.deviceDataSendToMaster.RTE_VERSION_high = firmwareVersionHigh();//RTE_VERSION_HIGH;
176 global.deviceDataSendToMaster.RTE_VERSION_low = firmwareVersionLow();//RTE_VERSION_LOW; 181 global.deviceDataSendToMaster.RTE_VERSION_low = firmwareVersionLow();//RTE_VERSION_LOW;
523 { 528 {
524 lasttick = HAL_GetTick(); 529 lasttick = HAL_GetTick();
525 ticksdiff = time_elapsed_ms(Scheduler.tickstart,lasttick); 530 ticksdiff = time_elapsed_ms(Scheduler.tickstart,lasttick);
526 531
527 externalInterface_HandleUART(); 532 externalInterface_HandleUART();
533 #ifdef ENABLE_GPIO_V2
534 UART6_HandleUART();
535 #endif
528 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) 536 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10)
529 { 537 {
530 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */ 538 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */
531 { 539 {
532 Scheduler.counterSPIdata100msec++; 540 Scheduler.counterSPIdata100msec++;
1117 HAL_Delay(2000); 1125 HAL_Delay(2000);
1118 #else 1126 #else
1119 RTC_StopMode_2seconds(); 1127 RTC_StopMode_2seconds();
1120 #endif 1128 #endif
1121 1129
1122
1123
1124 if(global.mode == MODE_SLEEP) 1130 if(global.mode == MODE_SLEEP)
1125 secondsCount += 2; 1131 secondsCount += 2;
1126 1132
1127 externalInterface_InitPower33(); 1133 externalInterface_InitPower33();
1128 MX_I2C1_Init(); 1134 MX_I2C1_Init();
1189 { 1195 {
1190 GPIO_GPS_OFF(); 1196 GPIO_GPS_OFF();
1191 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 1197 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
1192 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; 1198 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
1193 GPIO_InitStruct.Pull = GPIO_NOPULL; 1199 GPIO_InitStruct.Pull = GPIO_NOPULL;
1194 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_POWER_CONTROL_PIN | GPS_BCKP_CONTROL_PIN); 1200 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_POWER_CONTROL_PIN);
1201 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct);
1202
1203 uartGnss_SetState(UART_GNSS_INIT);
1204 }
1205 }
1206 else
1207 {
1208 if(global.lifeData.battery_voltage < 3.5) /* switch off backup voltage if battery gets low */
1209 {
1210 GPIO_GPS_BCKP_OFF();
1211 GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_BCKP_CONTROL_PIN);
1195 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); 1212 HAL_GPIO_Init( GPIOB, &GPIO_InitStruct);
1196 __HAL_RCC_GPIOB_CLK_DISABLE(); 1213 __HAL_RCC_GPIOB_CLK_DISABLE();
1197 uartGnss_SetState(UART_GNSS_INIT);
1198 } 1214 }
1199 } 1215 }
1200 #endif 1216 #endif
1201 } 1217 }
1202 while(global.mode == MODE_SLEEP); 1218 while(global.mode == MODE_SLEEP);
1204 scheduleUpdateLifeData(-1); 1220 scheduleUpdateLifeData(-1);
1205 clearDecoNow = 0; 1221 clearDecoNow = 0;
1206 setButtonsNow = 0; 1222 setButtonsNow = 0;
1207 reinitGlobals(); 1223 reinitGlobals();
1208 ReInit_battery_charger_status_pins(); 1224 ReInit_battery_charger_status_pins();
1209 1225 #ifdef ENABLE_GPIO_V2
1210 if(deepSleepCntDwn == 0) 1226 if(deepSleepCntDwn == 0)
1211 { 1227 {
1212 GPIO_GNSS_Init(); 1228 GPIO_GNSS_Init();
1213 } 1229 }
1230 #endif
1214 } 1231 }
1215 1232
1216 1233
1217 1234
1218 /* Private functions ---------------------------------------------------------*/ 1235 /* Private functions ---------------------------------------------------------*/
1770 global.dataSendToMaster.boolADCO2Data |= boolCO2Buffer; 1787 global.dataSendToMaster.boolADCO2Data |= boolCO2Buffer;
1771 } 1788 }
1772 1789
1773 void copyGNSSdata(void) 1790 void copyGNSSdata(void)
1774 { 1791 {
1775 global.dataSendToMaster.data[0].gnssInfo.fLat = GNSS_Handle.fLat; 1792 global.dataSendToMaster.data[0].gnssInfo.coord.fLat = GNSS_Handle.fLat;
1776 global.dataSendToMaster.data[0].gnssInfo.fLon = GNSS_Handle.fLon; 1793 global.dataSendToMaster.data[0].gnssInfo.coord.fLon = GNSS_Handle.fLon;
1777 global.dataSendToMaster.data[0].gnssInfo.fixType = GNSS_Handle.fixType; 1794 global.dataSendToMaster.data[0].gnssInfo.fixType = GNSS_Handle.fixType;
1778 global.dataSendToMaster.data[0].gnssInfo.numSat = GNSS_Handle.numSat; 1795 global.dataSendToMaster.data[0].gnssInfo.numSat = GNSS_Handle.numSat;
1779 global.dataSendToMaster.data[0].gnssInfo.alive = GNSS_Handle.alive; 1796 global.dataSendToMaster.data[0].gnssInfo.alive = GNSS_Handle.alive;
1780 1797
1781 memcpy(&global.dataSendToMaster.data[0].gnssInfo.signalQual,&GNSS_Handle.statSat, sizeof(GNSS_Handle.statSat)); 1798 memcpy(&global.dataSendToMaster.data[0].gnssInfo.signalQual,&GNSS_Handle.statSat, sizeof(GNSS_Handle.statSat));