comparison Discovery/Src/tCCR.c @ 582:64bf41faab83

Show Fallback if no valid sensor value is available: In previous version fallback was shown when communication to HUD was lost. Now it will be displayed in case no sensor value ist judged as valid. In case of a fallback event ppo2 warnings as well as the data readings are no longer displayed.
author Ideenmodellierer
date Sat, 12 Dec 2020 20:52:58 +0100
parents d97f0e395058
children 7c73f066cd16
comparison
equal deleted inserted replaced
581:011d8f9f5ddb 582:64bf41faab83
191 if(!sensorActive[1]) 191 if(!sensorActive[1])
192 *outOfBouds2 = 1; 192 *outOfBouds2 = 1;
193 193
194 if(!sensorActive[2]) 194 if(!sensorActive[2])
195 *outOfBouds3 = 1; 195 *outOfBouds3 = 1;
196
197 return;
198 } 196 }
199 else 197 else
200 { 198 {
201 uint8_t sensor_id_ordered[3]; 199 uint8_t sensor_id_ordered[3];
202 float difference[2]; 200 float difference[2];
262 *outOfBouds3 = 1; 260 *outOfBouds3 = 1;
263 break; 261 break;
264 } 262 }
265 } 263 }
266 } 264 }
265
267 } 266 }
268 267
269 268
270 uint8_t get_ppO2SensorWeightedResult_cbar(void) 269 uint8_t get_ppO2SensorWeightedResult_cbar(void)
271 { 270 {
272 int8_t sensorOutOfBound[3]; 271 int8_t sensorOutOfBound[3];
273 uint16_t result = 0; 272 uint16_t result = 0;
274 uint8_t count = 0; 273 uint8_t count = 0;
274 uint8_t retVal = 0;
275 275
276 test_O2_sensor_values_outOfBounds(&sensorOutOfBound[0], &sensorOutOfBound[1], &sensorOutOfBound[2]); 276 test_O2_sensor_values_outOfBounds(&sensorOutOfBound[0], &sensorOutOfBound[1], &sensorOutOfBound[2]);
277 277
278 for(int i=0;i<3;i++) 278 for(int i=0;i<3;i++)
279 { 279 {
282 result += stateUsed->lifeData.ppO2Sensor_bar[i] * 100.0; /* convert centibar used by HUB */ 282 result += stateUsed->lifeData.ppO2Sensor_bar[i] * 100.0; /* convert centibar used by HUB */
283 count++; 283 count++;
284 } 284 }
285 } 285 }
286 if(count == 0) // all sensors out of bounds! 286 if(count == 0) // all sensors out of bounds!
287 return 0; 287 {
288 set_warning_fallback();
289 }
288 else 290 else
289 return (uint8_t)(result / count); 291 {
292 retVal = (uint8_t)(result / count);
293 }
294 return retVal;
290 } 295 }
291 296
292 297
293 void tCCR_init(void) 298 void tCCR_init(void)
294 { 299 {