comparison 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
comparison
equal deleted inserted replaced
727:1dca3bb187d7 728:5143e927219f
38 38
39 static uint8_t settingsWarning = 0; /* Active if setting values have been corrected */ 39 static uint8_t settingsWarning = 0; /* Active if setting values have been corrected */
40 40
41 SSettings Settings; 41 SSettings Settings;
42 42
43 const uint8_t RTErequiredHigh = 2; 43 const uint8_t RTErequiredHigh = 3;
44 const uint8_t RTErequiredLow = 9; 44 const uint8_t RTErequiredLow = 0;
45 45
46 const uint8_t FONTrequiredHigh = 1; 46 const uint8_t FONTrequiredHigh = 1;
47 const uint8_t FONTrequiredLow = 0; 47 const uint8_t FONTrequiredLow = 0;
48 48
49 uint8_t RTEactualHigh = 0; 49 uint8_t RTEactualHigh = 0;
85 85
86 /* always adjust check_and_correct_settings() accordingly 86 /* always adjust check_and_correct_settings() accordingly
87 * There might even be entries with fixed values that have no range 87 * There might even be entries with fixed values that have no range
88 */ 88 */
89 const SSettings SettingsStandard = { 89 const SSettings SettingsStandard = {
90 .header = 0xFFFF0023, 90 .header = 0xFFFF0024,
91 .warning_blink_dsec = 8 * 2, 91 .warning_blink_dsec = 8 * 2,
92 .lastDiveLogId = 0, 92 .lastDiveLogId = 0,
93 .logFlashNextSampleStartAddress = SAMPLESTART, 93 .logFlashNextSampleStartAddress = SAMPLESTART,
94 94
95 .gas[0].oxygen_percentage = 21, 95 .gas[0].oxygen_percentage = 21,
323 .amPMTime = 0, 323 .amPMTime = 0,
324 .autoSetpoint = 0, 324 .autoSetpoint = 0,
325 .scrubTimerMax_Obsolete = 0, 325 .scrubTimerMax_Obsolete = 0,
326 .scrubTimerCur_Obsolete = 0, 326 .scrubTimerCur_Obsolete = 0,
327 .scrubTimerMode = SCRUB_TIMER_OFF, 327 .scrubTimerMode = SCRUB_TIMER_OFF,
328 .ext_sensor_map[0] = SENSOR_ANALOG,
329 .ext_sensor_map[1] = SENSOR_ANALOG,
330 .ext_sensor_map[2] = SENSOR_ANALOG,
331 .ext_sensor_map[3] = SENSOR_NONE,
332 .ext_sensor_map[4] = SENSOR_NONE,
328 }; 333 };
329 334
330 /* Private function prototypes -----------------------------------------------*/ 335 /* Private function prototypes -----------------------------------------------*/
331 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); 336 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to);
332 337
516 pSettings->scrubberData[1].lastDive.WeekDay = 0; 521 pSettings->scrubberData[1].lastDive.WeekDay = 0;
517 pSettings->scrubberData[1].lastDive.Month = 0; 522 pSettings->scrubberData[1].lastDive.Month = 0;
518 pSettings->scrubberData[1].lastDive.Date = 0; 523 pSettings->scrubberData[1].lastDive.Date = 0;
519 pSettings->scrubberData[1].lastDive.Year = 0; 524 pSettings->scrubberData[1].lastDive.Year = 0;
520 // no break; 525 // no break;
526 case 0xFFFF0023: pSettings->ext_sensor_map[0] = SENSOR_ANALOG;
527 pSettings->ext_sensor_map[1] = SENSOR_ANALOG;
528 pSettings->ext_sensor_map[2] = SENSOR_ANALOG;
529 pSettings->ext_sensor_map[3] = SENSOR_NONE;
530 pSettings->ext_sensor_map[4] = SENSOR_NONE;
531 // no break;
521 default: 532 default:
522 pSettings->header = pStandard->header; 533 pSettings->header = pStandard->header;
523 break; // no break before!! 534 break; // no break before!!
524 } 535 }
525 } 536 }
1519 } 1530 }
1520 if(Settings.ext_uart_protocol > UART_MAX_PROTOCOL) 1531 if(Settings.ext_uart_protocol > UART_MAX_PROTOCOL)
1521 { 1532 {
1522 Settings.ext_uart_protocol = 0; 1533 Settings.ext_uart_protocol = 0;
1523 corrections++; 1534 corrections++;
1535 }
1536 if((Settings.ext_sensor_map[0] >= SENSOR_END)
1537 || (Settings.ext_sensor_map[1] >= SENSOR_END)
1538 || (Settings.ext_sensor_map[2] >= SENSOR_END)
1539 || (Settings.ext_sensor_map[3] >= SENSOR_END)
1540 || (Settings.ext_sensor_map[4] >= SENSOR_END))
1541 {
1542 Settings.ext_sensor_map[0] = SENSOR_ANALOG;
1543 Settings.ext_sensor_map[1] = SENSOR_ANALOG;
1544 Settings.ext_sensor_map[2] = SENSOR_ANALOG;
1545 Settings.ext_sensor_map[3] = SENSOR_NONE;
1546 Settings.ext_sensor_map[4] = SENSOR_NONE;
1547 corrections++;
1524 } 1548 }
1525 1549
1526 if(corrections) 1550 if(corrections)
1527 { 1551 {
1528 settingsWarning = 1; 1552 settingsWarning = 1;