Mercurial > public > ostc4
comparison Discovery/Src/settings.c @ 796:75ace7af8212
Expanded Sensor map structure:
In the previous version the number of possible sensors were set to 5 based on the assumption that ADC slots are shared with digital O2 sensors. As result three of five slots would have been limited to O2 measurement usecase, leaving just two slots left for other sensors (e.g. CO2). In order to have as much flexibility (and less risk for data structure changes) the number of sensors has been set to 7 (3 ADC + 4 UART MUX)
author | Ideenmodellierer |
---|---|
date | Mon, 31 Jul 2023 20:00:06 +0200 |
parents | 25103f5c7e29 |
children | ff66b41d6fe4 |
comparison
equal
deleted
inserted
replaced
795:d4083ac09b5d | 796:75ace7af8212 |
---|---|
86 | 86 |
87 /* always adjust check_and_correct_settings() accordingly | 87 /* always adjust check_and_correct_settings() accordingly |
88 * There might even be entries with fixed values that have no range | 88 * There might even be entries with fixed values that have no range |
89 */ | 89 */ |
90 const SSettings SettingsStandard = { | 90 const SSettings SettingsStandard = { |
91 .header = 0xFFFF0026, | 91 .header = 0xFFFF0027, |
92 .warning_blink_dsec = 8 * 2, | 92 .warning_blink_dsec = 8 * 2, |
93 .lastDiveLogId = 0, | 93 .lastDiveLogId = 0, |
94 .logFlashNextSampleStartAddress = SAMPLESTART, | 94 .logFlashNextSampleStartAddress = SAMPLESTART, |
95 | 95 |
96 .gas[0].oxygen_percentage = 21, | 96 .gas[0].oxygen_percentage = 21, |
329 .ext_sensor_map[0] = SENSOR_OPTIC, | 329 .ext_sensor_map[0] = SENSOR_OPTIC, |
330 .ext_sensor_map[1] = SENSOR_OPTIC, | 330 .ext_sensor_map[1] = SENSOR_OPTIC, |
331 .ext_sensor_map[2] = SENSOR_OPTIC, | 331 .ext_sensor_map[2] = SENSOR_OPTIC, |
332 .ext_sensor_map[3] = SENSOR_NONE, | 332 .ext_sensor_map[3] = SENSOR_NONE, |
333 .ext_sensor_map[4] = SENSOR_NONE, | 333 .ext_sensor_map[4] = SENSOR_NONE, |
334 .ext_sensor_map[5] = SENSOR_NONE, | |
335 .ext_sensor_map[6] = SENSOR_NONE, | |
336 .ext_sensor_map[7] = SENSOR_NONE, | |
334 .buttonLockActive = 0, | 337 .buttonLockActive = 0, |
335 .compassDeclinationDeg = 0, | 338 .compassDeclinationDeg = 0, |
336 .delaySetpointLow = false, | 339 .delaySetpointLow = false, |
337 }; | 340 }; |
338 | 341 |
539 pSettings->compassDeclinationDeg = pStandard->compassDeclinationDeg; | 542 pSettings->compassDeclinationDeg = pStandard->compassDeclinationDeg; |
540 pSettings->delaySetpointLow = pStandard->delaySetpointLow; | 543 pSettings->delaySetpointLow = pStandard->delaySetpointLow; |
541 // Disable auto setpoint to avoid a configuration warning being triggered by the new auto setpoint validation | 544 // Disable auto setpoint to avoid a configuration warning being triggered by the new auto setpoint validation |
542 // This ensures that users don't lose setpoint information if it is not in the right spot for the new configuration | 545 // This ensures that users don't lose setpoint information if it is not in the right spot for the new configuration |
543 pSettings->autoSetpoint = false; | 546 pSettings->autoSetpoint = false; |
544 | |
545 // no break; | 547 // no break; |
548 case 0xFFFF0026: | |
549 pSettings->ext_sensor_map[0] = pSettings->ext_sensor_map_Obsolete[0]; | |
550 pSettings->ext_sensor_map[1] = pSettings->ext_sensor_map_Obsolete[1]; | |
551 pSettings->ext_sensor_map[2] = pSettings->ext_sensor_map_Obsolete[2]; | |
552 pSettings->ext_sensor_map[3] = pSettings->ext_sensor_map_Obsolete[3]; | |
553 pSettings->ext_sensor_map[4] = pSettings->ext_sensor_map_Obsolete[4]; | |
554 pSettings->ext_sensor_map[5] = SENSOR_NONE; | |
555 pSettings->ext_sensor_map[6] = SENSOR_NONE; | |
556 pSettings->ext_sensor_map[7] = SENSOR_NONE; | |
557 | |
546 default: | 558 default: |
547 pSettings->header = pStandard->header; | 559 pSettings->header = pStandard->header; |
548 break; // no break before!! | 560 break; // no break before!! |
549 } | 561 } |
550 } | 562 } |
1575 } | 1587 } |
1576 if((Settings.ext_sensor_map[0] >= SENSOR_END) | 1588 if((Settings.ext_sensor_map[0] >= SENSOR_END) |
1577 || (Settings.ext_sensor_map[1] >= SENSOR_END) | 1589 || (Settings.ext_sensor_map[1] >= SENSOR_END) |
1578 || (Settings.ext_sensor_map[2] >= SENSOR_END) | 1590 || (Settings.ext_sensor_map[2] >= SENSOR_END) |
1579 || (Settings.ext_sensor_map[3] >= SENSOR_END) | 1591 || (Settings.ext_sensor_map[3] >= SENSOR_END) |
1580 || (Settings.ext_sensor_map[4] >= SENSOR_END)) | 1592 || (Settings.ext_sensor_map[4] >= SENSOR_END) |
1593 || (Settings.ext_sensor_map[5] >= SENSOR_END) | |
1594 || (Settings.ext_sensor_map[6] >= SENSOR_END) | |
1595 || (Settings.ext_sensor_map[7] >= SENSOR_END)) | |
1581 { | 1596 { |
1582 Settings.ext_sensor_map[0] = SENSOR_OPTIC; | 1597 Settings.ext_sensor_map[0] = SENSOR_OPTIC; |
1583 Settings.ext_sensor_map[1] = SENSOR_OPTIC; | 1598 Settings.ext_sensor_map[1] = SENSOR_OPTIC; |
1584 Settings.ext_sensor_map[2] = SENSOR_OPTIC; | 1599 Settings.ext_sensor_map[2] = SENSOR_OPTIC; |
1585 Settings.ext_sensor_map[3] = SENSOR_NONE; | 1600 Settings.ext_sensor_map[3] = SENSOR_NONE; |
1586 Settings.ext_sensor_map[4] = SENSOR_NONE; | 1601 Settings.ext_sensor_map[4] = SENSOR_NONE; |
1602 Settings.ext_sensor_map[5] = SENSOR_NONE; | |
1603 Settings.ext_sensor_map[6] = SENSOR_NONE; | |
1604 Settings.ext_sensor_map[7] = SENSOR_NONE; | |
1587 corrections++; | 1605 corrections++; |
1588 } | 1606 } |
1589 | 1607 |
1590 if(Settings.buttonLockActive > 1) | 1608 if(Settings.buttonLockActive > 1) |
1591 { | 1609 { |