Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditHardware.c @ 926:875933272056 Evo_2_23
Bugfix sensor de-/activation handling:
In the previous version a CO2 sensor could cause a not used analog channel to be displayed. Rootcause was that all sensor type, not only o2 sensors, were used for o2 sensor deactivation evaluation. The deactivation state is the criteria if a value is displayed or not.
In the new version only o2 sensor type are used for handling of sensor de-/activation state.
In addition the cursor will now be set to the first valid sensor entry in case sensor slot 0 is empty.
author | Ideenmodellierer |
---|---|
date | Thu, 14 Nov 2024 20:13:18 +0100 |
parents | c4c9850a2039 |
children | 25948e805406 |
comparison
equal
deleted
inserted
replaced
925:79c888f5d8d2 | 926:875933272056 |
---|---|
567 { | 567 { |
568 SSettings *pSettings = settingsGetPointer(); | 568 SSettings *pSettings = settingsGetPointer(); |
569 uint8_t sensorActive[3]; | 569 uint8_t sensorActive[3]; |
570 uint8_t index = 0; | 570 uint8_t index = 0; |
571 char text[3]; | 571 char text[3]; |
572 uint32_t firstSensorId = 0; | |
572 | 573 |
573 set_globalState(StMHARD3_Sensors); | 574 set_globalState(StMHARD3_Sensors); |
574 resetMenuEdit(CLUT_MenuPageHardware); | 575 resetMenuEdit(CLUT_MenuPageHardware); |
575 | 576 |
576 for(index = 0; index < 3; index++ ) | 577 for(index = 0; index < 3; index++ ) |
583 { | 584 { |
584 sensorActive[index] = 1; | 585 sensorActive[index] = 1; |
585 } | 586 } |
586 } | 587 } |
587 | 588 |
588 if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_MUX))) | 589 if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_TYPE_O2_END))) |
589 { | 590 { |
590 pSettings->ppo2sensors_deactivated |= 1; | 591 pSettings->ppo2sensors_deactivated |= 1; |
591 } | 592 } |
592 else | 593 else |
593 { | 594 { |
594 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); | 595 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); |
595 } | 596 if(firstSensorId == 0) |
596 if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_MUX))) | 597 { |
598 firstSensorId = StMHARD3_O2_Sensor1; | |
599 } | |
600 } | |
601 if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_TYPE_O2_END))) | |
597 { | 602 { |
598 pSettings->ppo2sensors_deactivated |= 2; | 603 pSettings->ppo2sensors_deactivated |= 2; |
599 } | 604 } |
600 else | 605 else |
601 { | 606 { |
602 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); | 607 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); |
603 } | 608 if(firstSensorId == 0) |
604 if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_MUX))) | 609 { |
610 firstSensorId = StMHARD3_O2_Sensor2; | |
611 } | |
612 } | |
613 if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_TYPE_O2_END))) | |
605 { | 614 { |
606 pSettings->ppo2sensors_deactivated |= 4; | 615 pSettings->ppo2sensors_deactivated |= 4; |
607 } | 616 } |
608 else | 617 else |
609 { | 618 { |
610 write_field_on_off(StMHARD3_O2_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]); | 619 write_field_on_off(StMHARD3_O2_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]); |
620 if(firstSensorId == 0) | |
621 { | |
622 firstSensorId = StMHARD3_O2_Sensor3; | |
623 } | |
611 } | 624 } |
612 | 625 |
613 stateRealGetPointerWrite()->diveSettings.ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated; | 626 stateRealGetPointerWrite()->diveSettings.ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated; |
614 | 627 |
615 if(settingsGetPointer()->ppo2sensors_deactivated & 1) | 628 if(settingsGetPointer()->ppo2sensors_deactivated & 1) |
667 if(DataEX_external_ADC_Present()) | 680 if(DataEX_external_ADC_Present()) |
668 { | 681 { |
669 setEvent(StMHARD3_Sensor_Detect, (uint32_t)OnAction_Sensor_Detect); | 682 setEvent(StMHARD3_Sensor_Detect, (uint32_t)OnAction_Sensor_Detect); |
670 } | 683 } |
671 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | 684 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
685 | |
686 switch(firstSensorId) | |
687 { | |
688 case StMHARD3_O2_Sensor2: tMenuEdit_select(StMHARD3_O2_Sensor2); | |
689 break; | |
690 case StMHARD3_O2_Sensor3: tMenuEdit_select(StMHARD3_O2_Sensor3); | |
691 break; | |
692 default: break; | |
693 } | |
672 } | 694 } |
673 | 695 |
674 | 696 |
675 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 697 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
676 { | 698 { |