Index: firmware/App/Controllers/Temperatures.c =================================================================== diff -u -r921034ee7092206a50183eacfaa73b436d2dee5f -r07cdd44ffd0905cb115405e22cc7586585034e7f --- firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 921034ee7092206a50183eacfaa73b436d2dee5f) +++ firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 07cdd44ffd0905cb115405e22cc7586585034e7f) @@ -80,7 +80,6 @@ static const F32 FGPA_BOARD_TEMP_CONVERSION_COEFF = 503.975 / (F32)TWELVE_BIT_RESOLUTION; ///< FPGA board temperature conversion coefficient. static const F32 VENOUS_ART_PRES_SENSOR_TEMP_CONV_COEFF = 200.0 / 2047.0; ///< Arterial and venous pressure sensor temperature conversion coefficient. static const F32 VENOUS_ART_PRES_SENSOR_TEMP_CONV_CONSTANT = 50.0; ///< Arterial and venous pressure sensor temperature conversion constant. -static const F32 ADC_BOARD_TEMP_SENSOR_CONVERSION_COEFF = 1.0 / 13584.0; ///< ADC board temperatures sensor conversion coefficient. // ********** private function prototypes ********** @@ -231,7 +230,7 @@ TEMPERATURES_EXEC_STATES_T state = TEMPERATURES_EXEC_STATE_WAIT_FOR_POST_STATE; // Give a short time for FPGA to boot up and start sending the ADC reads - if ( ( ++adcReadCounter > ADC_FPGA_READ_DELAY_COUNT ) && ( TRUE == isPOSTComplete ) ) + if ( ( ++adcReadCounter > ADC_FPGA_READ_DELAY_COUNT ) && ( MODE_INIT == getCurrentOperationMode() ) ) { adcReadCounter = 0; state = TEMPERATURES_EXEC_STATE_GET_ADC_VALUES_STATE; @@ -283,24 +282,19 @@ BOOL isTempOutOfRange = FALSE; F32 temperature = 0.0; U32 lastFaultSensor = 0; - F32 faultSensorTemp = 0.0; for ( sensor = THERMISTOR_ONBOARD_NTC; sensor < NUM_OF_TEMPERATURES; sensor++ ) { temperature = getTemperatureValue( sensor ); if ( ( temperature > MAX_ALLOWED_TEMPERATURE ) || ( temperature < MIN_ALLOWED_TEMPERATURE ) ) { - isTempOutOfRange = TRUE; - lastFaultSensor = sensor; - faultSensorTemp = temperature; + isTempOutOfRange |= TRUE; + lastFaultSensor = sensor; } } - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, isTempOutOfRange ) ) - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, lastFaultSensor, faultSensorTemp ); - } + checkPersistentAlarm( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, isTempOutOfRange, lastFaultSensor, MAX_ALLOWED_TEMPERATURE ); } /*********************************************************************//** @@ -352,9 +346,6 @@ #endif } - // TODO remove this code and the if statement. This configuration is until the new arterial sensor is implemented everywhere so the temperature calibration - // structure can be updated permanently. This way the PBA sensor will be replaced with the new arterial sensor. This is to make sure the - // calibration structure does not fail in different devices with different sensors temperaturesStatus[ sensor ].temperatureValue.data = temperature; // Apply the calibration record the temperature values prior to updating the structures temperaturesStatus[ sensor ].temperatureValue.data =