Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -rd9d085cdca67200ecddbdfbc75c489e704b23081 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision d9d085cdca67200ecddbdfbc75c489e704b23081) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -180,6 +180,7 @@ if ( ( TRUE == lower ) && ( FALSE == upper ) ) { // TODO - fault if illegal level readings persist + // TODO - close valve and end valve control } } Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rd9d085cdca67200ecddbdfbc75c489e704b23081 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision d9d085cdca67200ecddbdfbc75c489e704b23081) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -256,6 +256,9 @@ { valvesStatus[ valve ].execState = VALVE_STATE_WAIT_FOR_POST; } + + // close air trap valve + setValveAirTrap( STATE_CLOSED ); } /*********************************************************************//** Index: firmware/App/HDCommon.h =================================================================== diff -u -rd9d085cdca67200ecddbdfbc75c489e704b23081 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/HDCommon.h (.../HDCommon.h) (revision d9d085cdca67200ecddbdfbc75c489e704b23081) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -30,10 +30,10 @@ // ********** development build switches ********** #ifndef _RELEASE_ -//#define UF_TEST_ENABLED 1 // ultrafiltration test build (hard codes treatment params, re-purposes off/stop buttons) +#define UF_TEST_ENABLED 1 // ultrafiltration test build (hard codes treatment params, re-purposes off/stop buttons) //#define UF_TEST_WITH_DG 1 // ultrafiltration test build (sets up DG in standby mode) #ifndef _VECTORCAST_ -// #define DISABLE_UI_TREATMENT_WORKFLOW 1 // disable UI treatment workflow + #define DISABLE_UI_TREATMENT_WORKFLOW 1 // disable UI treatment workflow // #define RM46_EVAL_BOARD_TARGET 1 // limited build runs on RM46 eval board // #define BREADBOARD_TARGET 1 // old breadboard system build - no longer used? // #define SIMULATE_UI 1 // build w/o requirement that UI be there @@ -50,11 +50,11 @@ #define DISABLE_PUMP_DIRECTION_CHECKS 1 // do not error on HD pump direction checks #define DISABLE_PRESSURE_CHECKS 1 // do not error on HD pressure checks #define DISABLE_UF_ALARMS 1 // do not error on HD ultrafiltration checks - #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) +// #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) // #define RAW_FLOW_SENSOR_DATA 1 // test build will not filter flow sensor data // #define READ_FPGA_ASYNC_DATA 1 // test build reads non-priority register page every other time // #define FLOW_DEBUG 1 // test build sends flow, signal strength, and occlusion readings to debug UART -// #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button + #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button #define ALARMS_DEBUG 1 // triggered alarms sent to debug UART #include Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -21,7 +21,7 @@ #include "Buttons.h" #include "DialInFlow.h" #include "DialOutFlow.h" -#include "FPGA.h" +#include "Valves.h" #endif #include "OperationModes.h" #include "ModeFault.h" @@ -57,9 +57,6 @@ *************************************************************************/ void transitionToFaultMode( void ) { -#ifdef EMC_TEST_BUILD // TODO - test code - enableValvesPIDControl(0); // enable valves -#endif } /*********************************************************************//** @@ -85,10 +82,10 @@ switch ( toggle ) { case 0: // pumps and valves off - setDialyzerInletValvePosition( 0 ); - setDialyzerOutletValvePosition( 0 ); - setVenousBloodValvePosition( 0 ); - setArterialBloodValvePosition( 0 ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); break; case 1: // pumps on, valves off @@ -98,10 +95,10 @@ break; case 2: // pumps on, valves on - setDialyzerInletValvePosition( 12000 ); - setDialyzerOutletValvePosition( 12000 ); - setVenousBloodValvePosition( 12000 ); - setArterialBloodValvePosition( 12000 ); + setValvePosition( VDI, VALVE_POSITION_B_OPEN ); + setValvePosition( VDO, VALVE_POSITION_B_OPEN ); + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + setValvePosition( VBV, VALVE_POSITION_B_OPEN ); break; case 3: // pumps off, valves on @@ -115,10 +112,10 @@ setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialInPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialOutPumpTargetRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); - setDialyzerInletValvePosition( 0 ); - setDialyzerOutletValvePosition( 0 ); - setVenousBloodValvePosition( 0 ); - setArterialBloodValvePosition( 0 ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); break; } } Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rd9d085cdca67200ecddbdfbc75c489e704b23081 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision d9d085cdca67200ecddbdfbc75c489e704b23081) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -84,9 +84,6 @@ setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); setDialInPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); setDialOutPumpTargetRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); -#ifdef EMC_TEST_BUILD - enableValvesPIDControl(0); // enable valves -#endif #ifdef RM46_EVAL_BOARD_TARGET start = getMSTimerCount(); #endif @@ -220,6 +217,13 @@ homeBloodPump(); homeDialInPump(); homeDialOutPump(); + homeValve( VDI ); + homeValve( VDO ); + homeValve( VBA ); + homeValve( VBV ); +#ifdef EMC_TEST_BUILD + startAirTrapControl(); +#endif break; case STANDBY_WAIT_FOR_TREATMENT_STATE: @@ -238,23 +242,23 @@ switch ( toggle ) { case 0: // pumps and valves off - setDialyzerInletValvePosition( 0 ); - setDialyzerOutletValvePosition( 0 ); - setVenousBloodValvePosition( 0 ); - setArterialBloodValvePosition( 0 ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); break; case 1: // pumps on, valves off - setBloodPumpTargetFlowRate( 500, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + setBloodPumpTargetFlowRate( 200, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialInPumpTargetFlowRate( 500, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialOutPumpTargetRate( 500, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); break; case 2: // pumps on, valves on - setDialyzerInletValvePosition( 12000 ); - setDialyzerOutletValvePosition( 12000 ); - setVenousBloodValvePosition( 12000 ); - setArterialBloodValvePosition( 12000 ); + setValvePosition( VDI, VALVE_POSITION_B_OPEN ); + setValvePosition( VDO, VALVE_POSITION_B_OPEN ); + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + setValvePosition( VBV, VALVE_POSITION_B_OPEN ); break; case 3: // pumps off, valves on @@ -268,10 +272,10 @@ setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialInPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialOutPumpTargetRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); - setDialyzerInletValvePosition( 0 ); - setDialyzerOutletValvePosition( 0 ); - setVenousBloodValvePosition( 0 ); - setArterialBloodValvePosition( 0 ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); break; } } Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rd9d085cdca67200ecddbdfbc75c489e704b23081 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision d9d085cdca67200ecddbdfbc75c489e704b23081) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -1433,6 +1433,10 @@ handleSetAirTrapLevelSensorOverrideRequest( message ); break; + case MSG_ID_HD_SOFTWARE_RESET_REQUEST: + handleHDSoftwareResetRequest( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rd9d085cdca67200ecddbdfbc75c489e704b23081 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d9d085cdca67200ecddbdfbc75c489e704b23081) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -17,6 +17,8 @@ #include // for memcpy() +#include "reg_system.h" + #include "Accel.h" #include "AlarmLamp.h" #include "BloodFlow.h" @@ -3678,4 +3680,27 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/************************************************************************* + * @brief + * The handleSetAirTrapLevelSensorOverrideRequest function handles a request to + * override an air trap level sensor. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleHDSoftwareResetRequest( MESSAGE_T *message ) +{ + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // tester must be logged in + if ( TRUE == isTestingActivated() ) + { // s/w reset of processor + systemREG1->SYSECR = (0x10) << 14; + } + } +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rd9d085cdca67200ecddbdfbc75c489e704b23081 -r61153247029a9a246ca1beadc66d772e3e583e4e --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision d9d085cdca67200ecddbdfbc75c489e704b23081) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 61153247029a9a246ca1beadc66d772e3e583e4e) @@ -372,6 +372,9 @@ // MSG_ID_HD_AIR_TRAP_LEVEL_SENSOR_OVERRIDE void handleSetAirTrapLevelSensorOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_SOFTWARE_RESET_REQUEST +void handleHDSoftwareResetRequest( MESSAGE_T *message ); /**@}*/