comparison Discovery/Src/settings.c @ 710:8adf9b8fc7fa

Extension scrubber time: In previous version only one scrubber timer was available. After movement of scruvver timer menu menu space became available allowing to upgrade the functionality to support two scrubbers. To make it easier to identify combination ID to used scrubber the date of the last usage of the scrubber timer has been added.
author Ideenmodellierer
date Tue, 08 Nov 2022 21:16:17 +0100
parents 49b164022335
children 6c620f5f4834
comparison
equal deleted inserted replaced
709:c799151670d5 710:8adf9b8fc7fa
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 = 0xFFFF0022, 90 .header = 0xFFFF0023,
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,
320 .ppo2sensors_calibCoeff[0] = 0.0, 320 .ppo2sensors_calibCoeff[0] = 0.0,
321 .ppo2sensors_calibCoeff[1] = 0.0, 321 .ppo2sensors_calibCoeff[1] = 0.0,
322 .ppo2sensors_calibCoeff[2] = 0.0, 322 .ppo2sensors_calibCoeff[2] = 0.0,
323 .amPMTime = 0, 323 .amPMTime = 0,
324 .autoSetpoint = 0, 324 .autoSetpoint = 0,
325 .scrubTimerMax = 0, 325 .scrubTimerMax_Obsolete = 0,
326 .scrubTimerCur = 0, 326 .scrubTimerCur_Obsolete = 0,
327 .scrubTimerMode = SCRUB_TIMER_OFF, 327 .scrubTimerMode = SCRUB_TIMER_OFF,
328 }; 328 };
329 329
330 /* Private function prototypes -----------------------------------------------*/ 330 /* Private function prototypes -----------------------------------------------*/
331 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); 331 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to);
486 pSettings->ppo2sensors_calibCoeff[2] = 0.0; 486 pSettings->ppo2sensors_calibCoeff[2] = 0.0;
487 pSettings->amPMTime = 0; 487 pSettings->amPMTime = 0;
488 // no break 488 // no break
489 case 0xFFFF001E: 489 case 0xFFFF001E:
490 pSettings->autoSetpoint = 0; 490 pSettings->autoSetpoint = 0;
491 pSettings->scrubTimerMax = 0; 491 pSettings->scrubTimerMax_Obsolete = 0;
492 pSettings->scrubTimerCur = 0; 492 pSettings->scrubTimerCur_Obsolete = 0;
493 pSettings->scrubTimerMode = SCRUB_TIMER_OFF; 493 pSettings->scrubTimerMode = SCRUB_TIMER_OFF;
494 // no break 494 // no break
495 case 0xFFFF001F: 495 case 0xFFFF001F:
496 pSettings->pscr_lung_ratio = 10; 496 pSettings->pscr_lung_ratio = 10;
497 pSettings->pscr_o2_drop = 4; 497 pSettings->pscr_o2_drop = 4;
499 case 0xFFFF0020: 499 case 0xFFFF0020:
500 pSettings->co2_sensor_active = 0; 500 pSettings->co2_sensor_active = 0;
501 // no break; 501 // no break;
502 case 0xFFFF0021: 502 case 0xFFFF0021:
503 pSettings->ext_uart_protocol = 0; 503 pSettings->ext_uart_protocol = 0;
504 // no break;
505 case 0xFFFF0022:
506 pSettings->scubberActiveId = 0;
507 pSettings->scrubberData[0].TimerCur = pSettings->scrubTimerCur_Obsolete;
508 pSettings->scrubberData[0].TimerMax = pSettings->scrubTimerMax_Obsolete;
509 pSettings->scrubberData[0].lastDive.WeekDay = 0;
510 pSettings->scrubberData[0].lastDive.Month = 0;
511 pSettings->scrubberData[0].lastDive.Date = 0;
512 pSettings->scrubberData[0].lastDive.Year = 0;
513
514 pSettings->scrubberData[1].TimerCur = 0;
515 pSettings->scrubberData[1].TimerMax = 0;
516 pSettings->scrubberData[1].lastDive.WeekDay = 0;
517 pSettings->scrubberData[1].lastDive.Month = 0;
518 pSettings->scrubberData[1].lastDive.Date = 0;
519 pSettings->scrubberData[1].lastDive.Year = 0;
504 // no break; 520 // no break;
505 default: 521 default:
506 pSettings->header = pStandard->header; 522 pSettings->header = pStandard->header;
507 break; // no break before!! 523 break; // no break before!!
508 } 524 }
1460 { 1476 {
1461 Settings.autoSetpoint = 0; 1477 Settings.autoSetpoint = 0;
1462 corrections++; 1478 corrections++;
1463 } 1479 }
1464 1480
1465 if((Settings.scrubTimerMax > MAX_SCRUBBER_TIME) || (Settings.scrubTimerCur > MAX_SCRUBBER_TIME)) 1481 if(Settings.scubberActiveId > 1)
1466 { 1482 {
1467 Settings.scrubTimerMax = 0; 1483 Settings.scubberActiveId = 0;
1468 Settings.scrubTimerCur = 0; 1484 corrections++;
1485 }
1486 if((Settings.scrubberData[0].TimerMax > MAX_SCRUBBER_TIME) || (Settings.scrubberData[0].TimerCur > MAX_SCRUBBER_TIME))
1487 {
1488 Settings.scrubberData[0].TimerMax = 0;
1489 Settings.scrubberData[0].TimerCur = 0;
1490 corrections++;
1491 }
1492 if((Settings.scrubberData[1].TimerMax > MAX_SCRUBBER_TIME) || (Settings.scrubberData[1].TimerCur > MAX_SCRUBBER_TIME))
1493 {
1494 Settings.scrubberData[1].TimerMax = 0;
1495 Settings.scrubberData[1].TimerCur = 0;
1469 corrections++; 1496 corrections++;
1470 } 1497 }
1471 if(Settings.scrubTimerMode > SCRUB_TIMER_END) 1498 if(Settings.scrubTimerMode > SCRUB_TIMER_END)
1472 { 1499 {
1473 Settings.scrubTimerMode = SCRUB_TIMER_OFF; 1500 Settings.scrubTimerMode = SCRUB_TIMER_OFF;
1488 if(Settings.co2_sensor_active > 1) 1515 if(Settings.co2_sensor_active > 1)
1489 { 1516 {
1490 Settings.co2_sensor_active = 0; 1517 Settings.co2_sensor_active = 0;
1491 corrections++; 1518 corrections++;
1492 } 1519 }
1493 if(Settings.co2_sensor_active > UART_MAX_PROTOCOL) 1520 if(Settings.ext_uart_protocol > UART_MAX_PROTOCOL)
1494 { 1521 {
1495 Settings.ext_uart_protocol = 0; 1522 Settings.ext_uart_protocol = 0;
1496 corrections++; 1523 corrections++;
1497 } 1524 }
1498 1525