/************************************************************************** * * Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file PressureSensor.c * * @author (last) Vinayakam Mani * @date (last) 04-Sep-2024 * * @author (original) Vinayakam Mani * @date (original) 04-Sep-2024 * ***************************************************************************/ #include "AlarmMgmtDD.h" #include "FpgaDD.h" #include "Messaging.h" #include "PersistentAlarm.h" #include "PressureSensor.h" #include "TemperatureSensors.h" /** * @addtogroup PressureSensor * @{ */ // ********** private definitions ********** #define PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Pressure sensors read and error count timeout in milliseconds. #define HIGH_PRES_MAX_PSI 145.038F ///< Convert pressure to PSI for 10 bar pressure sensor #define LOW_PRES_MAX_PSI 50.7632F ///< Convert pressure to PSI for 3.5 bar pressure sensor #ifdef __BETA_HW_VER__ #define PRES_MIN_PSI 0.0F ///< Minimum value for PSI conversion #else #define PRES_MIN_PSI -14.5038F ///< Minimum value for PSI conversion #endif #define ONE_BAR_TO_MILLI_BAR 1000 ///< 1 bar to milli-bar conversion. #define COUNTS_TO_MILLI_BAR 100 ///< Counts to milli-bar conversion. #define BAR_TO_MMHG ( 750.062F ) ///< Conversion factor for converting bar to mmHg. #define PRES_SENSORS_READ_ERR_MAX_CNT 255 ///< Pressure sensor read and error max count value /// Barometric sensor conversion coefficients typedef struct { U16 pressureSensitivity; ///< Barometric sensor pressure sensitivity constant. U16 pressureOffset; ///< Barometric sensor pressure offset constant. U16 pressureSensitivityTempCoeff; ///< Barometric sensor pressure sensitivity temperature coefficient. U16 pressureOffsetTempCoeff; ///< Barometric sensor pressure offset temperature coefficient. } BARO_SENSOR_CONSTS_T; // ********** private data ********** static OVERRIDE_F32_T currentPressureReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< Current pressure sensor pressure readings (overrideable). static OVERRIDE_F32_T currentPresTempReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< Current pressure sensor temperature readings (overrideable). static OVERRIDE_U32_T lastPressureReadCounter[ NUM_OF_PRESSURE_SENSORS ]; ///< Last pressure sensor read count (Overrideable). static OVERRIDE_U32_T lastPressureErrorCounter[ NUM_OF_PRESSURE_SENSORS ]; ///< Last pressure sensor error count (Overrideable). static BARO_SENSOR_CONSTS_T baroConvConsts; ///< Barometric sensor conversion constants. static const U32 TWO_TO_POWER_OF_6 = ( 1 << 6 ); ///< 2^6. static const U32 TWO_TO_POWER_OF_7 = ( 1 << 7 ); ///< 2^7. static const U32 TWO_TO_POWER_OF_15 = ( 1 << 15 ); ///< 2^15. static const U32 TWO_TO_POWER_OF_16 = ( 1 << 16 ); ///< 2^16. static const U32 TWO_TO_POWER_OF_17 = ( 1 << 17 ); ///< 2^17. static const U32 TWO_TO_POWER_OF_21 = ( 1 << 21 ); ///< 2^21. // ********** private function prototypes ********** static void checkPressureSensors( void ); static F32 convertBaroPressureReading2mmHg( U32 rawPressure ); static F32 calculateBaroPressure( U32 pressure ); /*********************************************************************//** * @brief * The initPressureSensor function initializes the Pressure Sensor unit. * @details \b Inputs: none * @details \b Outputs: Pressure Sensor unit is initialized. * @return none *************************************************************************/ void initPressureSensor( void ) { U32 i; // Initialize override structures for each pressure sensor for ( i = (U32)PRESSURE_SENSOR_FIRST; i < (U32)NUM_OF_PRESSURE_SENSORS; i++ ) { currentPressureReadings[ i ].data = 0.0F; currentPressureReadings[ i ].ovData = 0.0F; currentPressureReadings[ i ].ovInitData = 0.0F; currentPressureReadings[ i ].override = OVERRIDE_RESET; currentPresTempReadings[ i ].data = 0.0F; currentPresTempReadings[ i ].ovData = 0.0F; currentPresTempReadings[ i ].ovInitData = 0.0F; currentPresTempReadings[ i ].override = OVERRIDE_RESET; lastPressureReadCounter[ i ].data = 0; lastPressureReadCounter[ i ].ovData = 0; lastPressureReadCounter[ i ].ovInitData = 0; lastPressureReadCounter[ i ].override = OVERRIDE_RESET; lastPressureErrorCounter[ i ].data = 0; lastPressureErrorCounter[ i ].ovData = 0; lastPressureErrorCounter[ i ].ovInitData = 0; lastPressureErrorCounter[ i ].override = OVERRIDE_RESET; } //Initialize baro variable baroConvConsts.pressureOffset = 0; baroConvConsts.pressureOffsetTempCoeff = 0; baroConvConsts.pressureSensitivity = 0; baroConvConsts.pressureSensitivityTempCoeff = 0; // Initialize the FPGA persistent alarms initFPGAPersistentAlarm( FPGA_PERS_ERROR_HYDRAULICS_OUTLET_PRESSURE, ALARM_ID_DD_HYD_OUTLET_PRES_TIMEOUT_FAULT, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ); initFPGAPersistentAlarm( FPGA_PERS_ERROR_BIBAG_PRESSURE, ALARM_ID_DD_BIBAG_PRES_TIMEOUT_FAULT, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ); initFPGAPersistentAlarm( FPGA_PERS_ERROR_SPENT_DIALYSATE_PRESSURE, ALARM_ID_DD_SPENT_DIALYSATE_PRES_TIMEOUT_FAULT, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ); initFPGAPersistentAlarm( FPGA_PERS_ERROR_FRESH_DIALYSATE_PRESSURE, ALARM_ID_DD_FRESH_DIALYSATE_PRES_TIMEOUT_FAULT, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ); initFPGAPersistentAlarm( FPGA_PERS_ERROR_TRANSMEMBRANE_PRESSURE, ALARM_ID_DD_TRANSMEMB_PRES_TIMEOUT_FAULT, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ); initFPGAPersistentAlarm( FPGA_PERS_ERROR_WATER_INLET_INPUT_PRESSURE, ALARM_ID_DD_WATER_INLET_INPUT_PRES_TIMEOUT_FAULT, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ); initFPGAPersistentAlarm( FPGA_PERS_ERROR_WATER_INLET_OUTPUT_PRESSURE, ALARM_ID_DD_WATER_INLET_OUTPUT_PRES_TIMEOUT_FAULT, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS, PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ); } /*********************************************************************//** * @brief * The readPressureSensors function gets the current pressure reading * for a all pressure sensors from the FPGA and also reads the freshness * and error counters to verify that the pressure sensors are being read * by the FPGA without issue. * @note This function should be called periodically to maintain fresh * sensor readings for all pressure sensors. * @details \b Inputs: FPGA * @details \b Outputs: currentPressureReadings[],currentPresTempReadings[], * lastPressureReadCounter[],lastPressureErrorCounter[]. * @return none *************************************************************************/ void readPressureSensors( void ) { // Update and convert raw pressures to mmHg #ifndef __BETA_HW_VER__ currentPressureReadings[ M1_PRES ].data = convertPressureReading( getFPGAM1PresRawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); currentPressureReadings[ M3_PRES ].data = convertPressureReading( getFPGAM3PresRawPressure(),PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); currentPressureReadings[ D9_PRES ].data = convertPressureReading( getFPGAD9PresRawPressure(),PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); #else currentPressureReadings[ M1_PRES ].data = convertPressureReading( getFPGAM1PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); currentPressureReadings[ M3_PRES ].data = convertPressureReading( getFPGAM3PresRawPressure(),PRES_MIN_PSI, LOW_PRES_MAX_PSI ); currentPressureReadings[ D9_PRES ].data = convertPressureReading( getFPGAD9PresRawPressure(),PRES_MIN_PSI, LOW_PRES_MAX_PSI ); #endif currentPressureReadings[ D66_PRES ].data = convertPressureReading( getFPGAD66PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); currentPressureReadings[ D51_PRES ].data = convertPressureReading( getFPGAD51PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); currentPressureReadings[ D18_PRES ].data = convertPressureReading( getFPGAD18PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); currentPressureReadings[ D41_PRES ].data = convertPressureReading( getFPGAD41PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); currentPressureReadings[ BARO_PRES ].data = convertBaroPressureReading2mmHg( getFPGABaroPressure() ); // Update and convert raw pressure sensor temperatures to deg C currentPresTempReadings[ M1_PRES ].data = convertPressureTempReading2DegC( getFPGAM1PresRawTemperature() ); currentPresTempReadings[ M3_PRES ].data = convertPressureTempReading2DegC( getFPGAM3PresRawTemperature() ); currentPresTempReadings[ D9_PRES ].data = convertPressureTempReading2DegC( getFPGAD9PresRawTemperature() ); currentPresTempReadings[ D66_PRES ].data = convertPressureTempReading2DegC( getFPGAD66PresRawTemperature() ); currentPresTempReadings[ D51_PRES ].data = convertPressureTempReading2DegC( getFPGAD51PresRawTemperature() ); currentPresTempReadings[ D18_PRES ].data = convertPressureTempReading2DegC( getFPGAD18PresRawTemperature() ); currentPresTempReadings[ D41_PRES ].data = convertPressureTempReading2DegC( getFPGAD41PresRawTemperature() ); // Update read and error counters for each pressure sensor lastPressureReadCounter[ M1_PRES ].data = (U32)getFPGAM1PresReadCount(); lastPressureReadCounter[ M3_PRES ].data = (U32)getFPGAM3PresReadCount(); lastPressureReadCounter[ D9_PRES ].data = (U32)getFPGAD9PresReadCount(); lastPressureReadCounter[ D66_PRES ].data = (U32)getFPGAD66PresReadCount(); lastPressureReadCounter[ D51_PRES ].data = (U32)getFPGAD51PresReadCount(); lastPressureReadCounter[ D18_PRES ].data = (U32)getFPGAD18PresReadCount(); lastPressureReadCounter[ D41_PRES ].data = (U32)getFPGAD41PresReadCount(); lastPressureErrorCounter[ M1_PRES ].data = (U32)getFPGAM1PresErrorCount(); lastPressureErrorCounter[ M3_PRES ].data = (U32)getFPGAM3PresErrorCount(); lastPressureErrorCounter[ D9_PRES ].data = (U32)getFPGAD9PresErrorCount(); lastPressureErrorCounter[ D66_PRES ].data = (U32)getFPGAD66PresErrorCount(); lastPressureErrorCounter[ D51_PRES ].data = (U32)getFPGAD51PresErrorCount(); lastPressureErrorCounter[ D18_PRES ].data = (U32)getFPGAD18PresErrorCount(); lastPressureErrorCounter[ D41_PRES ].data = (U32)getFPGAD41PresErrorCount(); // Monitor pressure sensor health checkPressureSensors(); } /*********************************************************************//** * @brief * The convertBaroPressureReading2mmHg function converts the raw pressure counts * in to mmHg unit. * @details \b Inputs: FPGA * @details \b Outputs: baroConvConsts * @param rawPressure the raw baro sensor reading from FPGA. * @return the converted baro pressure (in mmHg). *************************************************************************/ static F32 convertBaroPressureReading2mmHg( U32 rawPressure ) { F32 baroPressure = 0.0F; baroConvConsts.pressureSensitivity = getFPGABaroPressureSensitivity(); baroConvConsts.pressureSensitivityTempCoeff = getFPGABaroTempCoeffOfPressSensitvity(); baroConvConsts.pressureOffset = getFPGABaroPressureOffset(); baroConvConsts.pressureOffsetTempCoeff = getFPGABaroTempCoeffOfPressOffset(); baroPressure = calculateBaroPressure( rawPressure ); return baroPressure; } /*********************************************************************//** * @brief * The calculateBaroPressure function performs the required calculations * to compute the baro pressure readings. * @details \b Inputs: baroConvConsts * @details \b Outputs: none * @param pressure the raw baro sensor reading from FPGA. * @return converted baro pressure (in mmHg). *************************************************************************/ static F32 calculateBaroPressure( U32 pressure ) { S32 tempDiff = getBaroSensorTemperatureDiff(); S64 tempOffset = ( baroConvConsts.pressureOffsetTempCoeff * tempDiff ) / TWO_TO_POWER_OF_6; S64 presOffset = baroConvConsts.pressureOffset * TWO_TO_POWER_OF_17; S64 offset = presOffset + tempOffset; S64 tempSensitivity = ( baroConvConsts.pressureSensitivityTempCoeff * tempDiff ) / TWO_TO_POWER_OF_7; S64 presSensitivity = baroConvConsts.pressureSensitivity * TWO_TO_POWER_OF_16; S64 sensitivity = tempSensitivity + presSensitivity; S32 pres = (S32)( ( ( pressure * sensitivity ) / TWO_TO_POWER_OF_21 ) - offset ) / TWO_TO_POWER_OF_15; F32 presmmHg = ( (F32)pres / (F32)( COUNTS_TO_MILLI_BAR * ONE_BAR_TO_MILLI_BAR ) ) * BAR_TO_MMHG; return presmmHg; } /*********************************************************************//** * @brief * The checkPressureSensors function checks the read and error counters for * each pressure sensor. * @details \b Alarm: ALARM_ID_DD_HYD_OUTLET_PRES_TIMEOUT_FAULT if the * hydraulics outlet pressure sensor is not able to be read. * @details \b Alarm: ALARM_ID_DD_BIBAG_PRES_TIMEOUT_FAULT if the * BiBag pressure sensor is not able to be read. * @details \b Alarm: ALARM_ID_DD_SPENT_DIALYSATE_PRES_TIMEOUT_FAULT if the * spent dialysate pressure sensor is not able to be read. * @details \b Alarm: ALARM_ID_DD_FRESH_DIALYSATE_PRES_TIMEOUT_FAULT if the * fresh dialysate pressure sensor is not able to be read. * @details \b Alarm: ALARM_ID_DD_TRANSMEMB_PRES_TIMEOUT_FAULT if the * Transmembrane pressure sensor is not able to be read. * @details \b Inputs: lastPressureReadCounter, lastPressureErrorCounter * @details \b Outputs: none * @return none *************************************************************************/ static void checkPressureSensors( void ) { checkFPGAPersistentAlarms( FPGA_PERS_ERROR_WATER_INLET_INPUT_PRESSURE, getPressureSensorReadCount( M1_PRES ) ); checkFPGAPersistentAlarms( FPGA_PERS_ERROR_WATER_INLET_OUTPUT_PRESSURE, getPressureSensorReadCount( M3_PRES ) ); checkFPGAPersistentAlarms( FPGA_PERS_ERROR_HYDRAULICS_OUTLET_PRESSURE, getPressureSensorReadCount( D9_PRES ) ); checkFPGAPersistentAlarms( FPGA_PERS_ERROR_BIBAG_PRESSURE, getPressureSensorReadCount( D66_PRES ) ); checkFPGAPersistentAlarms( FPGA_PERS_ERROR_SPENT_DIALYSATE_PRESSURE, getPressureSensorReadCount( D51_PRES ) ); checkFPGAPersistentAlarms( FPGA_PERS_ERROR_FRESH_DIALYSATE_PRESSURE, getPressureSensorReadCount( D18_PRES ) ); checkFPGAPersistentAlarms( FPGA_PERS_ERROR_TRANSMEMBRANE_PRESSURE, getPressureSensorReadCount( D41_PRES ) ); checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_WATER_INLET_INPUT_PRESSURE, getPressureSensorErrorCount( M1_PRES ) ); checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_WATER_INLET_OUTPUT_PRESSURE, getPressureSensorErrorCount( M3_PRES ) ); checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_HYDRAULICS_OUTLET_PRESSURE, getPressureSensorErrorCount( D9_PRES ) ); checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_BIBAG_PRESSURE, getPressureSensorErrorCount( D66_PRES ) ); checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_SPENT_DIALYSATE_PRESSURE, getPressureSensorErrorCount( D51_PRES ) ); checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_FRESH_DIALYSATE_PRESSURE, getPressureSensorErrorCount( D18_PRES ) ); checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_TRANSMEMBRANE_PRESSURE, getPressureSensorErrorCount( D41_PRES ) ); } /*********************************************************************//** * @brief * The getPressure function gets the current pressure (in mmHg) for a given * pressure sensor. * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if given sensor is invalid. * @details \b Inputs: currentPressureReadings * @details \b Outputs: none * @param sensor ID of pressure sensor to get pressure reading for. * @return The current pressure (in mmHg) of the given pressure sensor. *************************************************************************/ F32 getPressure( PRESSURE_SENSORS_T sensor ) { F32 result = 0.0F; if ( sensor < NUM_OF_PRESSURE_SENSORS ) { result = currentPressureReadings[ sensor ].data; if ( OVERRIDE_KEY == currentPressureReadings[ sensor ].override ) { result = currentPressureReadings[ sensor ].ovData; } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_PRESSURE_SENSOR_INVALID_SENSOR1, sensor ) } return result; } /*********************************************************************//** * @brief * The getPressureSensorTemperature function gets the current pressure sensor * temperature (in deg C) for a given pressure sensor. * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if given sensor is invalid. * @details \b Inputs: currentPresTempReadings * @details \b Outputs: none * @param sensor ID of pressure sensor to get temperature reading for. * @return The current pressure sensor temperature (in deg C) of the given pressure sensor. *************************************************************************/ F32 getPressureSensorTemperature( PRESSURE_SENSORS_T sensor ) { F32 result = 0.0F; if ( sensor < NUM_OF_PRESSURE_SENSORS ) { result = currentPresTempReadings[ sensor ].data; if ( OVERRIDE_KEY == currentPresTempReadings[ sensor ].override ) { result = currentPresTempReadings[ sensor ].ovData; } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_PRESSURE_SENSOR_INVALID_SENSOR2, sensor ) } return result; } /*********************************************************************//** * @brief * The getPressureSensorReadCount function gets the current pressure sensor * read count for a given pressure sensor. * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if given sensor is invalid. * @details \b Inputs: lastPressureReadCounter * @details \b Outputs: none * @param sensor ID of pressure sensor to get read count for. * @return The current pressure sensor read count of a given pressure sensor. *************************************************************************/ U32 getPressureSensorReadCount( PRESSURE_SENSORS_T sensor ) { U32 result = 0; if ( sensor < NUM_OF_PRESSURE_SENSORS ) { result = lastPressureReadCounter[ sensor ].data; if ( OVERRIDE_KEY == lastPressureReadCounter[ sensor ].override ) { result = lastPressureReadCounter[ sensor ].ovData; } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_PRESSURE_SENSOR_INVALID_SENSOR3, sensor ) } return result; } /*********************************************************************//** * @brief * The getPressureSensorErrorCount function gets the current pressure sensor * error count for a given pressure sensor. * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if given sensor is invalid. * @details \b Inputs: lastPressureErrorCounter * @details \b Outputs: none * @param sensor ID of pressure sensor to get error count for. * @return The current pressure sensor error count of a given pressure sensor. *************************************************************************/ U32 getPressureSensorErrorCount( PRESSURE_SENSORS_T sensor ) { U32 result = 0; if ( sensor < NUM_OF_PRESSURE_SENSORS ) { result = lastPressureErrorCounter[ sensor ].data; if ( OVERRIDE_KEY == lastPressureErrorCounter[ sensor ].override ) { result = lastPressureErrorCounter[ sensor ].ovData; } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_PRESSURE_SENSOR_INVALID_SENSOR4, sensor ) } return result; } /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ /*********************************************************************//** * @brief * The testPressureSensorReadingsOverride function overrides the value of the * specified pressure sensor with a given value. * @details \b Inputs: none * @details \b Outputs: currentPressureReadings[] * @param message Override message from Dialin which includes an sensor * ID and override value of the pressure sensor. * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testPressureSensorReadingsOverride( MESSAGE_T *message ) { BOOL result = f32ArrayOverride( message, ¤tPressureReadings[0], NUM_OF_PRESSURE_SENSORS - 1 ); return result; } /*********************************************************************//** * @brief * The testPressureSensorTemperatureReadingsOverride function overrides the value of the * specified pressure sensor temperature with a given value. * @details \b Inputs: none * @details \b Outputs: currentPresTempReadings[] * @param message Override message from Dialin which includes an sensor * ID and override value of the pressure sensor temperature. * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testPressureSensorTemperatureReadingsOverride( MESSAGE_T *message ) { BOOL result = f32ArrayOverride( message, ¤tPresTempReadings[0], NUM_OF_PRESSURE_SENSORS - 1 ); return result; } /*********************************************************************//** * @brief * The testPressureSensorReadCounterOverride function overrides the value of the * specified pressure sensor read counter with a given value. * @details \b Inputs: none * @details \b Outputs: lastPressureReadCounter[] * @param message Override message from Dialin which includes an sensor * ID and override value of the pressure sensor read counter. * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testPressureSensorReadCounterOverride( MESSAGE_T *message ) { BOOL result = u32ArrayOverride( message, &lastPressureReadCounter[0], NUM_OF_PRESSURE_SENSORS - 1, 0, PRES_SENSORS_READ_ERR_MAX_CNT ); return result; } /*********************************************************************//** * @brief * The testPressureSensorErrorCounterOverride function overrides the value of the * specified pressure sensor error counter with a given value. * @details \b Inputs: none * @details \b Outputs: lastPressureErrorCounter[] * @param message Override message from Dialin which includes an sensor * ID and override value of the pressure sensor error counter. * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testPressureSensorErrorCounterOverride( MESSAGE_T *message ) { BOOL result = u32ArrayOverride( message, &lastPressureErrorCounter[0], NUM_OF_PRESSURE_SENSORS - 1, 0, PRES_SENSORS_READ_ERR_MAX_CNT ); return result; } /**@}*/