Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -reaff654b897f641b874e3ba30a22cbda3779e4a7 -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision eaff654b897f641b874e3ba30a22cbda3779e4a7) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -447,7 +447,6 @@ if ( TRUE == didTimeout( airTrapLowerStartTime, airPumpStopTime ) ) { // TODO - alarm??? - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_TIMEOUT_REMOVE_TEMP, airPumpStopTime, 0 ); } result = AIR_TRAP_CLOSED_STATE; } Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rae4a44c74291d5891ef2a7f45320158e73fecbbc -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision ae4a44c74291d5891ef2a7f45320158e73fecbbc) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -383,6 +383,7 @@ isBloodPumpOn = FALSE; bpControlTimerCounter = 0; setPeristalticPumpSetSpeed( bloodPumpSetSpeedRPM ); + setPeristalticPumpHardStop(); resetPIController( PI_CONTROLLER_ID_BLOOD_FLOW, 0.0F, 0.0F ); } @@ -1319,6 +1320,27 @@ /*********************************************************************//** * @brief + * The testHardStopBloodPump function hard stops the blood pump. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message BP home command message from Dialin. + * @return TRUE if command successful, FALSE if not + *************************************************************************/ +BOOL testHardStopBloodPump( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + result = TRUE; + signalBloodPumpHardStop(); + } + + return result; +} + +/*********************************************************************//** + * @brief * The testBPFlowAlphaYInterceptOverride function overrides the Alpha Y * intercept of the blood flow estimation equation. * @details \b Inputs: none Index: firmware/App/Controllers/BloodFlow.h =================================================================== diff -u -r55147f11d199be6710172cafcde21547af1f7689 -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision 55147f11d199be6710172cafcde21547af1f7689) +++ firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -82,6 +82,7 @@ BOOL testMeasuredBloodPumpSpeedOverride( MESSAGE_T *message ); BOOL testBloodPumpRotorCountOverride( MESSAGE_T *message ); BOOL testHomeBloodPump( MESSAGE_T *message ); +BOOL testHardStopBloodPump( MESSAGE_T *message ); BOOL testBPFlowAlphaYInterceptOverride( MESSAGE_T *message ); BOOL testBPFlowWearATermOverride( MESSAGE_T *message ); BOOL testBPFlowWearBTermOverride( MESSAGE_T *message ); Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r6b4296cf35c80f2a8858020517cbfc48181144c7 -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 6b4296cf35c80f2a8858020517cbfc48181144c7) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -688,7 +688,6 @@ { currentValveStates[ valve ].currentPosition = currentValveStates[ valve ].commandedPosition; nextState = ( VALVE_HOMING_COMPLETE != currentValveStates[ valve ].valveHomingStatus ? VALVE_STATE_HOMING_NOT_STARTED : VALVE_STATE_IDLE ); - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_VALVE_POSITION_DELTA_REMOVE_TEMP, (U32)abs( delta ), 0 ); } // is transition taking too long? else if ( ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u --- firmware/App/Modes/ModePreTreat.c (revision 0) +++ firmware/App/Modes/ModePreTreat.c (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -0,0 +1,39 @@ + +#include "ModePreTreat.h" +#include "OperationModes.h" +#include "Timers.h" + +/** + * @addtogroup TDPreTreatmentMode + * @{ + */ + +static U32 testTimeRemove = 0; + +void initPreTreatmentMode( void ) +{ + testTimeRemove = 0; +} + +U32 transitionToPreTreatmentMode( void ) +{ + initPreTreatmentMode(); + + testTimeRemove = getMSTimerCount(); + return 0; +} + +U32 execPreTreatmentMode( void ) +{ + if ( TRUE == didTimeout( testTimeRemove, 10000 ) ) // TODO temporary remove + { + requestNewOperationMode( MODE_TREA ); + } + + return 0; +} + + +/**@}*/ + + Index: firmware/App/Modes/ModePreTreat.h =================================================================== diff -u --- firmware/App/Modes/ModePreTreat.h (revision 0) +++ firmware/App/Modes/ModePreTreat.h (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -0,0 +1,27 @@ + + +#ifndef __MODE_PRE_TREAT_H__ +#define __MODE_PRE_TREAT_H__ + +#include "TDCommon.h" +#include "TDDefs.h" + +/** + * @defgroup TDPreTreatmentMode HDPreTreatmentMode + * @brief Pre-TreatmentMode module. + * + * @addtogroup TDPreTreatmentMode + * @{ + */ + +// ********** public function prototypes ********** + +void initPreTreatmentMode( void ); // Initialize this module +U32 transitionToPreTreatmentMode( void ); // Prepares for transition to pre-treatment mode +U32 execPreTreatmentMode( void ); // Execute the pre-treatment mode state machine (call from OperationModes) + + + +/**@}*/ + +#endif Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r2d40deb50ffb27667c3e57f427b1e197e163910e -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 2d40deb50ffb27667c3e57f427b1e197e163910e) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -20,6 +20,7 @@ #include "Buttons.h" #include "DDInterface.h" #include "Messaging.h" +#include "ModePreTreat.h" #include "ModeTreatment.h" #include "ModeTxParams.h" #include "ModeStandby.h" @@ -249,7 +250,7 @@ // Initialize treatment modes before starting a new treatment initTreatParamsMode(); -// initPreTreatmentMode(); + initPreTreatmentMode(); initTreatmentMode(); // initPostTreatmentMode(); resetAirTrap(); Index: firmware/App/Modes/ModeTxParams.c =================================================================== diff -u -r80c41ee26d8ce244b9013512b6b53dbddff2145d -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Modes/ModeTxParams.c (.../ModeTxParams.c) (revision 80c41ee26d8ce244b9013512b6b53dbddff2145d) +++ firmware/App/Modes/ModeTxParams.c (.../ModeTxParams.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -863,8 +863,7 @@ setPressureLimitsToOuterBounds(); // Go to pre-treatment mode -// requestNewOperationMode( MODE_PRET ); // TODO - restore when pre-tx mode implemented - requestNewOperationMode( MODE_TREA ); + requestNewOperationMode( MODE_PRET ); treatParamsConfirmed = FALSE; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -ra5560a2917aa62bcafd8e6a81041ace723237109 -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision a5560a2917aa62bcafd8e6a81041ace723237109) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -23,7 +23,7 @@ #include "ModeFault.h" #include "ModeStandby.h" #include "ModeTxParams.h" -//#include "ModePreTreat.h" +#include "ModePreTreat.h" #include "ModeTreatment.h" //#include "ModePostTreat.h" //#include "NVDataMgmt.h" @@ -207,10 +207,10 @@ currentSubMode = execTreatParamsMode(); break; -// case MODE_PRET: -// currentSubMode = execPreTreatmentMode(); -// break; -// + case MODE_PRET: + currentSubMode = execPreTreatmentMode(); + break; + case MODE_TREA: currentSubMode = execTreatmentMode(); break; @@ -413,9 +413,9 @@ case MODE_TPAR: currentSubMode = transitionToTreatParamsMode(); break; -// case MODE_PRET: -// currentSubMode = transitionToPreTreatmentMode(); -// break; + case MODE_PRET: + currentSubMode = transitionToPreTreatmentMode(); + break; case MODE_TREA: currentSubMode = transitionToTreatmentMode(); break; Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r9a8e1fc597eb4f681527e691fb6cb24e550d8b92 -r927c47388ab6bd716b857f76e2026c116dd52e69 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 9a8e1fc597eb4f681527e691fb6cb24e550d8b92) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) @@ -164,7 +164,8 @@ { MSG_ID_TD_HOME_BLOOD_PUMP, &testHomeBloodPump }, { MSG_ID_TD_BLOOD_FLOW_ALPHA_Y_INTERCEPT_OVERRIDE_REQUEST, &testBPFlowAlphaYInterceptOverride }, { MSG_ID_TD_BLOOD_FLOW_WEAR_A_TERM_OVERRIDE_REQUEST, &testBPFlowWearATermOverride }, - { MSG_ID_TD_BLOOD_FLOW_WEAR_B_TERM_OVERRIDE_REQUEST, &testBPFlowWearBTermOverride } + { MSG_ID_TD_BLOOD_FLOW_WEAR_B_TERM_OVERRIDE_REQUEST, &testBPFlowWearBTermOverride }, + { MSG_ID_TD_HARD_STOP_BLOOD_PUMP, &testHardStopBloodPump } }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLER_LOOKUP) / sizeof(MSG_HANDLER_LOOKUP_T))