comparison Small_CPU/Src/pressure.c @ 479:4b9427ae0a65 Improve_Button_Sleep

Bugfix unintended else condition: Most likely copy past error in preparation of last commit...
author ideenmodellierer
date Wed, 13 May 2020 21:27:30 +0200
parents 4be72d55b09a
children 3fe9cc747c5c
comparison
equal deleted inserted replaced
478:58200d756365 479:4b9427ae0a65
218 EvaluatedValues++; 218 EvaluatedValues++;
219 } while (index != surface_pressure_writeIndex); 219 } while (index != surface_pressure_writeIndex);
220 } 220 }
221 void update_surface_pressure(uint8_t call_rhythm_seconds) 221 void update_surface_pressure(uint8_t call_rhythm_seconds)
222 { 222 {
223
224
225 if(is_init_pressure_done()) 223 if(is_init_pressure_done())
226 { 224 {
227 runningAvg = (runningAvg * avgCount + ambient_pressure_mbar) / (avgCount +1); 225 runningAvg = (runningAvg * avgCount + ambient_pressure_mbar) / (avgCount +1);
228 avgCount++; 226 avgCount++;
229 secondCounterSurfaceRing += call_rhythm_seconds; 227 secondCounterSurfaceRing += call_rhythm_seconds;
469 467
470 if(statusReturn) 468 if(statusReturn)
471 { 469 {
472 *statusReturn = statusReturnTemp; 470 *statusReturn = statusReturnTemp;
473 } 471 }
474 else 472
475 { 473 switch (cmd & 0x0f) // wait necessary conversion time
476 switch (cmd & 0x0f) // wait necessary conversion time 474 {
477 { 475 case CMD_ADC_256 : HAL_Delay(1); break;
478 case CMD_ADC_256 : HAL_Delay(1); break; 476 case CMD_ADC_512 : HAL_Delay(3); break;
479 case CMD_ADC_512 : HAL_Delay(3); break; 477 case CMD_ADC_1024: HAL_Delay(4); break;
480 case CMD_ADC_1024: HAL_Delay(4); break; 478 case CMD_ADC_2048: HAL_Delay(6); break;
481 case CMD_ADC_2048: HAL_Delay(6); break; 479 case CMD_ADC_4096: HAL_Delay(10); break;
482 case CMD_ADC_4096: HAL_Delay(10); break; 480 default:
483 default: 481 break;
484 break; 482 }
485 } 483 adcValue = get_adc();
486 adcValue = get_adc(); 484 if(adcValue == 0xFFFFFFFF)
487 if(adcValue == 0xFFFFFFFF) 485 {
486 if(statusReturn)
488 { 487 {
489 *statusReturn = HAL_ERROR; 488 *statusReturn = HAL_ERROR;
490 } 489 }
491 } 490 }
492 return adcValue; 491 return adcValue;