changeset 546:daa8d4474ba0

Added new settings for Viewport: A parameter for enabling/disabling is needed as well as the angle values used to define the viewport
author Ideenmodellierer
date Mon, 02 Nov 2020 21:15:42 +0100
parents e595d2d1f77f
children 12f8745c8a94
files Common/Inc/settings.h Discovery/Src/settings.c
diffstat 2 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/settings.h	Tue Nov 03 12:47:51 2020 +0100
+++ b/Common/Inc/settings.h	Mon Nov 02 21:15:42 2020 +0100
@@ -70,6 +70,8 @@
 
 #define MAX_COMPASS_COMP (2u)
 
+#define MAX_VIEWPORT_MODE (2u)
+
 /*	2015 Jan 30, hw, deco and travel added for MenuEditGas
 	* can be used for buehlmann, vpm, etc. later but be carefull
 	*	with current implemenation */
@@ -228,6 +230,11 @@
 	/* new in 0xFFFF001C */
 	uint8_t compassInertia;
 	uint8_t tX_customViewPrimaryBF;
+	/* new in 0xFFFF001D */
+	uint8_t  viewPortMode;
+	uint16_t viewRoll;
+	uint16_t viewPitch;
+	uint16_t viewYaw;
 } SSettings;
 
 typedef struct
--- a/Discovery/Src/settings.c	Tue Nov 03 12:47:51 2020 +0100
+++ b/Discovery/Src/settings.c	Mon Nov 02 21:15:42 2020 +0100
@@ -85,7 +85,7 @@
  * There might even be entries with fixed values that have no range
  */
 const SSettings SettingsStandard = {
-    .header = 0xFFFF001C,
+    .header = 0xFFFF001D,
     .warning_blink_dsec = 8 * 2,
     .lastDiveLogId = 0,
     .logFlashNextSampleStartAddress = 0,
@@ -314,6 +314,10 @@
 	.cv_config_BigScreen = 0xFFFFFFFF,
 	.compassInertia = 0,
 	.tX_customViewPrimaryBF = CVIEW_T3_Decostop,
+	.viewPortMode = 0,
+	.viewRoll = 0,
+	.viewPitch = 0,
+	.viewYaw = 0,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -472,6 +476,12 @@
     	pSettings->tX_customViewPrimaryBF = CVIEW_T3_Decostop;
     	pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DecoTTS;
         // no break
+    case 0xFFFF001C:
+    	pSettings->viewPortMode = 0;
+    	pSettings->viewRoll = 0;
+    	pSettings->viewPitch = 0;
+    	pSettings->viewYaw = 0;
+    	// no break
     default:
         pSettings->header = pStandard->header;
         break; // no break before!!
@@ -1395,6 +1405,11 @@
     	Settings.tX_customViewPrimaryBF = CVIEW_T3_Decostop;
     	corrections++;
     }
+    if(Settings.viewPortMode > MAX_VIEWPORT_MODE)
+    {
+    	Settings.viewPortMode = 0;
+    	corrections++;
+    }
 
     if(corrections > 255)
         return 255;