Index: firmware/App/Controllers/AirPump.c =================================================================== diff -u -r552a7de419344b43a3307c61141c99bfbbee7345 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 552a7de419344b43a3307c61141c99bfbbee7345) +++ firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -74,7 +74,7 @@ * The setAirPumpState function sets the current air pump state machine state. * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if invalid state given. * @details \b Inputs: currentAirPumpState - * @details \b Outputs: currentAirPumpState + * @details \b Outputs: currentAirPumpState, currentAirPumpMotorPowerLevel * @param state Air pump state to set * @param power Power level to set air pump to * @return none Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -r4022a06181f6f6d58ccfd465159d95f0df1b0393 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 4022a06181f6f6d58ccfd465159d95f0df1b0393) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -67,8 +67,8 @@ static U32 airTrapDataPublicationTimerCounter; ///< Used to schedule air trap data publication to CAN bus. static OVERRIDE_U32_T airTrapDataPublishInterval; ///< Interval (in ms) at which to publish air trap data to CAN bus. -static BOOL pendingStartAirTrapController = FALSE; ///< Flag indicates an air trap controller start request is pending. -static BOOL pendingStopAirTrapController = FALSE; ///< Flag indicates an air trap controller stop request is pending. +static BOOL pendingStartAirTrapController; ///< Flag indicates an air trap controller start request is pending. +static BOOL pendingStopAirTrapController; ///< Flag indicates an air trap controller stop request is pending. static U32 airTrapFillStartTime; ///< Air trap fill (raise level) operation start time. static U32 airTrapLowerStartTime; ///< Air trap lower level operation start time. @@ -146,7 +146,6 @@ /*********************************************************************//** * @brief * The endAirTrapControl function requests a stop to air trap control. - * @details \b Message \b Sent: MSG_ID_TD_EVENT if air trap control ended. * @details \b Inputs: airTrapControllerState * @details \b Outputs: pendingStopAirTrapController * @return none @@ -193,8 +192,8 @@ { BOOL isAirTrapLevelsValid = FALSE; - // Update level sensors from FPGA - readLevelSensors(); + // Update air trap level sensors from FPGA + readAirTrapLevelSensors(); // Check for illegal levels alarm if ( TRUE ) // TODO - need a way to determine whether a blood set is installed - if not installed, we would not trigger illegal levels alarm @@ -207,7 +206,7 @@ AIR_TRAP_LEVELS_T lowerAirTrap = getLevelSensorState( H17_LEVL ); AIR_TRAP_LEVELS_T upperAirTrap = getLevelSensorState( H16_LEVL ); - isAirTrapLevelsValid = ( ( ( AIR_TRAP_LEVEL_AIR == lowerAirTrap ) && ( AIR_TRAP_LEVEL_FLUID == upperAirTrap ) ) ? TRUE : FALSE ); + isAirTrapLevelsValid = ( ( ( AIR_TRAP_LEVEL_AIR == lowerAirTrap ) && ( AIR_TRAP_LEVEL_FLUID == upperAirTrap ) ) ? TRUE : FALSE ); #ifndef _RELEASE_ // if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ILLEGAL_AIR_TRAP_ALARM ) != SW_CONFIG_ENABLE_VALUE ) @@ -314,9 +313,8 @@ { pendingStartAirTrapController = FALSE; setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); - set3WayValveState( H13_VALV, STATE_CLOSED ); - set3WayValveState( H20_VALV, STATE_CLOSED ); - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, 0, 0 ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); result = AIR_TRAP_CLOSED_STATE; } @@ -349,11 +347,11 @@ if ( ( AIR_PUMP_STATE_OFF == getAirPumpState() ) && ( TRUE == didTimeout( airTrapLowerDelayStartTime, AIR_PUMP_ON_DELAY_TIME_MS ) ) ) { - set3WayValveState( H13_VALV, STATE_OPEN ); // open valve H13 to allow air to be pumped into air trap from atmosphere + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); // open valve H13 to allow air to be pumped into air trap from atmosphere setAirPumpState( AIR_PUMP_STATE_ON, AIR_PUMP_MOTOR_LOWER_PWM ); airTrapLowerStartTime = getMSTimerCount(); signalInitiatePressureStabilization( USE_SHORT_STABILIZATION_PERIOD ); - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_LOWER, 1, 0 ); + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_LOWER, ON, 0 ); result = AIR_TRAP_LOWER_LEVEL_STATE; } } @@ -363,9 +361,9 @@ ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H16_LEVL ) ) ) { setAirPumpState( AIR_PUMP_STATE_ON, AIR_PUMP_MOTOR_FILL_PWM ); - set3WayValveState( H20_VALV, STATE_OPEN ); // open valve H20 to allow air to be pumped out of air trap to atmosphere + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); // open valve H20 to allow air to be pumped out of air trap to atmosphere airTrapFillStartTime = getMSTimerCount(); - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, 1, 0 ); + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, ON, 0 ); result = AIR_TRAP_RAISE_LEVEL_STATE; } @@ -390,18 +388,18 @@ { pendingStopAirTrapController = FALSE; setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); - set3WayValveState( H20_VALV, STATE_CLOSED ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); result = AIR_TRAP_MANUAL_CONTROL_STATE; } - // Transition back to closed state when air trap fill completed TODO - timeout??? + // Transition back to closed state when air trap fill completed else if ( AIR_TRAP_LEVEL_FLUID == getRawLevelSensorState( H16_LEVL ) ) { airTrapWasFilledAtStartOfTreatement = TRUE; setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); - set3WayValveState( H20_VALV, STATE_CLOSED ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); airTrapLowerDelayStartTime = calcTimeBetween( AIR_PUMP_ON_DELAY_ADJUST_AFTER_FILL, getMSTimerCount() ); signalLowVenousPressureCheck(); - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, 0, 0 ); + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_FILL, OFF, 0 ); result = AIR_TRAP_CLOSED_STATE; } @@ -430,7 +428,7 @@ { pendingStopAirTrapController = FALSE; setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); - set3WayValveState( H13_VALV, STATE_CLOSED ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); result = AIR_TRAP_MANUAL_CONTROL_STATE; } // Transition back to closed state when air trap lower level operation completed @@ -439,9 +437,9 @@ { setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); - set3WayValveState( H13_VALV, STATE_CLOSED ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); airTrapLowerDelayStartTime = getMSTimerCount(); - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_LOWER, 0, 0 ); + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_LOWER, OFF, 0 ); // if lower level operation times out, alarm if ( TRUE == didTimeout( airTrapLowerStartTime, airPumpStopTime ) ) { @@ -457,7 +455,7 @@ * @brief * The publishAirTrapData function constructs and sends the air trap data * broadcast message. - * @details \b Message \b Sent: MSG_ID_TD_AIR_TRAP_DATA + * @details \b Message \b Sent: MSG_ID_TD_AIR_TRAP_DATA to publish air trap data * @details \b Inputs: airTrapDataPublicationTimerCounter, airTrapControllerState, TODO valvestate * @details \b Outputs: airTrapDataPublicationTimerCounter * @return none @@ -475,7 +473,7 @@ data.h16RawState = getRawLevelSensorState( H16_LEVL ); data.h13State = get3WayValveState( H13_VALV ); data.h20State = get3WayValveState( H20_VALV ); - data.controlling = isAirTrapControlling(); + data.isAutoControlling = isAirTrapControlling(); broadcastData( MSG_ID_TD_AIR_TRAP_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( AIR_TRAP_PAYLOAD_T ) ); airTrapDataPublicationTimerCounter = 0; Index: firmware/App/Controllers/AirTrap.h =================================================================== diff -u -r552a7de419344b43a3307c61141c99bfbbee7345 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Controllers/AirTrap.h (.../AirTrap.h) (revision 552a7de419344b43a3307c61141c99bfbbee7345) +++ firmware/App/Controllers/AirTrap.h (.../AirTrap.h) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -42,7 +42,7 @@ U32 h16RawState; ///< Raw Upper air trap level sensor state U32 h13State; ///< Is air trap intake valve open or closed U32 h20State; ///< Is air trap outlet valve open or closed - BOOL controlling; ///< Flag indicates whether air trap level is being auto controlled + BOOL isAutoControlling; ///< Flag indicates whether air trap level is being auto controlled } AIR_TRAP_PAYLOAD_T; // ********** public function prototypes ********** Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rf1d812de6fbaf4943d05bbee2271bcb61138325a -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision f1d812de6fbaf4943d05bbee2271bcb61138325a) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -54,8 +54,8 @@ #define BP_MAX_ROTOR_SPEED_RPM 100.0F ///< Maximum rotor speed allowed for blood pump. -#define BP_MAX_FLOW_RATE 1320.0F ///< Maximum measured BP flow rate alarm threshold. -#define BP_MIN_FLOW_RATE -1320.0F ///< Minimum measured BP flow rate alarm threshold. +#define BP_MAX_FLOW_RATE 1320.0F ///< Maximum measured BP flow rate alarm threshold. +#define BP_MIN_FLOW_RATE -1320.0F ///< Minimum measured BP flow rate alarm threshold. #define BP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0F ///< Maximum motor speed (RPM) while motor is commanded off. #define BP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0F ///< Maximum difference in speed between motor and rotor (in rotor RPM). #define BP_MAX_MOTOR_SPEED_ERROR_RPM 300.0F ///< Maximum difference in speed between measured and commanded RPM. Index: firmware/App/Drivers/GLXferPump.c =================================================================== diff -u -r552a7de419344b43a3307c61141c99bfbbee7345 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision 552a7de419344b43a3307c61141c99bfbbee7345) +++ firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -39,7 +39,7 @@ * The initGasLiqXferPumpDriver function initializes the gas/liquid transfer * pump driver unit. * @details \b Inputs: none - * @details \b Outputs: currentAirPumpMotorState + * @details \b Outputs: currentAirPumpMotorPowerLevel * @return none *************************************************************************/ void initGasLiqXferPumpDriver(void) @@ -50,11 +50,11 @@ /*********************************************************************//** * @brief - * The setAirPumpMotorState function sets the air pump motor to the given + * The setAirPumpMotorPower function sets the air pump motor to the given * power level. - * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if invalid state given. + * @details \b Message \b Sent: MSG_ID_TD_EVENT if changing air pump power level. * @details \b Inputs: none - * @details \b Outputs: currentAirPumpMotorState + * @details \b Outputs: currentAirPumpMotorPowerLevel * @param power Power level for air pump (0=off, 1..255=lower to higher power level). * @return none. *************************************************************************/ @@ -73,7 +73,7 @@ * @brief * The getAirPumpMotorState function gets the current set power level of the * air pump motor. - * @details \b Inputs: currentAirPumpMotorState + * @details \b Inputs: currentAirPumpMotorPowerLevel * @details \b Outputs: none * @return Current set power level of the air pump motor. *************************************************************************/ @@ -92,7 +92,7 @@ * @brief * The testSetAirPump function sets the air pump to a given state (on/off). * @details \b Inputs: none - * @details \b Outputs: currentAirPumpState + * @details \b Outputs: currentAirPumpMotorPowerLevel * @param message set message from Dialin which includes the state to set * the air pump to. * @return TRUE if set request is successful, FALSE if not @@ -110,8 +110,11 @@ U32 power; memcpy( &power, message->payload, sizeof(U32) ); - setAirPumpMotorPower( (U08)power ); - result = TRUE; + if ( power <= AIR_PUMP_MOTOR_MAX_PWM ) + { + setAirPumpMotorPower( (U08)power ); + result = TRUE; + } } } Index: firmware/App/Drivers/GLXferPump.h =================================================================== diff -u -r16219f68040cc257728be31ce24f7e23e2769f48 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision 16219f68040cc257728be31ce24f7e23e2769f48) +++ firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -34,6 +34,7 @@ // ********** public definitions ********** #define AIR_PUMP_MOTOR_OFF 0 ///< Power level setting (PWM) for H12 air pump to turn pump off. +#define AIR_PUMP_MOTOR_MAX_PWM 255 ///< Power level setting (PWM) maximum for H12 air pump. #define AIR_PUMP_MOTOR_FILL_PWM 50 ///< Power level setting (PWM) for H12 air pump to fill (raise level) the air trap. #define AIR_PUMP_MOTOR_LOWER_PWM 150 ///< Power level setting (PWM) for H12 air pump to lower the level of the air trap. Index: firmware/App/Drivers/LevelSensors.c =================================================================== diff -u -rf1d812de6fbaf4943d05bbee2271bcb61138325a -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Drivers/LevelSensors.c (.../LevelSensors.c) (revision f1d812de6fbaf4943d05bbee2271bcb61138325a) +++ firmware/App/Drivers/LevelSensors.c (.../LevelSensors.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -65,7 +65,7 @@ /*********************************************************************//** * @brief - * The readLevelSensors function gets the current level sensor state + * The readAirTrapLevelSensors function gets the current level sensor state * for a all level sensors from the FPGA. * @note This function should be called periodically to maintain fresh * sensor readings for all level sensors. @@ -74,7 +74,7 @@ * airTrapLevelsDebounceStartTime[] * @return none *************************************************************************/ -void readLevelSensors( void ) +void readAirTrapLevelSensors( void ) { BOOL lowAir, highAir; AIR_TRAP_LEVEL_SENSORS_T airTrapLevelSensor; Index: firmware/App/Drivers/LevelSensors.h =================================================================== diff -u -r961784c895cb8f551a2623cd02dcbfe42d04b7c2 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Drivers/LevelSensors.h (.../LevelSensors.h) (revision 961784c895cb8f551a2623cd02dcbfe42d04b7c2) +++ firmware/App/Drivers/LevelSensors.h (.../LevelSensors.h) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -51,7 +51,7 @@ // ********** public function prototypes ********** void initLevelSensors( void ); -void readLevelSensors( void ); +void readAirTrapLevelSensors( void ); AIR_TRAP_LEVELS_T getLevelSensorState( AIR_TRAP_LEVEL_SENSORS_T sensor ); AIR_TRAP_LEVELS_T getRawLevelSensorState( AIR_TRAP_LEVEL_SENSORS_T sensor ); Index: firmware/App/Drivers/Valve3Way.c =================================================================== diff -u -r552a7de419344b43a3307c61141c99bfbbee7345 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Drivers/Valve3Way.c (.../Valve3Way.c) (revision 552a7de419344b43a3307c61141c99bfbbee7345) +++ firmware/App/Drivers/Valve3Way.c (.../Valve3Way.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -28,7 +28,7 @@ // ********** private definitions ********** -/// Payload record structure for 2-way valve set request +/// Payload record structure for 3-way valve set request typedef struct { U32 valve; ///< which 3-way valve to set (0=H13, 1=H20) @@ -37,7 +37,7 @@ // ********** private data ********** -static OPN_CLS_STATE_T current3WayValveStates[ NUM_OF_3_WAY_VALVES ]; ///< Current 3-way valve states (open/closed). +static VALVE_3WAY_STATE_T current3WayValveStates[ NUM_OF_3_WAY_VALVES ]; ///< Current 3-way valve states (open/closed). // ********** private function prototypes ********** @@ -51,9 +51,9 @@ void init3WayValves(void) { // Close all 3-way valves - current3WayValveStates[ H13_VALV ] = STATE_CLOSED; - current3WayValveStates[ H20_VALV ] = STATE_CLOSED; - setH13ValveState( STATE_CLOSED ); + current3WayValveStates[ H13_VALV ] = VALVE_3WAY_COMMON_TO_CLOSED_STATE; + current3WayValveStates[ H20_VALV ] = VALVE_3WAY_COMMON_TO_CLOSED_STATE; + setH13ValveState( VALVE_3WAY_COMMON_TO_CLOSED_STATE ); } /*********************************************************************//** @@ -67,7 +67,7 @@ * @param state ID of state to set valve to * @return none. *************************************************************************/ -void set3WayValveState( VALVE_3_WAY_T valve, OPN_CLS_STATE_T state ) +void set3WayValveState( VALVE_3_WAY_T valve, VALVE_3WAY_STATE_T state ) { if ( ( valve < NUM_OF_3_WAY_VALVES ) && ( state < NUM_OF_OPN_CLS_STATES ) ) { @@ -101,9 +101,9 @@ * @details \b Outputs: none * @return Current state of the given 3-way valve. *************************************************************************/ -OPN_CLS_STATE_T get3WayValveState( VALVE_3_WAY_T valve ) +VALVE_3WAY_STATE_T get3WayValveState( VALVE_3_WAY_T valve ) { - OPN_CLS_STATE_T result = STATE_CLOSED; + VALVE_3WAY_STATE_T result = VALVE_3WAY_COMMON_TO_CLOSED_STATE; if ( valve < NUM_OF_3_WAY_VALVES ) { @@ -146,9 +146,9 @@ VALVE_3_WAY_SET_CMD_PAYLOAD_T payload; memcpy( &payload, message->payload, sizeof(VALVE_3_WAY_SET_CMD_PAYLOAD_T) ); - if ( ( (VALVE_3_WAY_T)payload.valve < NUM_OF_3_WAY_VALVES ) && ( (OPN_CLS_STATE_T)payload.state < NUM_OF_OPN_CLS_STATES ) ) + if ( ( (VALVE_3_WAY_T)payload.valve < NUM_OF_3_WAY_VALVES ) && ( (VALVE_3WAY_STATE_T)payload.state < NUM_OF_OPN_CLS_STATES ) ) { - set3WayValveState( (VALVE_3_WAY_T)payload.valve, (OPN_CLS_STATE_T)payload.state ); + set3WayValveState( (VALVE_3_WAY_T)payload.valve, (VALVE_3WAY_STATE_T)payload.state ); result = TRUE; } } Index: firmware/App/Drivers/Valve3Way.h =================================================================== diff -u -r552a7de419344b43a3307c61141c99bfbbee7345 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Drivers/Valve3Way.h (.../Valve3Way.h) (revision 552a7de419344b43a3307c61141c99bfbbee7345) +++ firmware/App/Drivers/Valve3Way.h (.../Valve3Way.h) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -49,8 +49,8 @@ // ********** public function prototypes ********** void init3WayValves( void ); -void set3WayValveState( VALVE_3_WAY_T valve, OPN_CLS_STATE_T state ); -OPN_CLS_STATE_T get3WayValveState( VALVE_3_WAY_T valve ); +void set3WayValveState( VALVE_3_WAY_T valve, VALVE_3WAY_STATE_T state ); +VALVE_3WAY_STATE_T get3WayValveState( VALVE_3_WAY_T valve ); BOOL testSet3WayValve( MESSAGE_T *message ); Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r961784c895cb8f551a2623cd02dcbfe42d04b7c2 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 961784c895cb8f551a2623cd02dcbfe42d04b7c2) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -27,13 +27,13 @@ // ********** private data ********** -static HD_FAULT_STATE_T faultState; ///< Currently active fault state. +static TD_FAULT_STATE_T faultState; ///< Currently active fault state. static SELF_TEST_STATUS_T faultPOSTSelfTestResult; ///< Fault POST self test result. // ********** private function prototypes ********** -static HD_FAULT_STATE_T handleFaultStartState( void ); -static HD_FAULT_STATE_T handleFaultRunNVPOSTsState( void ); +static TD_FAULT_STATE_T handleFaultStartState( void ); +static TD_FAULT_STATE_T handleFaultRunNVPOSTsState( void ); /*********************************************************************//** * @brief @@ -44,7 +44,7 @@ *************************************************************************/ void initFaultMode( void ) { - faultState = HD_FAULT_STATE_START; + faultState = TD_FAULT_STATE_START; faultPOSTSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; } @@ -108,7 +108,7 @@ // setAirPumpState( AIR_PUMP_STATE_OFF ); // Ensure all valves are in safe position -// setValveAirTrap( STATE_CLOSED ); +// setValveAirTrap( VALVE_3WAY_COMMON_TO_CLOSED_STATE ); // setValvePosition( H1_VALV, VALVE_POSITION_C_CLOSE ); // setValvePosition( H19, VALVE_POSITION_C_CLOSE ); @@ -120,15 +120,15 @@ switch( faultState ) { - case HD_FAULT_STATE_START: + case TD_FAULT_STATE_START: faultState = handleFaultStartState(); break; - case HD_FAULT_STATE_RUN_NV_POSTS: + case TD_FAULT_STATE_RUN_NV_POSTS: faultState = handleFaultRunNVPOSTsState(); break; - case HD_FAULT_STATE_COMPLETE: + case TD_FAULT_STATE_COMPLETE: // Do nothing unless the test configuration to recover treatment is enabled // if ( ( TRUE == getTestConfigStatus( TEST_CONFIG_RECOVER_TREATMENT ) ) && ( TRUE == hasRecoverFromFaultModeBeenSet() ) ) // { @@ -139,7 +139,7 @@ break; default: - faultState = HD_FAULT_STATE_COMPLETE; + faultState = TD_FAULT_STATE_COMPLETE; break; } @@ -167,9 +167,9 @@ * @details \b Outputs: none * @return next state *************************************************************************/ -static HD_FAULT_STATE_T handleFaultStartState( void ) +static TD_FAULT_STATE_T handleFaultStartState( void ) { - HD_FAULT_STATE_T state = HD_FAULT_STATE_COMPLETE; + TD_FAULT_STATE_T state = TD_FAULT_STATE_COMPLETE; // NVDATAMGMT_RECORDS_READ_STATUS_T status = getNVRecordsReadStatus(); // // switch ( status ) @@ -197,9 +197,9 @@ * @details \b Outputs: faultPOSTSelfTestResult * @return next state *************************************************************************/ -static HD_FAULT_STATE_T handleFaultRunNVPOSTsState( void ) +static TD_FAULT_STATE_T handleFaultRunNVPOSTsState( void ) { - HD_FAULT_STATE_T state = HD_FAULT_STATE_RUN_NV_POSTS; + TD_FAULT_STATE_T state = TD_FAULT_STATE_RUN_NV_POSTS; // faultPOSTSelfTestResult = execNVDataMgmtSelfTest(); // // // Regardless of the status of the NV POST transition to the complete state. Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r380b0afc95467d0861ff3aa2cdcde5d5d7ac85e7 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 380b0afc95467d0861ff3aa2cdcde5d5d7ac85e7) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -55,7 +55,7 @@ // ********** private data ********** -static HD_POST_STATE_T postState; ///< Current state of initialize and POST mode. +static TD_POST_STATE_T postState; ///< Current state of initialize and POST mode. static BOOL postCompleted; ///< Flag indicates whether POST is completed. static BOOL postPassed; ///< Flag indicates all POST tests passed. static BOOL tempPOSTPassed; ///< Flag indicates all POST tests have passed so far. @@ -75,8 +75,8 @@ // ********** private function prototypes ********** -static HD_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); -static HD_POST_STATE_T handlePOSTStateStart( void ); +static TD_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); +static TD_POST_STATE_T handlePOSTStateStart( void ); static SELF_TEST_STATUS_T execFWCompatibilityTest( void ); static SELF_TEST_STATUS_T execUITest( void ); @@ -434,9 +434,9 @@ * @param testStatus status reported by last test * @return recommended next POST state *************************************************************************/ -static HD_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ) +static TD_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ) { - HD_POST_STATE_T result = postState; + TD_POST_STATE_T result = postState; #ifdef BOARD_WITH_NO_HARDWARE testStatus = SELF_TEST_STATUS_PASSED; @@ -447,7 +447,7 @@ // Broadcast passed POST result // sendPOSTTestResult( (HD_POST_STATE_T)((int)postState), TRUE ); // Move on to next POST test - result = (HD_POST_STATE_T)((int)postState + 1); + result = (TD_POST_STATE_T)((int)postState + 1); } else if ( testStatus == SELF_TEST_STATUS_FAILED ) { @@ -474,9 +474,9 @@ * @details \b Outputs: startPOSTDelayCounter * @return next POST state *************************************************************************/ -static HD_POST_STATE_T handlePOSTStateStart( void ) +static TD_POST_STATE_T handlePOSTStateStart( void ) { - HD_POST_STATE_T state = POST_STATE_START; + TD_POST_STATE_T state = POST_STATE_START; // There is a delay before starting POST to make sure the CAN bus is up and listening so // when the event data can be sent Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -r961784c895cb8f551a2623cd02dcbfe42d04b7c2 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 961784c895cb8f551a2623cd02dcbfe42d04b7c2) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -71,7 +71,7 @@ // signalBloodPumpHardStop(); // setAirPumpState( AIR_PUMP_STATE_OFF ); -// setValveAirTrap( STATE_CLOSED ); +// setValveAirTrap( VALVE_3WAY_COMMON_TO_CLOSED_STATE ); // setValvePosition( H1_VALV, VALVE_POSITION_A_INSERT_EJECT ); // setValvePosition( H19, VALVE_POSITION_A_INSERT_EJECT ); Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r16219f68040cc257728be31ce24f7e23e2769f48 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 16219f68040cc257728be31ce24f7e23e2769f48) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -30,13 +30,13 @@ // ********** private data ********** -static HD_STANDBY_STATE_T currentStandbyState; ///< Current state (sub-mode) of standby mode. +static TD_STANDBY_STATE_T currentStandbyState; ///< Current state (sub-mode) of standby mode. static BOOL treatStartReqReceived; ///< Flag indicates user has requested initiation of a treatment. // ********** private function prototypes ********** -static HD_STANDBY_STATE_T handleStandbyModeStartState( void ); -static HD_STANDBY_STATE_T handleStandbyModeWaitForTreatmentState( void ); +static TD_STANDBY_STATE_T handleStandbyModeStartState( void ); +static TD_STANDBY_STATE_T handleStandbyModeWaitForTreatmentState( void ); /*********************************************************************//** * @brief @@ -79,7 +79,7 @@ // stopSyringePump(); // Set valves to default positions -// setValveAirTrap( STATE_CLOSED ); +// setValveAirTrap( VALVE_3WAY_COMMON_TO_CLOSED_STATE ); // setValvePosition( H1_VALV, VALVE_POSITION_A_INSERT_EJECT ); // setValvePosition( H19, VALVE_POSITION_A_INSERT_EJECT ); @@ -133,9 +133,9 @@ * @details \b Outputs: * @return next state of the standby mode state machine *************************************************************************/ -static HD_STANDBY_STATE_T handleStandbyModeStartState( void ) +static TD_STANDBY_STATE_T handleStandbyModeStartState( void ) { - HD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; + TD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; // Wait for door to be closed so we can home actuators // if ( STATE_CLOSED == getSwitchState( H9_SWCH ) ) @@ -190,9 +190,9 @@ * @details \b Outputs: treatStartReqReceived * @return next state of the standby mode state machine *************************************************************************/ -static HD_STANDBY_STATE_T handleStandbyModeWaitForTreatmentState( void ) +static TD_STANDBY_STATE_T handleStandbyModeWaitForTreatmentState( void ) { - HD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; + TD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; // DG_OP_MODE_T dgOperationMode = getDDOpMode(); // switch ( dgOperationMode ) Index: firmware/App/Monitors/Pressures.c =================================================================== diff -u -r961784c895cb8f551a2623cd02dcbfe42d04b7c2 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision 961784c895cb8f551a2623cd02dcbfe42d04b7c2) +++ firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -747,10 +747,10 @@ static void checkVenousPressureInRange( void ) { F32 venPres = getFilteredVenousPressure(); - OPN_CLS_STATE_T airTrapValveState = STATE_CLOSED; //getValveAirTrapStatus(); + VALVE_3WAY_STATE_T airTrapValveState = VALVE_3WAY_COMMON_TO_CLOSED_STATE; //getValveAirTrapStatus(); // track time since last air trap fill - if ( ( STATE_OPEN == airTrapValveState ) && ( TRUE == resetFillExemptPeriod ) ) + if ( ( VALVE_3WAY_COMMON_TO_OPEN_STATE == airTrapValveState ) && ( TRUE == resetFillExemptPeriod ) ) { venLowPresExemptAfterAirTrapFillTimerCtr = 0; resetFillExemptPeriod = FALSE; @@ -801,7 +801,7 @@ } } // during reset period, if airTrapValve open, still alarm needs to be raised , hence persistence clearance should happen before or after reset period. - if ( ( airTrapValveState == STATE_OPEN ) && + if ( ( airTrapValveState == VALVE_3WAY_COMMON_TO_OPEN_STATE ) && ( ( venLowPresExemptAfterAirTrapFillTimerCtr < exemptPeriod ) || ( venLowPresExemptAfterAirTrapFillTimerCtr > minimumMonitoringWindow ) ) ) { Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r552a7de419344b43a3307c61141c99bfbbee7345 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 552a7de419344b43a3307c61141c99bfbbee7345) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -701,9 +701,9 @@ * @param state : The valve state to command H13 valve to * @return none *************************************************************************/ -void setH13ValveState( OPN_CLS_STATE_T state ) +void setH13ValveState( VALVE_3WAY_STATE_T state ) { - if ( STATE_OPEN == state ) + if ( VALVE_3WAY_COMMON_TO_OPEN_STATE == state ) { fpgaActuatorSetPoints.airTrapControl |= FPGA_H13_OPEN_BIT_MASK; } @@ -722,9 +722,9 @@ * @param state : The valve state to command H13 valve to * @return none *************************************************************************/ -void setH20ValveState( OPN_CLS_STATE_T state ) +void setH20ValveState( VALVE_3WAY_STATE_T state ) { - if ( STATE_OPEN == state ) + if ( VALVE_3WAY_COMMON_TO_OPEN_STATE == state ) { fpgaActuatorSetPoints.airTrapControl |= FPGA_H20_OPEN_BIT_MASK; } Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -r552a7de419344b43a3307c61141c99bfbbee7345 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 552a7de419344b43a3307c61141c99bfbbee7345) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -82,8 +82,8 @@ void setFPGAVenousBubbleSelfTest( void ); void clearFPGAVenousBubbleSelfTest( void ); -void setH13ValveState( OPN_CLS_STATE_T state ); -void setH20ValveState( OPN_CLS_STATE_T state ); +void setH13ValveState( VALVE_3WAY_STATE_T state ); +void setH20ValveState( VALVE_3WAY_STATE_T state ); void setAirPumpMotorPowerLevel( U08 power ); Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -r4022a06181f6f6d58ccfd465159d95f0df1b0393 -r285b5d82539c96524c93703d52a66fff76fb64fc --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 4022a06181f6f6d58ccfd465159d95f0df1b0393) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 285b5d82539c96524c93703d52a66fff76fb64fc) @@ -130,22 +130,22 @@ if ( tmpCtr == ( 5 * 20 ) ) { setAirPumpMotorPower( 255 ); - set3WayValveState( H13_VALV, STATE_OPEN ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); } else if ( tmpCtr == ( 10 * 20 ) ) { setAirPumpMotorPower( 0 ); - set3WayValveState( H13_VALV, STATE_CLOSED ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); } else if ( tmpCtr == ( 15 * 20 ) ) { setAirPumpMotorPower( 255 ); - set3WayValveState( H20_VALV, STATE_OPEN ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); } else if ( tmpCtr >= ( 20 * 20 ) ) { setAirPumpMotorPower( 0 ); - set3WayValveState( H20_VALV, STATE_CLOSED ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); tmpCtr = 0; } } @@ -169,23 +169,23 @@ } // Get level sensor data - readLevelSensors(); + readAirTrapLevelSensors(); // Control blood pump execBloodFlowController(); execAirPumpController(); switch ( sta ) { case 0: - set3WayValveState( H13_VALV, STATE_CLOSED ); - set3WayValveState( H20_VALV, STATE_CLOSED ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); setAirPumpState( AIR_PUMP_STATE_ON, AIR_PUMP_MOTOR_OFF ); if ( TRUE == start ) { sta = 1; // lower the level - set3WayValveState( H13_VALV, STATE_OPEN ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); setAirPumpState( AIR_PUMP_STATE_ON, 255 ); } break; @@ -194,7 +194,7 @@ if ( AIR_TRAP_LEVEL_AIR == getRawLevelSensorState( H16_LEVL ) ) { // stop lowering level - set3WayValveState( H13_VALV, STATE_CLOSED ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); ctr = 0; sta = 2; @@ -205,7 +205,7 @@ if ( ++ctr > ( 5 * 20 ) ) { // raise the level - set3WayValveState( H20_VALV, STATE_OPEN ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); setAirPumpState( AIR_PUMP_STATE_ON, 255 ); sta = 3; } @@ -215,7 +215,7 @@ if ( AIR_TRAP_LEVEL_FLUID == getRawLevelSensorState( H16_LEVL ) ) { // stop raising level - set3WayValveState( H20_VALV, STATE_CLOSED ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); ctr = 0; sta = 4; @@ -226,7 +226,7 @@ if ( ++ctr > ( 5 * 20 ) ) { // lower the level - set3WayValveState( H13_VALV, STATE_OPEN ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_OPEN_STATE ); setAirPumpState( AIR_PUMP_STATE_ON, 255 ); sta = 1; }