changeset 109:65a6e352ce08 FlipDisplay

Consider computer heading in case of a flipped display
author Ideenmodellierer
date Tue, 01 Jan 2019 21:00:55 +0100
parents f561c79b0546
children cc8e24374b83
files Discovery/Src/data_exchange_main.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
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;