diff Discovery/Src/settings.c @ 560:5d80bb8d22cb

Added O2 sensor source and calibration parameters to setting structure
author Ideenmodellierer
date Sun, 15 Nov 2020 19:53:09 +0100
parents af1c3e3abd5f
children 1c95f811967c
line wrap: on
line diff
--- a/Discovery/Src/settings.c	Sun Nov 15 19:52:03 2020 +0100
+++ b/Discovery/Src/settings.c	Sun Nov 15 19:53:09 2020 +0100
@@ -85,7 +85,7 @@
  * There might even be entries with fixed values that have no range
  */
 const SSettings SettingsStandard = {
-    .header = 0xFFFF001D,
+    .header = 0xFFFF001E,
     .warning_blink_dsec = 8 * 2,
     .lastDiveLogId = 0,
     .logFlashNextSampleStartAddress = 0,
@@ -318,6 +318,10 @@
 	.viewRoll = 0,
 	.viewPitch = 0,
 	.viewYaw = 0,
+	.ppo2sensors_source = 0,
+	.ppo2sensors_calibCoeff[0] = 0.0,
+	.ppo2sensors_calibCoeff[1] = 0.0,
+	.ppo2sensors_calibCoeff[2] = 0.0,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -482,6 +486,12 @@
     	pSettings->viewPitch = 0;
     	pSettings->viewYaw = 0;
     	// no break
+    case 0xFFFF001D:
+    	pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
+    	pSettings->ppo2sensors_calibCoeff[0] = 0.0;
+    	pSettings->ppo2sensors_calibCoeff[1] = 0.0;
+    	pSettings->ppo2sensors_calibCoeff[2] = 0.0;
+    	// no break
     default:
         pSettings->header = pStandard->header;
         break; // no break before!!
@@ -1414,6 +1424,14 @@
     	Settings.viewPortMode = 0;
     	corrections++;
     }
+    if(Settings.ppo2sensors_source >= O2_SENSOR_SOURCE_MAX)
+    {
+    	Settings.ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
+    	Settings.ppo2sensors_calibCoeff[0] = 0.0;
+    	Settings.ppo2sensors_calibCoeff[1] = 0.0;
+    	Settings.ppo2sensors_calibCoeff[2] = 0.0;
+        corrections++;
+    }
 
     if(corrections > 255)
         return 255;