# HG changeset patch # User Ideenmodellierer # Date 1734898481 -3600 # Node ID 96cf6c53c9340d8895a2159a3128ce6b551c3665 # Parent 80ae8ea7f0a0fadb870a84a73e4f5a3e3fcda620 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. diff -r 80ae8ea7f0a0 -r 96cf6c53c934 Small_CPU/Src/GNSS.c --- a/Small_CPU/Src/GNSS.c Sun Dec 22 20:52:08 2024 +0100 +++ b/Small_CPU/Src/GNSS.c Sun Dec 22 21:14:41 2024 +0100 @@ -28,6 +28,7 @@ #include #include "GNSS.h" +#include "data_exchange.h" union u_Short uShort; union i_Short iShort; @@ -56,6 +57,7 @@ GNSS->vAcc = 0; GNSS->gSpeed = 0; GNSS->headMot = 0; + GNSS->alive = 0; } /*! @@ -139,7 +141,22 @@ GNSS->fLat = searchCnt++; } - GNSS->alive = !GNSS->alive; + if(GNSS->alive & GNSS_ALIVE_STATE_ALIVE) /* alive */ + { + GNSS->alive &= !GNSS_ALIVE_STATE_ALIVE; + } + else + { + GNSS->alive |= GNSS_ALIVE_STATE_ALIVE; + } + if((GNSS_Handle.uartWorkingBuffer[17] & 0x03) == 0x03) /* date/time valid */ + { + GNSS->alive |= GNSS_ALIVE_STATE_TIME; + } + else + { + GNSS->alive &= !GNSS_ALIVE_STATE_TIME; + } } /*! diff -r 80ae8ea7f0a0 -r 96cf6c53c934 Small_CPU/Src/gpio.c --- a/Small_CPU/Src/gpio.c Sun Dec 22 20:52:08 2024 +0100 +++ b/Small_CPU/Src/gpio.c Sun Dec 22 21:14:41 2024 +0100 @@ -75,7 +75,7 @@ GPIO_InitStructure.Pull = GPIO_PULLDOWN; GPIO_InitStructure.Speed = GPIO_SPEED_LOW; HAL_GPIO_Init( GPIOB, &GPIO_InitStructure); - HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET); + HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_SET); } void GPIO_Power_MainCPU_Init(void) { diff -r 80ae8ea7f0a0 -r 96cf6c53c934 Small_CPU/Src/scheduler.c --- a/Small_CPU/Src/scheduler.c Sun Dec 22 20:52:08 2024 +0100 +++ b/Small_CPU/Src/scheduler.c Sun Dec 22 21:14:41 2024 +0100 @@ -1109,6 +1109,7 @@ secondsCount = 0; #ifdef ENABLE_GPIO_V2 uint16_t deepSleepCntDwn = 21600; /* 12 hours in 2 second steps */ + uint8_t deepSleep = 0; GPIO_InitTypeDef GPIO_InitStruct; #endif /* prevent button wake up problem while in sleep_prepare @@ -1193,20 +1194,21 @@ deepSleepCntDwn--; if(deepSleepCntDwn == 0) { + deepSleep = 1; GPIO_GPS_OFF(); GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Speed = GPIO_SPEED_LOW; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_POWER_CONTROL_PIN); HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); - uartGnss_SetState(UART_GNSS_INIT); } } else { - if(global.lifeData.battery_voltage < 3.5) /* switch off backup voltage if battery gets low */ + if((deepSleep = 1) && (global.lifeData.battery_voltage < 3.5)) /* switch off backup voltage if battery gets low */ { + deepSleep = 2; GPIO_GPS_BCKP_OFF(); GPIO_InitStruct.Pin = GPIO_PIN_All ^ (GPS_BCKP_CONTROL_PIN); HAL_GPIO_Init( GPIOB, &GPIO_InitStruct); @@ -1223,7 +1225,7 @@ reinitGlobals(); ReInit_battery_charger_status_pins(); #ifdef ENABLE_GPIO_V2 - if(deepSleepCntDwn == 0) + if(deepSleep != 0) { GPIO_GNSS_Init(); } @@ -1793,6 +1795,13 @@ global.dataSendToMaster.data[0].gnssInfo.coord.fLon = GNSS_Handle.fLon; global.dataSendToMaster.data[0].gnssInfo.fixType = GNSS_Handle.fixType; global.dataSendToMaster.data[0].gnssInfo.numSat = GNSS_Handle.numSat; + global.dataSendToMaster.data[0].gnssInfo.DateTime.year = (uint8_t) (GNSS_Handle.year - 2000); + global.dataSendToMaster.data[0].gnssInfo.DateTime.month = GNSS_Handle.month; + global.dataSendToMaster.data[0].gnssInfo.DateTime.day = GNSS_Handle.day; + global.dataSendToMaster.data[0].gnssInfo.DateTime.hour = GNSS_Handle.hour; + global.dataSendToMaster.data[0].gnssInfo.DateTime.min = GNSS_Handle.min; + global.dataSendToMaster.data[0].gnssInfo.DateTime.sec = GNSS_Handle.sec; + global.dataSendToMaster.data[0].gnssInfo.alive = GNSS_Handle.alive; memcpy(&global.dataSendToMaster.data[0].gnssInfo.signalQual,&GNSS_Handle.statSat, sizeof(GNSS_Handle.statSat));