changeset 940:4a406e873a95 Evo_2_23

GNSS improvments: - Introduce alive indicator; Status string will switch between white and grey with every message received from the module - shorten visibility of "shutting down" string. a busy wait of 1 second was applied in the sleep prepare function. The time is now included in the time needed to prepare the module for low power operation - make sure GPIO is properly initialized after deep sleep
author Ideenmodellierer
date Thu, 12 Dec 2024 21:12:07 +0100
parents f41974734268
children 6d8ae8fbccf5
files Common/Inc/data_central.h Discovery/Src/t7.c Small_CPU/Inc/GNSS.h Small_CPU/Src/GNSS.c Small_CPU/Src/baseCPU2.c Small_CPU/Src/scheduler.c
diffstat 6 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/data_central.h	Tue Dec 10 21:03:04 2024 +0100
+++ b/Common/Inc/data_central.h	Thu Dec 12 21:12:07 2024 +0100
@@ -169,6 +169,7 @@
 {
 	float fLat;
 	float fLon;
+	uint8_t alive;
 	uint8_t fixType;
 	uint8_t numSat;			/* number of available satellites */
 	uint8_t signalQual[4];	/* signal quality indicator for x sats */
--- a/Discovery/Src/t7.c	Tue Dec 10 21:03:04 2024 +0100
+++ b/Discovery/Src/t7.c	Thu Dec 12 21:12:07 2024 +0100
@@ -4046,7 +4046,14 @@
     if(stateUsed->lifeData.gnssData.fixType < 2)
     {
     	textpointer += snprintf(&text[textpointer],50,"\001Satellites\n\r");
-    	textpointer += snprintf(&text[textpointer],50,"\001Status\n\r");
+    	if(stateUsed->lifeData.gnssData.alive)
+    	{
+    		textpointer += snprintf(&text[textpointer],50,"\001\020Status\n\r");
+    	}
+    	else
+    	{
+    		textpointer += snprintf(&text[textpointer],50,"\001\021Status\n\r");
+    	}
     }
     else
     {
--- a/Small_CPU/Inc/GNSS.h	Tue Dec 10 21:03:04 2024 +0100
+++ b/Small_CPU/Inc/GNSS.h	Thu Dec 12 21:12:07 2024 +0100
@@ -91,6 +91,8 @@
 	uint8_t numSat;
 	uint8_t statSat[4];
 
+	uint8_t alive;
+
 }GNSS_StateHandle;
 
 GNSS_StateHandle GNSS_Handle;
--- a/Small_CPU/Src/GNSS.c	Tue Dec 10 21:03:04 2024 +0100
+++ b/Small_CPU/Src/GNSS.c	Thu Dec 12 21:12:07 2024 +0100
@@ -138,6 +138,8 @@
 	{
 		GNSS->fLat = searchCnt++;
 	}
+
+	GNSS->alive = !GNSS->alive;
 }
 
 /*!
--- a/Small_CPU/Src/baseCPU2.c	Tue Dec 10 21:03:04 2024 +0100
+++ b/Small_CPU/Src/baseCPU2.c	Thu Dec 12 21:12:07 2024 +0100
@@ -505,7 +505,7 @@
 #else
 			UART6_HandleUART();
 #endif
-			if((uartGnss_GetState() == UART_GNSS_INACTIVE) || (time_elapsed_ms(shutdownTick,HAL_GetTick()) > 5000))
+			if((uartGnss_GetState() == UART_GNSS_INACTIVE) || (time_elapsed_ms(shutdownTick,HAL_GetTick()) > 3000))
 			{
 				global.mode = MODE_SLEEP;
 				uartGnss_ReqPowerDown(0);	/* release power down request */
@@ -526,6 +526,11 @@
 			GPIO_LEDs_VIBRATION_Init();
 			sleep_prepare();
 
+			while(time_elapsed_ms(shutdownTick,HAL_GetTick()) < 1000 )	/* delay shutdown till shutdown animation is finished */
+			{
+				HAL_Delay(10);
+			}
+			shutdownTick = 0;
 			scheduleSleepMode();
 			if (hasExternalClock())
 				SystemClock_Config_HSE();
@@ -934,8 +939,6 @@
 */
 #endif
 	__HAL_RCC_GPIOH_CLK_DISABLE();
-
-	HAL_Delay(1000);
 }
 
 /*
--- a/Small_CPU/Src/scheduler.c	Tue Dec 10 21:03:04 2024 +0100
+++ b/Small_CPU/Src/scheduler.c	Thu Dec 12 21:12:07 2024 +0100
@@ -1206,6 +1206,11 @@
 	setButtonsNow = 0;
 	reinitGlobals();
 	ReInit_battery_charger_status_pins();
+
+	if(deepSleepCntDwn == 0)
+	{
+		GPIO_GNSS_Init();
+	}
 }
 
 
@@ -1771,6 +1776,8 @@
 	global.dataSendToMaster.data[0].gnssInfo.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.alive = GNSS_Handle.alive;
+
 	memcpy(&global.dataSendToMaster.data[0].gnssInfo.signalQual,&GNSS_Handle.statSat, sizeof(GNSS_Handle.statSat));
 }