diff Small_CPU/Src/baseCPU2.c @ 1000:c386ae6635e4 GasConsumption

Improve GNSS operation: during OSTC 4/5 code merge a problem with the wakeup of the gnss module showed up which has been fixed with the new verion. In addition a compile switch has been added which activated the synchronization of time between OSTC and gnss module. This my cause problems if the time is not accurate => deactivated at the moment.
author Ideenmodellierer
date Mon, 28 Apr 2025 19:51:36 +0200
parents d63584d6428d
children efb7d18cc564
line wrap: on
line diff
--- a/Small_CPU/Src/baseCPU2.c	Mon Apr 28 19:47:41 2025 +0200
+++ b/Small_CPU/Src/baseCPU2.c	Mon Apr 28 19:51:36 2025 +0200
@@ -483,7 +483,10 @@
 
 			MX_SPI3_Init();
 
-#if defined ENABLE_GNSS_INTERN || ENABLE_GNSS_EXTERN
+#if defined ENABLE_GNSS_INTERN || defined ENABLE_GNSS_EXTERN
+
+		do
+		{
 			if(GPIO_GetVersion() > 0)
 			{
 				if(shutdownTick == 0)
@@ -504,16 +507,18 @@
 #endif
 #endif
 #if defined ENABLE_GNSS_INTERN || defined ENABLE_GNSS_EXTERN
-			if((uartGnss_GetState() == UART_GNSS_INACTIVE) || (time_elapsed_ms(shutdownTick,HAL_GetTick()) > 3000))
+			if((uartGnss_GetState() == UART_GNSS_INACTIVE) || (time_elapsed_ms(shutdownTick,HAL_GetTick()) > 4000))
 			{
 				global.mode = MODE_SLEEP;
 				uartGnss_ReqPowerDown(0);	/* release power down request */
+				uartGnss_SetState(UART_GNSS_INACTIVE);
 			}
+
 #else
 			global.mode = MODE_SLEEP;
 #endif
 
-
+		}while (global.mode == MODE_SHUTDOWN);
 			break;
 
 		case MODE_SLEEP:
@@ -549,6 +554,8 @@
 				externalInterface_SwitchPower33(true);
 			}
 			externalInterface_InitDatastruct();
+			MX_USART6_UART_Init();
+			GNSS_Init(&GNSS_Handle, &huart6);
 			// EXTILine0_Button_DeInit(); not now, later after testing
 			break;
 		}