diff Discovery/Src/settings.c @ 728:5143e927219f

Added sensor map to Firmware <=> RTE inferface: The sensor map contains a list of up to five sensors which may be connected to the external interface. The update includes the definition of the type as well as the data structure. to ensure compatibility the RTE and needed RTE version has been set to 3.0
author Ideenmodellierer
date Sat, 14 Jan 2023 20:41:36 +0100
parents 6c620f5f4834
children 7b0e020513e3
line wrap: on
line diff
--- a/Discovery/Src/settings.c	Sat Jan 14 20:37:20 2023 +0100
+++ b/Discovery/Src/settings.c	Sat Jan 14 20:41:36 2023 +0100
@@ -40,8 +40,8 @@
 
 SSettings Settings;
 
-const uint8_t RTErequiredHigh = 2;
-const uint8_t RTErequiredLow = 9;
+const uint8_t RTErequiredHigh = 3;
+const uint8_t RTErequiredLow = 0;
 
 const uint8_t FONTrequiredHigh = 1;
 const uint8_t FONTrequiredLow =	0;
@@ -87,7 +87,7 @@
  * There might even be entries with fixed values that have no range
  */
 const SSettings SettingsStandard = {
-    .header = 0xFFFF0023,
+    .header = 0xFFFF0024,
     .warning_blink_dsec = 8 * 2,
     .lastDiveLogId = 0,
     .logFlashNextSampleStartAddress = SAMPLESTART,
@@ -325,6 +325,11 @@
 	.scrubTimerMax_Obsolete = 0,
 	.scrubTimerCur_Obsolete = 0,
 	.scrubTimerMode = SCRUB_TIMER_OFF,
+	.ext_sensor_map[0] = SENSOR_ANALOG,
+	.ext_sensor_map[1] = SENSOR_ANALOG,
+	.ext_sensor_map[2] = SENSOR_ANALOG,
+	.ext_sensor_map[3] = SENSOR_NONE,
+	.ext_sensor_map[4] = SENSOR_NONE,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -518,6 +523,12 @@
     	pSettings->scrubberData[1].lastDive.Date = 0;
     	pSettings->scrubberData[1].lastDive.Year = 0;
     	// no break;
+    case 0xFFFF0023: pSettings->ext_sensor_map[0] = SENSOR_ANALOG;
+    				 pSettings->ext_sensor_map[1] = SENSOR_ANALOG;
+    				 pSettings->ext_sensor_map[2] = SENSOR_ANALOG;
+    				 pSettings->ext_sensor_map[3] = SENSOR_NONE;
+    				 pSettings->ext_sensor_map[4] = SENSOR_NONE;
+    	// no break;
     default:
         pSettings->header = pStandard->header;
         break; // no break before!!
@@ -1522,6 +1533,19 @@
     	Settings.ext_uart_protocol = 0;
     	corrections++;
     }
+    if((Settings.ext_sensor_map[0] >= SENSOR_END)
+    		|| (Settings.ext_sensor_map[1] >= SENSOR_END)
+			|| (Settings.ext_sensor_map[2] >= SENSOR_END)
+			|| (Settings.ext_sensor_map[3] >= SENSOR_END)
+			|| (Settings.ext_sensor_map[4] >= SENSOR_END))
+    {
+    	Settings.ext_sensor_map[0] = SENSOR_ANALOG;
+    	Settings.ext_sensor_map[1] = SENSOR_ANALOG;
+    	Settings.ext_sensor_map[2] = SENSOR_ANALOG;
+    	Settings.ext_sensor_map[3] = SENSOR_NONE;
+    	Settings.ext_sensor_map[4] = SENSOR_NONE;
+       	corrections++;
+    }
 
     if(corrections)
     {