diff Discovery/Src/data_exchange_main.c @ 109:65a6e352ce08 FlipDisplay

Consider computer heading in case of a flipped display
author Ideenmodellierer
date Tue, 01 Jan 2019 21:00:55 +0100
parents 8f8ea3a32e82
children 3834b6272ee5
line wrap: on
line diff
--- a/Discovery/Src/data_exchange_main.c	Tue Jan 01 21:00:13 2019 +0100
+++ b/Discovery/Src/data_exchange_main.c	Tue Jan 01 21:00:55 2019 +0100
@@ -913,7 +913,15 @@
 	pStateReal->lifeData.counterSecondsShallowDepth = dataIn.data[dataIn.boolTimeData].counterSecondsShallowDepth;
 	pStateReal->lifeData.surface_time_seconds = (int32_t)dataIn.data[dataIn.boolTimeData].surfacetime_seconds;
 
+
 	pStateReal->lifeData.compass_heading = dataIn.data[dataIn.boolCompassData].compass_heading;
+	if(settingsGetPointer()->FlipDisplay) /* consider that diver is targeting into the opposite direction */
+	{
+		pStateReal->lifeData.compass_heading -= 180.0;
+		if (pStateReal->lifeData.compass_heading < 0) pStateReal->lifeData.compass_heading +=360.0;
+	}
+
+
 	pStateReal->lifeData.compass_roll = dataIn.data[dataIn.boolCompassData].compass_roll;
 	pStateReal->lifeData.compass_pitch = dataIn.data[dataIn.boolCompassData].compass_pitch;