Mercurial > public > ostc4
diff 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 |
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditHardware.c Wed Nov 13 17:56:02 2024 +0100 +++ b/Discovery/Src/tMenuEditHardware.c Thu Nov 14 20:13:18 2024 +0100 @@ -569,6 +569,7 @@ uint8_t sensorActive[3]; uint8_t index = 0; char text[3]; + uint32_t firstSensorId = 0; set_globalState(StMHARD3_Sensors); resetMenuEdit(CLUT_MenuPageHardware); @@ -585,29 +586,41 @@ } } - if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_MUX))) + if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_TYPE_O2_END))) { pSettings->ppo2sensors_deactivated |= 1; } else { write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); + if(firstSensorId == 0) + { + firstSensorId = StMHARD3_O2_Sensor1; + } } - if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_MUX))) + if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_TYPE_O2_END))) { pSettings->ppo2sensors_deactivated |= 2; } else { write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); + if(firstSensorId == 0) + { + firstSensorId = StMHARD3_O2_Sensor2; + } } - if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_MUX))) + if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_TYPE_O2_END))) { pSettings->ppo2sensors_deactivated |= 4; } else { write_field_on_off(StMHARD3_O2_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]); + if(firstSensorId == 0) + { + firstSensorId = StMHARD3_O2_Sensor3; + } } stateRealGetPointerWrite()->diveSettings.ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated; @@ -669,6 +682,15 @@ setEvent(StMHARD3_Sensor_Detect, (uint32_t)OnAction_Sensor_Detect); } write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); + + switch(firstSensorId) + { + case StMHARD3_O2_Sensor2: tMenuEdit_select(StMHARD3_O2_Sensor2); + break; + case StMHARD3_O2_Sensor3: tMenuEdit_select(StMHARD3_O2_Sensor3); + break; + default: break; + } }