diff Discovery/Src/settings.c @ 778:74253a41cf80

Zusammenf?hren
author heinrichsweikamp
date Mon, 22 May 2023 09:15:09 +0200
parents 45b8f3c2acce
children 4abfb8a2a435
line wrap: on
line diff
--- a/Discovery/Src/settings.c	Mon May 22 09:14:27 2023 +0200
+++ b/Discovery/Src/settings.c	Mon May 22 09:15:09 2023 +0200
@@ -89,7 +89,7 @@
  * There might even be entries with fixed values that have no range
  */
 const SSettings SettingsStandard = {
-    .header = 0xFFFF0025,
+    .header = 0xFFFF0026,
     .warning_blink_dsec = 8 * 2,
     .lastDiveLogId = 0,
     .logFlashNextSampleStartAddress = SAMPLESTART,
@@ -332,7 +332,8 @@
 	.ext_sensor_map[2] = SENSOR_OPTIC,
 	.ext_sensor_map[3] = SENSOR_NONE,
 	.ext_sensor_map[4] = SENSOR_NONE,
-	.buttonLockActive = 0
+	.buttonLockActive = 0,
+    .compassDeclinationDeg = 0,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -534,6 +535,10 @@
     	// no break;
     case 0xFFFF0024: pSettings->buttonLockActive = 0;
     	// no break;
+    case 0xFFFF0025:
+        pSettings->compassDeclinationDeg = pStandard->compassDeclinationDeg;
+
+    	// no break;
     default:
         pSettings->header = pStandard->header;
         break; // no break before!!
@@ -1578,6 +1583,16 @@
         corrections++;
     }
 
+    if (Settings.compassDeclinationDeg > 99) {
+        Settings.compassDeclinationDeg = 99;
+
+        corrections++;
+    } else if (Settings.compassDeclinationDeg < -99) {
+        Settings.compassDeclinationDeg = -99;
+
+        corrections++;
+    }
+
     if(corrections)
     {
     	settingsWarning = 1;