Mercurial > public > ostc4
comparison Discovery/Src/simulation.c @ 977:f0622dd93fdf Evo_2_23
Bugfix ppo2 display in simulator mode:
In the previous version a wrong ppo2 value was display if a digital O2 sensor was used. Rootcause was that the calibration data of the analog sensors was used. To fix this a default calibration coefficient is used (calibration is done within the sensor => no need to store it in OSTC) if the sensor is identified as digital O2 sensor.
author | Ideenmodellierer |
---|---|
date | Thu, 30 Jan 2025 21:24:46 +0100 (8 weeks ago) |
parents | 79b522fbabe6 |
children | 7149f372b0ba |
comparison
equal
deleted
inserted
replaced
976:0b81ac558e89 | 977:f0622dd93fdf |
---|---|
181 two_second = 0; | 181 two_second = 0; |
182 } | 182 } |
183 | 183 |
184 for(index = 0; index < 3; index++) | 184 for(index = 0; index < 3; index++) |
185 { | 185 { |
186 localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index]; | 186 if(pDiveState->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) |
187 if(localCalibCoeff[index] < 0.01) | |
188 { | 187 { |
189 for(index2 = 0; index2 < 3; index2++) /* no valid coeff => check other entries */ | 188 localCalibCoeff[index] = 0.01; |
190 { | 189 } |
191 if(pSettings->ppo2sensors_calibCoeff[index2] > 0.01) | 190 else |
192 { | 191 { |
193 localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index2]; | 192 localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index]; |
194 break; | 193 if(localCalibCoeff[index] < 0.01) |
195 } | 194 { |
196 if(index2 == 3) /* no coeff at all => use default */ | 195 for(index2 = 0; index2 < 3; index2++) /* no valid coeff => check other entries */ |
197 { | 196 { |
198 localCalibCoeff[index] = 0.02; | 197 if(pSettings->ppo2sensors_calibCoeff[index2] > 0.01) |
199 } | 198 { |
200 } | 199 localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index2]; |
200 break; | |
201 } | |
202 if(index2 == 3) /* no coeff at all => use default */ | |
203 { | |
204 localCalibCoeff[index] = 0.02; | |
205 } | |
206 } | |
207 } | |
201 } | 208 } |
202 } | 209 } |
203 | 210 |
204 pDiveState->lifeData.temperature_celsius = pRealState->lifeData.temperature_celsius; | 211 pDiveState->lifeData.temperature_celsius = pRealState->lifeData.temperature_celsius; |
205 pDiveState->lifeData.battery_charge = pRealState->lifeData.battery_charge; | 212 pDiveState->lifeData.battery_charge = pRealState->lifeData.battery_charge; |
493 } | 500 } |
494 | 501 |
495 SDecoinfo* simulation_decoplaner(uint16_t depth_meter, uint16_t intervall_time_minutes, uint16_t dive_time_minutes, uint8_t *gasChangeListDepthGas20x2) | 502 SDecoinfo* simulation_decoplaner(uint16_t depth_meter, uint16_t intervall_time_minutes, uint16_t dive_time_minutes, uint8_t *gasChangeListDepthGas20x2) |
496 { | 503 { |
497 uint8_t ptrGasChangeList = 0; // new hw 160704 | 504 uint8_t ptrGasChangeList = 0; // new hw 160704 |
505 #ifdef ENABLE_DECOCALC_OPTION | |
498 uint8_t index = 0; | 506 uint8_t index = 0; |
507 #endif | |
499 for (int i = 0; i < 40; i++) | 508 for (int i = 0; i < 40; i++) |
500 gasChangeListDepthGas20x2[i] = 0; | 509 gasChangeListDepthGas20x2[i] = 0; |
501 | 510 |
502 SDiveState * pDiveState = &stateSim; | 511 SDiveState * pDiveState = &stateSim; |
503 copyDiveSettingsToSim(); | 512 copyDiveSettingsToSim(); |