diff Discovery/Src/tMenuEditHardware.c @ 709:c799151670d5

Bugfix compass bearing: In previous version an invalid value was set in case the bearing was set without compass calibration. Rootcause was that the bearing -1 is received in case the compase is not calibrated. This has been fixed by setting bearing to 0 (360) in that case.
author Ideenmodellierer
date Tue, 08 Nov 2022 21:13:14 +0100
parents 7e3bf2c0cd40
children b9f699d2e3d0
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditHardware.c	Thu Nov 03 20:44:51 2022 +0100
+++ b/Discovery/Src/tMenuEditHardware.c	Tue Nov 08 21:13:14 2022 +0100
@@ -241,7 +241,15 @@
 
 uint8_t OnAction_Bearing	(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
 {
-    settingsGetPointer()->compassBearing = (int16_t)stateUsed->lifeData.compass_heading;
+    if((int16_t)stateUsed->lifeData.compass_heading != -1)
+	{
+		settingsGetPointer()->compassBearing = (int16_t)stateUsed->lifeData.compass_heading;
+	}
+	else
+	{
+		settingsGetPointer()->compassBearing = 0;
+	}
+
     if(settingsGetPointer()->compassBearing == 0)
         settingsGetPointer()->compassBearing = 360;
     return UPDATE_AND_EXIT_TO_MENU;