diff Small_CPU/Src/GNSS.c @ 931:5a9bc2e6112d Evo_2_23

Added Sat Status Overview: In addition to the navigation data now information regarding the satelliete and signal status are visualized. To enable the a new command has been added to the communication protocol and the position view has been extended.
author Ideenmodellierer
date Tue, 03 Dec 2024 20:32:51 +0100
parents c0553dd70608
children effadaa3a1f7
line wrap: on
line diff
--- a/Small_CPU/Src/GNSS.c	Tue Dec 03 20:24:06 2024 +0100
+++ b/Small_CPU/Src/GNSS.c	Tue Dec 03 20:32:51 2024 +0100
@@ -26,6 +26,7 @@
  ******************************************************************************
  */
 
+#include <string.h>
 #include "GNSS.h"
 
 union u_Short uShort;
@@ -241,6 +242,55 @@
  * Look at: 32.17.30.1 u-blox 8 Receiver description.
  * @param GNSS Pointer to main GNSS structure.
  */
+void GNSS_ParseNavSatData(GNSS_StateHandle *GNSS) {
+
+	uint8_t loop = 0;
+	uint8_t searchIndex = 0;
+	uint8_t statIndex = 0;	/* only 4 state information will be forwarded */
+	uint8_t signalQuality = 0;
+	GNSS->numSat = GNSS_Handle.uartWorkingBuffer[11];
+
+	memset(GNSS->statSat, 0, sizeof(GNSS->statSat));
+
+	if(GNSS->numSat > 0)
+	{
+		searchIndex = 0;
+		while((searchIndex < GNSS->numSat) && (statIndex < 4))	/* get good signal quality */
+		{
+			signalQuality = (GNSS_Handle.uartWorkingBuffer[22 + searchIndex * 12] & 0x7);
+			if(signalQuality > 4)
+			{
+				GNSS->statSat[statIndex++] = signalQuality;
+			}
+			if(statIndex == 4) break;
+			searchIndex++;
+		}
+		searchIndex = 0;
+		while((searchIndex < GNSS->numSat) && (statIndex < 4))	/* get medium signal quality */
+		{
+			signalQuality = (GNSS_Handle.uartWorkingBuffer[22 + searchIndex * 12] & 0x7);
+			if((signalQuality > 2) && (signalQuality <= 4))
+			{
+				GNSS->statSat[statIndex++] = signalQuality;
+			}
+			if(statIndex == 4) break;
+			searchIndex++;
+		}
+		searchIndex = 0;
+		while((searchIndex < GNSS->numSat) && (statIndex < 4))	/* get poor signal quality */
+		{
+			signalQuality = (GNSS_Handle.uartWorkingBuffer[22 + searchIndex * 12] & 0x7);
+			if(signalQuality <= 2)
+			{
+				GNSS->statSat[statIndex++] = signalQuality;
+			}
+			if(statIndex == 4) break;
+			searchIndex++;
+		}
+		loop++;
+	}
+}
+
 void GNSS_ParseNavigatorData(GNSS_StateHandle *GNSS) {
 	uShort.bytes[0] = GNSS_Handle.uartWorkingBuffer[18];
 	uShort.bytes[1] = GNSS_Handle.uartWorkingBuffer[19];
@@ -252,6 +302,7 @@
 	GNSS->sec = GNSS_Handle.uartWorkingBuffer[24];
 }
 
+
 /*!
  * Parse data to geodetic position solution standard.
  * Look at: 32.17.14.1 u-blox 8 Receiver description.