Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -151,7 +151,7 @@ if ( TRUE == isAirTrapControlling() ) { pendingStopAirTrapController = TRUE; - set2WayValveState( H13, STATE_CLOSED ); // Always exit air trap valve control w/ valve closed. + set2WayValveState( H13_VALV, STATE_CLOSED ); // Always exit air trap valve control w/ valve closed. SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, STATE_CLOSED, 0 ); signalLowVenousPressureCheck(); // Venous pressure check should continue even after ending auto air trap control } @@ -202,8 +202,8 @@ } else { - lowerAirTrap = getLevelSensorState( H17 ); - upperAirTrap = getLevelSensorState( H16 ); + lowerAirTrap = getLevelSensorState( H17_LEVL ); + upperAirTrap = getLevelSensorState( H16_LEVL ); isAirTrapLevelsValid = ( ( ( AIR_TRAP_LEVEL_AIR == lowerAirTrap ) && ( AIR_TRAP_LEVEL_FLUID == upperAirTrap ) ) ? TRUE : FALSE ); #ifndef _RELEASE_ @@ -258,7 +258,7 @@ if ( MODE_FAUL == getCurrentOperationMode() ) { airTrapControllerState = AIR_TRAP_MANUAL_CONTROL_STATE; - set2WayValveState( H13, STATE_CLOSED ); + set2WayValveState( H13_VALV, STATE_CLOSED ); SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, STATE_CLOSED, 0 ); pendingStartAirTrapController = FALSE; } @@ -308,7 +308,7 @@ if ( TRUE == pendingStartAirTrapController ) { pendingStartAirTrapController = FALSE; - set2WayValveState( H13, STATE_CLOSED ); + set2WayValveState( H13_VALV, STATE_CLOSED ); SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, STATE_CLOSED, 0 ); result = AIR_TRAP_VALVE_CLOSED_STATE; } @@ -355,7 +355,7 @@ setAirPumpState( AIR_PUMP_STATE_OFF ); } - set2WayValveState( H13, STATE_OPEN ); + set2WayValveState( H13_VALV, STATE_OPEN ); fillStartTime = getMSTimerCount(); SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, STATE_OPEN, 0 ); result = AIR_TRAP_VALVE_OPEN_STATE; @@ -364,16 +364,16 @@ // Turn air pump off after defined time or air detected at upper level else if ( ( AIR_PUMP_STATE_ON == getAirPumpState() ) && ( ( TRUE == didTimeout( stopAirPumpStartTime, airPumpStopTime ) ) || - ( ( AIR_TRAP_LEVEL_AIR == getRawLevelSensorState( H16 ) ) && - ( AIR_TRAP_LEVEL_FLUID == getLevelSensorState( H17 ) ) ) ) ) + ( ( AIR_TRAP_LEVEL_AIR == getRawLevelSensorState( H16_LEVL ) ) && + ( AIR_TRAP_LEVEL_FLUID == getLevelSensorState( H17_LEVL ) ) ) ) ) { setAirPumpState( AIR_PUMP_STATE_OFF ); airPumpOnDelayStartTime = getMSTimerCount(); } // Turn on air pump if fluid reaches upper level. - else if ( AIR_TRAP_LEVEL_FLUID == getLevelSensorState( H16 ) ) + else if ( AIR_TRAP_LEVEL_FLUID == getLevelSensorState( H16_LEVL ) ) { if ( ( AIR_PUMP_STATE_OFF == getAirPumpState() ) && ( TRUE == didTimeout( airPumpOnDelayStartTime, AIR_PUMP_ON_DELAY_TIME_MS ) ) ) @@ -385,15 +385,15 @@ } // Transition to open valve state when air detected at lower level - else if ( ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H16 ) ) && - ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H17 ) ) ) + else if ( ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H16_LEVL ) ) && + ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H17_LEVL ) ) ) { if ( AIR_PUMP_STATE_ON == getAirPumpState() ) { setAirPumpState( AIR_PUMP_STATE_OFF ); } - set2WayValveState( H13, STATE_OPEN ); + set2WayValveState( H13_VALV, STATE_OPEN ); fillStartTime = getMSTimerCount(); SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, STATE_OPEN, 0 ); result = AIR_TRAP_VALVE_OPEN_STATE; @@ -422,9 +422,9 @@ result = AIR_TRAP_MANUAL_CONTROL_STATE; } // Transition to closed valve state when fluid detected at upper level - else if ( AIR_TRAP_LEVEL_FLUID == getRawLevelSensorState( H16 ) ) + else if ( AIR_TRAP_LEVEL_FLUID == getRawLevelSensorState( H16_LEVL ) ) { - set2WayValveState( H13, STATE_CLOSED ); + set2WayValveState( H13_VALV, STATE_CLOSED ); airPumpOnDelayStartTime = u32DiffWithWrap( AIR_PUMP_ON_DELAY_ADJUST_AFTER_FILL, getMSTimerCount() ); signalLowVenousPressureCheck(); SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, STATE_CLOSED, 0 ); @@ -450,11 +450,11 @@ { AIR_TRAP_PAYLOAD_T data; - data.h17State = getLevelSensorState( H17 ); - data.h16State = getLevelSensorState( H16 ); - data.h17RawState = getRawLevelSensorState( H17 ); - data.h16RawState = getRawLevelSensorState( H16 ); - data.h13State = get2WayValveState( H13 ); + data.h17State = getLevelSensorState( H17_LEVL ); + data.h16State = getLevelSensorState( H16_LEVL ); + data.h17RawState = getRawLevelSensorState( H17_LEVL ); + data.h16RawState = getRawLevelSensorState( H16_LEVL ); + data.h13State = get2WayValveState( H13_VALV ); data.controlling = isAirTrapControlling(); broadcastData( MSG_ID_TD_AIR_TRAP_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( AIR_TRAP_PAYLOAD_T ) ); Index: firmware/App/Drivers/BubbleDetector.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/BubbleDetector.c (.../BubbleDetector.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/BubbleDetector.c (.../BubbleDetector.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -15,40 +15,40 @@ * ***************************************************************************/ -#include "BubbleDetector.h" +#include "BubbleDetector.h" #include "FpgaTD.h" -#include "Messaging.h" - +#include "Messaging.h" + /** * @addtogroup BubbleDetector * @{ */ -// ********** private definitions ********** - +// ********** private definitions ********** -// ********** private data ********** - + +// ********** private data ********** + /// Current bubble detected states (overrideable). static OVERRIDE_U32_T currentBubbleState[ NUM_OF_BUBBLE_DETECTORS ]; - + // ********** private function prototypes ********** -/*********************************************************************//** - * @brief - * The initBubbleDetector function initializes the BubbleDetector unit. - * @details \b Inputs: none - * @details \b Outputs: Bubble Detector unit is initialized. - * @return none - *************************************************************************/ +/*********************************************************************//** + * @brief + * The initBubbleDetector function initializes the BubbleDetector unit. + * @details \b Inputs: none + * @details \b Outputs: Bubble Detector unit is initialized. + * @return none + *************************************************************************/ void initBubbleDetector( void ) { - currentBubbleState[ H18 ].data = NO_BUBBLE_DETECTED; - currentBubbleState[ H18 ].ovData = NO_BUBBLE_DETECTED; - currentBubbleState[ H18 ].ovInitData = NO_BUBBLE_DETECTED; - currentBubbleState[ H18 ].override = OVERRIDE_RESET; -} - + currentBubbleState[ H18_BBLD ].data = NO_BUBBLE_DETECTED; + currentBubbleState[ H18_BBLD ].ovData = NO_BUBBLE_DETECTED; + currentBubbleState[ H18_BBLD ].ovInitData = NO_BUBBLE_DETECTED; + currentBubbleState[ H18_BBLD ].override = OVERRIDE_RESET; +} + /*********************************************************************//** * @brief * The readBubbleDetector function gets the current bubble detected state @@ -64,19 +64,19 @@ BOOL bubble; bubble = H18BubbleDetected(); // read current sensor state from FPGA - currentBubbleState[ H18 ].data = (U32)( FALSE == bubble ? NO_BUBBLE_DETECTED : BUBBLE_DETECTED ); + currentBubbleState[ H18_BBLD ].data = (U32)( FALSE == bubble ? NO_BUBBLE_DETECTED : BUBBLE_DETECTED ); } -/*********************************************************************//** - * @brief +/*********************************************************************//** + * @brief * The getBubbleDetectedState function gets the current bubble detected state * for a given bubble detector sensor. - * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given sensor is invalid. - * @details \b Inputs: currentBubbleState[] - * @details \b Outputs: none - * @param sensor ID of bubble detector sensor to get state for. - * @return The current state of the given bubble detector sensor. - *************************************************************************/ + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given sensor is invalid. + * @details \b Inputs: currentBubbleState[] + * @details \b Outputs: none + * @param sensor ID of bubble detector sensor to get state for. + * @return The current state of the given bubble detector sensor. + *************************************************************************/ BUBBLE_STATE_T getBubbleDetectedState( BUBBLE_DETECTOR_T sensor ) { BUBBLE_STATE_T result = NO_BUBBLE_DETECTED; @@ -94,7 +94,7 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_BUBBLE_DETECTOR_INVALID_SENSOR, sensor ) } - return result; + return result; } @@ -119,5 +119,5 @@ return result; } - + /**@}*/ Index: firmware/App/Drivers/BubbleDetector.h =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/BubbleDetector.h (.../BubbleDetector.h) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/BubbleDetector.h (.../BubbleDetector.h) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -14,12 +14,12 @@ * @date (original) 22-Aug-2024 * ***************************************************************************/ - -#ifndef __BUBBLE_DETECTOR_H__ -#define __BUBBLE_DETECTOR_H__ - + +#ifndef __BUBBLE_DETECTOR_H__ +#define __BUBBLE_DETECTOR_H__ + #include "TDCommon.h" - + /** * @defgroup BubbleDetector BubbleDetector * @brief The Bubble Detector unit provides low-level functions for interfacing @@ -29,12 +29,12 @@ * @{ */ -// ********** public definitions ********** - +// ********** public definitions ********** + /// Enumeration of bubble detector sensors. typedef enum Bubble_Detectors { - H18 = 0, ///< H18: Venous bubble detector. + H18_BBLD = 0, ///< H18: Venous bubble detector. NUM_OF_BUBBLE_DETECTORS ///< Number of used internal ADC channels. } BUBBLE_DETECTOR_T; @@ -46,14 +46,14 @@ NUM_OF_BUBBLE_DETECTION_STATES ///< Number of bubble detection states. } BUBBLE_STATE_T; -// ********** public function prototypes ********** - -void initBubbleDetector( void ); +// ********** public function prototypes ********** + +void initBubbleDetector( void ); void readBubbleDetectors( void ); BUBBLE_STATE_T getBubbleDetectedState( BUBBLE_DETECTOR_T sensor ); BOOL testBubbleDetectOverride( MESSAGE_T *message ); - + /**@}*/ -#endif +#endif Index: firmware/App/Drivers/LevelSensors.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/LevelSensors.c (.../LevelSensors.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/LevelSensors.c (.../LevelSensors.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -15,36 +15,36 @@ * ***************************************************************************/ -#include "LevelSensors.h" +#include "LevelSensors.h" #include "FpgaTD.h" #include "Messaging.h" #include "TaskPriority.h" -#include "Timers.h" - +#include "Timers.h" + /** * @addtogroup LevelSensors * @{ */ -// ********** private definitions ********** - +// ********** private definitions ********** + #define AIR_TRAP_LEVEL_DEBOUNCE_TIME_MS ( 400 / TASK_PRIORITY_INTERVAL ) ///< Air trap level sensor debounce time (in priority task intervals). -// ********** private data ********** +// ********** private data ********** static OVERRIDE_U32_T rawLevelStates[ NUM_OF_AIR_TRAP_LEVEL_SENSORS ]; ///< Raw air trap level states before debounce (overrideable). static OVERRIDE_U32_T currentLevelStates[ NUM_OF_AIR_TRAP_LEVEL_SENSORS ]; ///< Current raw level sensor states (overrideable). static U32 airTrapLevelsDebounceTimerCtr[ NUM_OF_AIR_TRAP_LEVEL_SENSORS ]; ///< Debounce timer counter for air trap level sensors. - + // ********** private function prototypes ********** -/*********************************************************************//** - * @brief - * The initLevelSensors function initializes the Level Sensors unit. - * @details \b Inputs: none - * @details \b Outputs: Level Sensors unit is initialized. - * @return none - *************************************************************************/ +/*********************************************************************//** + * @brief + * The initLevelSensors function initializes the Level Sensors unit. + * @details \b Inputs: none + * @details \b Outputs: Level Sensors unit is initialized. + * @return none + *************************************************************************/ void initLevelSensors( void ) { AIR_TRAP_LEVEL_SENSORS_T airTrapLevelSensor; @@ -61,8 +61,8 @@ currentLevelStates[ airTrapLevelSensor ].ovInitData = AIR_TRAP_LEVEL_AIR; currentLevelStates[ airTrapLevelSensor ].override = OVERRIDE_RESET; } -} - +} + /*********************************************************************//** * @brief * The readLevelSensors function gets the current level sensor state @@ -81,8 +81,8 @@ // Get latest raw level sensor states from FPGA getFPGAAirTrapLevels( &lowAir, &highAir ); - currentLevelStates[ H17 ].data = (U32)( FALSE == lowAir ? AIR_TRAP_LEVEL_FLUID : AIR_TRAP_LEVEL_AIR ); - currentLevelStates[ H16 ].data = (U32)( FALSE == highAir ? AIR_TRAP_LEVEL_FLUID : AIR_TRAP_LEVEL_AIR ); + currentLevelStates[ H17_LEVL ].data = (U32)( FALSE == lowAir ? AIR_TRAP_LEVEL_FLUID : AIR_TRAP_LEVEL_AIR ); + currentLevelStates[ H16_LEVL ].data = (U32)( FALSE == highAir ? AIR_TRAP_LEVEL_FLUID : AIR_TRAP_LEVEL_AIR ); // Debounce raw air trap level sensor readings for( airTrapLevelSensor = AIR_TRAP_LEVEL_FIRST; airTrapLevelSensor < NUM_OF_AIR_TRAP_LEVEL_SENSORS; airTrapLevelSensor++ ) @@ -104,16 +104,16 @@ } } -/*********************************************************************//** - * @brief +/*********************************************************************//** + * @brief * The getLevelSensorState function gets the current debounced sensor state * for a given level sensor. - * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given sensor is invalid. - * @details \b Inputs: currentLevelStates[] - * @details \b Outputs: none - * @param sensor ID of level sensor to get state for. - * @return The current state of the given level sensor. - *************************************************************************/ + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given sensor is invalid. + * @details \b Inputs: currentLevelStates[] + * @details \b Outputs: none + * @param sensor ID of level sensor to get state for. + * @return The current state of the given level sensor. + *************************************************************************/ AIR_TRAP_LEVELS_T getLevelSensorState( AIR_TRAP_LEVEL_SENSORS_T sensor ) { AIR_TRAP_LEVELS_T result = AIR_TRAP_LEVEL_AIR; @@ -131,7 +131,7 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_LEVEL_SENSOR_INVALID_SENSOR, sensor ) } - return result; + return result; } /*********************************************************************//** @@ -203,5 +203,5 @@ return result; } - + /**@}*/ Index: firmware/App/Drivers/LevelSensors.h =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/LevelSensors.h (.../LevelSensors.h) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/LevelSensors.h (.../LevelSensors.h) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -14,12 +14,12 @@ * @date (original) 03-Oct-2024 * ***************************************************************************/ - -#ifndef __LEVEL_SENSORS_H__ -#define __LEVEL_SENSORS_H__ - + +#ifndef __LEVEL_SENSORS_H__ +#define __LEVEL_SENSORS_H__ + #include "TDCommon.h" - + /** * @defgroup LevelSensors LevelSensors * @brief The Level sensors unit provides low-level functions to monitor a @@ -29,14 +29,14 @@ * @{ */ -// ********** public definitions ********** - +// ********** public definitions ********** + /// Enumeration of air trap level sensors monitored by this module. typedef enum AirTrapLevelSensors { - H17 = 0, ///< Lower air trap sensor - AIR_TRAP_LEVEL_FIRST = H17, ///< First air trap level sensor - H16, ///< Upper air trap sensor + H17_LEVL = 0, ///< Lower air trap sensor + AIR_TRAP_LEVEL_FIRST = H17_LEVL, ///< First air trap level sensor + H16_LEVL, ///< Upper air trap sensor NUM_OF_AIR_TRAP_LEVEL_SENSORS ///< Number of air trap sensors } AIR_TRAP_LEVEL_SENSORS_T; @@ -48,16 +48,16 @@ NUM_OF_AIR_TRAP_LEVELS ///< Number of air trap level sensor levels } AIR_TRAP_LEVELS_T; -// ********** public function prototypes ********** - -void initLevelSensors( void ); +// ********** public function prototypes ********** + +void initLevelSensors( void ); void readLevelSensors( void ); AIR_TRAP_LEVELS_T getLevelSensorState( AIR_TRAP_LEVEL_SENSORS_T sensor ); AIR_TRAP_LEVELS_T getRawLevelSensorState( AIR_TRAP_LEVEL_SENSORS_T sensor ); BOOL testRawLevelSensorOverride( MESSAGE_T *message ); BOOL testLevelSensorOverride( MESSAGE_T *message ); - + /**@}*/ -#endif +#endif Index: firmware/App/Drivers/PressureSensor.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -122,22 +122,22 @@ U16 h14 = getH14Pressure(); // Update status of pressure sensors - currentPressureStatus[ H2 ] = getPressureStatusFromFPGARegReading( h2 ); - currentPressureStatus[ H14 ] = getPressureStatusFromFPGARegReading( h14 ); + currentPressureStatus[ H2_PRES ] = getPressureStatusFromFPGARegReading( h2 ); + currentPressureStatus[ H14_PRES ] = getPressureStatusFromFPGARegReading( h14 ); // Update and convert raw pressures to mmHg - currentPressureReadings[ H2 ].data = convertPressureRdg2mmHg( h2 ); - currentPressureReadings[ H14 ].data = convertPressureRdg2mmHg( h14 ); + currentPressureReadings[ H2_PRES ].data = convertPressureRdg2mmHg( h2 ); + currentPressureReadings[ H14_PRES ].data = convertPressureRdg2mmHg( h14 ); // Update and convert raw pressure sensor temperatures to deg C - currentPresTempReadings[ H2 ].data = convertPressureTempReading2DegC( getH2Temperature() ); - currentPresTempReadings[ H14 ].data = convertPressureTempReading2DegC( getH14Temperature() ); + currentPresTempReadings[ H2_PRES ].data = convertPressureTempReading2DegC( getH2Temperature() ); + currentPresTempReadings[ H14_PRES ].data = convertPressureTempReading2DegC( getH14Temperature() ); // Update read and error counters for each pressure sensor - lastPressureReadCounter[ H2 ].data = (U32)getH2ReadCounter(); - lastPressureReadCounter[ H14 ].data = (U32)getH14ReadCounter(); - lastPressureErrorCounter[ H2 ].data = (U32)getH2ErrorCounter(); - lastPressureErrorCounter[ H14 ].data = (U32)getH14ErrorCounter(); + lastPressureReadCounter[ H2_PRES ].data = (U32)getH2ReadCounter(); + lastPressureReadCounter[ H14_PRES ].data = (U32)getH14ReadCounter(); + lastPressureErrorCounter[ H2_PRES ].data = (U32)getH2ErrorCounter(); + lastPressureErrorCounter[ H14_PRES ].data = (U32)getH14ErrorCounter(); // Monitor pressure sensor health checkPressureSensors(); @@ -196,17 +196,17 @@ *************************************************************************/ static void checkPressureSensors( void ) { - checkFPGAPersistentAlarms( FPGA_PERS_ERROR_ARTERIAL_PRESSURE_SENSOR, getPressureSensorReadCount( H2 ) ); - checkFPGAPersistentAlarms( FPGA_PERS_ERROR_VENOUS_PRESSURE_SESNOR, getPressureSensorReadCount( H14 ) ); - checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_ARTERIAL_PRESSURE_SENSOR, getPressureSensorErrorCount( H2 ) ); - checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_VENOUS_PRESSURE_SESNOR, getPressureSensorErrorCount( H14 ) ); + checkFPGAPersistentAlarms( FPGA_PERS_ERROR_ARTERIAL_PRESSURE_SENSOR, getPressureSensorReadCount( H2_PRES ) ); + checkFPGAPersistentAlarms( FPGA_PERS_ERROR_VENOUS_PRESSURE_SESNOR, getPressureSensorReadCount( H14_PRES ) ); + checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_ARTERIAL_PRESSURE_SENSOR, getPressureSensorErrorCount( H2_PRES ) ); + checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_VENOUS_PRESSURE_SESNOR, getPressureSensorErrorCount( H14_PRES ) ); // verify status of pressure sensors - if ( currentPressureStatus[ H2 ] != PRESSURE_NORMAL_OP ) + if ( currentPressureStatus[ H2_PRES ] != PRESSURE_NORMAL_OP ) { // TODO - alarm? } - if ( currentPressureStatus[ H14 ] != PRESSURE_NORMAL_OP ) + if ( currentPressureStatus[ H14_PRES ] != PRESSURE_NORMAL_OP ) { // TODO - alarm? } Index: firmware/App/Drivers/PressureSensor.h =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/PressureSensor.h (.../PressureSensor.h) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/PressureSensor.h (.../PressureSensor.h) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -14,12 +14,12 @@ * @date (original) 22-Aug-2024 * ***************************************************************************/ - -#ifndef __PRESSURE_SENSOR_H__ -#define __PRESSURE_SENSOR_H__ - -#include "TDCommon.h" - + +#ifndef __PRESSURE_SENSOR_H__ +#define __PRESSURE_SENSOR_H__ + +#include "TDCommon.h" + /** * @defgroup PressureSensor PressureSensor * @brief The Pressure Sensor unit provides low-level functions for interfacing @@ -29,27 +29,27 @@ * @{ */ -// ********** public definitions ********** - +// ********** public definitions ********** + /// Enumeration of pressure sensors monitored by this unit. typedef enum PressureSensors { - H2 = 0, ///< Arterial blood line pressure sensor - H14, ///< Vensous blood line pressure sensor + H2_PRES = 0, ///< Arterial blood line pressure sensor + H14_PRES, ///< Vensous blood line pressure sensor NUM_OF_PRESSURE_SENSORS ///< Number of pressure sensors } PRESSURE_SENSORS_T; - -// ********** public function prototypes ********** - + +// ********** public function prototypes ********** + void initPressureSensor( void ); void readPressureSensors( void ); F32 getPressure( PRESSURE_SENSORS_T sensor ); F32 getPressureSensorTemperature( PRESSURE_SENSORS_T sensor ); U32 getPressureSensorReadCount( PRESSURE_SENSORS_T sensor ); U32 getPressureSensorErrorCount( PRESSURE_SENSORS_T sensor ); - + BOOL testPressureSensorOverride( MESSAGE_T *message ); /**@}*/ -#endif +#endif Index: firmware/App/Drivers/RotaryValve.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/RotaryValve.c (.../RotaryValve.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/RotaryValve.c (.../RotaryValve.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -83,8 +83,8 @@ } // set valve control bits once at startup - setH1Control( valveControl[ H1 ] ); - setH19Control( valveControl[ H19 ] ); + setH1Control( valveControl[ H1_VALV ] ); + setH19Control( valveControl[ H19_VALV ] ); } /*********************************************************************//** @@ -105,12 +105,12 @@ S16 cmdPos[ NUM_OF_VALVES ]; // Get latest valve status and positions from FPGA - cmdPos[ H19 ] = getH19CmdPosition(); - currentValveEncPosition[ H19 ].data = (S32)getValveEncoderPosition( H19 ); - valveStatus[ H19 ].data = getH19Status(); - cmdPos[ H1 ] = getH1CmdPosition(); - currentValveEncPosition[ H1 ].data = (S32)getValveEncoderPosition( H1 ); - valveStatus[ H1 ].data = getH1Status(); + cmdPos[ H19_VALV ] = getH19CmdPosition(); + currentValveEncPosition[ H19_VALV ].data = (S32)getValveEncoderPosition( H19_VALV ); + valveStatus[ H19_VALV ].data = getH19Status(); + cmdPos[ H1_VALV ] = getH1CmdPosition(); + currentValveEncPosition[ H1_VALV ].data = (S32)getValveEncoderPosition( H1_VALV ); + valveStatus[ H1_VALV ].data = getH1Status(); // TODO check commanded position vs. commanded position read back from FPGA - alarm different for some persistent period of time @@ -155,7 +155,7 @@ mag = (S16)(abs(chg)); // give FPGA valve change command commandValvePosChange[ valve ] = chg; - if ( H1 == valve ) + if ( H1_VALV == valve ) { ctrl = getH1Control(); if ( MOTOR_DIR_REVERSE == dir ) Index: firmware/App/Drivers/RotaryValve.h =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/RotaryValve.h (.../RotaryValve.h) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/RotaryValve.h (.../RotaryValve.h) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -41,9 +41,9 @@ /// rotary pinch valve names typedef enum valveNames { - H1 = 0, ///< Arterial rotary pinch valve - FIRST_VALVE = H1, ///< First valve - H19, ///< Venous rotary pinch valve + H1_VALV = 0, ///< Arterial rotary pinch valve + FIRST_VALVE = H1_VALV, ///< First valve + H19_VALV, ///< Venous rotary pinch valve NUM_OF_VALVES ///< Number of valves } VALVE_T; Index: firmware/App/Drivers/Valve2Way.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/Valve2Way.c (.../Valve2Way.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/Valve2Way.c (.../Valve2Way.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -51,7 +51,7 @@ void init2WayValves(void) { // Close all 2-way valves - current2WayValveStates[ H13 ] = STATE_CLOSED; + current2WayValveStates[ H13_VALV ] = STATE_CLOSED; setH13ValveState( STATE_CLOSED ); } @@ -70,7 +70,7 @@ { if ( ( valve < NUM_OF_2_WAY_VALVES ) && ( state < NUM_OF_OPN_CLS_STATES ) ) { - if ( H13 == valve ) + if ( H13_VALV == valve ) { // if state is changing, set the valve to the given open/closed state if ( state != current2WayValveStates[ valve ] ) Index: firmware/App/Drivers/Valve2Way.h =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Drivers/Valve2Way.h (.../Valve2Way.h) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Drivers/Valve2Way.h (.../Valve2Way.h) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -36,7 +36,7 @@ /// 2 way valve names typedef enum valves2WayNames { - H13 = 0, ///< Air trap relief valve + H13_VALV = 0, ///< Air trap relief valve NUM_OF_2_WAY_VALVES ///< Number of 2 way valves } VALVE_2_WAY_T; Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -109,7 +109,7 @@ // Ensure all valves are in safe position // setValveAirTrap( STATE_CLOSED ); -// setValvePosition( H1, VALVE_POSITION_C_CLOSE ); +// setValvePosition( H1_VALV, VALVE_POSITION_C_CLOSE ); // setValvePosition( H19, VALVE_POSITION_C_CLOSE ); // If DG not stopped, stop it Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -72,7 +72,7 @@ // setAirPumpState( AIR_PUMP_STATE_OFF ); // setValveAirTrap( STATE_CLOSED ); -// setValvePosition( H1, VALVE_POSITION_A_INSERT_EJECT ); +// setValvePosition( H1_VALV, VALVE_POSITION_A_INSERT_EJECT ); // setValvePosition( H19, VALVE_POSITION_A_INSERT_EJECT ); return 0; Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -79,7 +79,7 @@ // Set valves to default positions // setValveAirTrap( STATE_CLOSED ); -// setValvePosition( H1, VALVE_POSITION_A_INSERT_EJECT ); +// setValvePosition( H1_VALV, VALVE_POSITION_A_INSERT_EJECT ); // setValvePosition( H19, VALVE_POSITION_A_INSERT_EJECT ); // doorClosedRequired( FALSE, FALSE ); // door no longer required to be closed in standby mode @@ -137,7 +137,7 @@ HD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; // Wait for door to be closed so we can home actuators -// if ( STATE_CLOSED == getSwitchState( FRONT_DOOR ) ) +// if ( STATE_CLOSED == getSwitchState( H9_SWCH ) ) // { // // If we haven't already initiated homing of actuators, initiate now // if ( homingInitiated != TRUE ) @@ -278,7 +278,7 @@ // // // Set valves to safe positions // setValveAirTrap( STATE_CLOSED ); -// setValvePosition( H1, VALVE_POSITION_C_CLOSE ); +// setValvePosition( H1_VALV, VALVE_POSITION_C_CLOSE ); // setValvePosition( H19, VALVE_POSITION_C_CLOSE ); // } break; Index: firmware/App/Monitors/Bubbles.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Monitors/Bubbles.c (.../Bubbles.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Monitors/Bubbles.c (.../Bubbles.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -225,7 +225,7 @@ bubblesSelfTestRequested[ bubble ] = FALSE; bubblesSelfTestStatus[ bubble ] = SELF_TEST_STATUS_IN_PROGRESS; - if ( H18 == bubble ) + if ( H18_BBLD == bubble ) { setFPGAVenousBubbleSelfTest(); } @@ -261,7 +261,7 @@ if ( BUBBLE_DETECTED == getBubbleDetectedState( bubble ) ) // Faked air bubble caused { bubblesSelfTestStatus[ bubble ] = SELF_TEST_STATUS_PASSED; - if ( H18 == bubble ) + if ( H18_BBLD == bubble ) { clearFPGAVenousBubbleSelfTest(); } @@ -305,8 +305,8 @@ { BUBBLES_DATA_T bubbleData; - bubbleData.statusH18 = (U32)getBubbleDetectedState( H18 ); - bubbleData.stateH18 = (U32)bubblesState[ H18 ]; + bubbleData.statusH18 = (U32)getBubbleDetectedState( H18_BBLD ); + bubbleData.stateH18 = (U32)bubblesState[ H18_BBLD ]; broadcastData( MSG_ID_TD_BUBBLES_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&bubbleData, sizeof( BUBBLES_DATA_T ) ); bubblesDataPublicationTimerCounter = 0; } Index: firmware/App/Monitors/Pressures.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -520,8 +520,8 @@ static PRESSURE_STATE_T handlePressureContReadState( void ) { PRESSURE_STATE_T result = PRESSURE_CONTINUOUS_READ_STATE; - F32 fpgaArtPres = getPressure( H2 ) - arterialPressureOffset; - F32 fpgaVenPres = getPressure( H14 ) - venousPressureOffset; + F32 fpgaArtPres = getPressure( H2_PRES ) - arterialPressureOffset; + F32 fpgaVenPres = getPressure( H14_PRES ) - venousPressureOffset; // Filter inline pressure readings filterInlinePressureReadings( fpgaArtPres, fpgaVenPres ); Index: firmware/App/Monitors/Switches.c =================================================================== diff -u -ra0d405d152c0f451ebf3c25e3c2cfa49a4db17cd -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Monitors/Switches.c (.../Switches.c) (revision a0d405d152c0f451ebf3c25e3c2cfa49a4db17cd) +++ firmware/App/Monitors/Switches.c (.../Switches.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -89,7 +89,7 @@ OPN_CLS_STATE_T currentSwitchStates[ NUM_OF_SWITCHES ]; // Get current state of each switch - currentSwitchStates[ FRONT_DOOR ] = ( FALSE == getFPGAFrontDoorClosedStatus() ? STATE_OPEN : STATE_CLOSED ); + currentSwitchStates[ H9_SWCH ] = ( FALSE == getFPGAFrontDoorClosedStatus() ? STATE_OPEN : STATE_CLOSED ); // Debounce each switch for ( i = 0; i < NUM_OF_SWITCHES; i++ ) @@ -150,14 +150,14 @@ // Check for door closed alarm if ( TRUE == requireDoorClosed ) { - if ( getSwitchState( FRONT_DOOR ) != STATE_CLOSED ) + if ( getSwitchState( H9_SWCH ) != STATE_CLOSED ) { activateAlarmNoData( ALARM_ID_TD_CARTRIDGE_DOOR_OPENED ); } } // Handle clearing alarm conditions - if ( STATE_CLOSED == getSwitchState( FRONT_DOOR ) ) + if ( STATE_CLOSED == getSwitchState( H9_SWCH ) ) { clearAlarmCondition( ALARM_ID_TD_CARTRIDGE_DOOR_OPENED ); } @@ -225,7 +225,7 @@ SWITCHES_DATA_T data; switchesDataPublicationCounter = 0; - data.frontDoor = (U32)getSwitchState( FRONT_DOOR ); + data.h9Door = (U32)getSwitchState( H9_SWCH ); broadcastData( MSG_ID_TD_SWITCHES_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( SWITCHES_DATA_T ) ); } } Index: firmware/App/Monitors/Switches.h =================================================================== diff -u -r3a8cf075eb6f0d255f516ac26bac7fbaacfde14a -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Monitors/Switches.h (.../Switches.h) (revision 3a8cf075eb6f0d255f516ac26bac7fbaacfde14a) +++ firmware/App/Monitors/Switches.h (.../Switches.h) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -34,14 +34,14 @@ /// TD switches enumeration typedef enum switch_names { - FRONT_DOOR = 0, ///< Front door switch + H9_SWCH = 0, ///< Front door switch NUM_OF_SWITCHES ///< Number of switches } SWITCH_T; /// TD switches data publish structure typedef struct { - U32 frontDoor; ///< Front door + U32 h9Door; ///< Front door } SWITCHES_DATA_T; // ********** public function prototypes ********** Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -reffc2a8283d6528109b2401bbad70dc554db4e53 -re69d7ce1c9d88695e25e8ea94529dffdd8592434 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision effc2a8283d6528109b2401bbad70dc554db4e53) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision e69d7ce1c9d88695e25e8ea94529dffdd8592434) @@ -59,7 +59,7 @@ #define FPGA_BACKUP_ALARM_AUDIO_CONVERT 0.4F ///< Converts backup (piezo) alarm audio ADC volts to amps. -#define FRONT_DOOR_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. +#define H9_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. #define PUMP_TRACK_SWITCH_MASK 0x0020 ///< Pump track switch bit mask. Bit 5 of the GPIO register. #define FPGA_AIRTRAP_LEVEL_LOW_H17_MASK 0x0008 ///< Bit mask for air trap lower level sensor. @@ -979,7 +979,7 @@ { BOOL result = TRUE; - if ( ( fpgaSensorReadings.GPIOReg & FRONT_DOOR_SWITCH_MASK ) != 0 ) + if ( ( fpgaSensorReadings.GPIOReg & H9_SWITCH_MASK ) != 0 ) { result = FALSE; }