Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -rc539499ea2dee6d62194d573ac93b313d9e2936d -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision c539499ea2dee6d62194d573ac93b313d9e2936d) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -185,6 +185,11 @@ void transitionToDialysis( void ) { startAirTrapControl(); // TODO - do we need to start this sooner? After prime? start/stop as needed depending on mode/sub-mode (e.g. dialysis, rinseback, prime, ...)? + + // Set user alarm recovery actions allowed in this sub-mode + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, TRUE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); } /*********************************************************************//** Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -rc539499ea2dee6d62194d573ac93b313d9e2936d -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision c539499ea2dee6d62194d573ac93b313d9e2936d) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -26,9 +26,11 @@ #include "ModeTreatment.h" #include "ModeTreatmentParams.h" #include "OperationModes.h" +#include "Rinseback.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "Timers.h" +#include "TreatmentRecirc.h" #include "TreatmentStop.h" #include "Utilities.h" #include "Valves.h" @@ -63,6 +65,9 @@ static TREATMENT_STATE_T currentTreatmentState; ///< Current state (sub-mode) of treatment mode. +static BOOL bloodIsPrimed; ///< Flag indicates whether blood-side circuit has been primed with blood. Set FALSE at init and start of rinseback. Set TRUE at end of blood prime. +static BOOL rinsebackDone; ///< Flag indicates whether a rinseback has been completed. Set FALSE at start of blood prime. Set TRUE at init and end of rinseback. + static U32 presTreatmentTimeSecs; ///< Prescribed treatment time (in minutes). static U32 presBloodFlowRate; ///< Prescribed blood flow rate (in mL/min). static U32 presDialysateFlowRate; ///< Prescribed dialysate flow rate (in mL/min). @@ -101,6 +106,9 @@ { currentTreatmentState = TREATMENT_START_STATE; + bloodIsPrimed = FALSE; + rinsebackDone = TRUE; + treatmentTimeMS = 0; lastTreatmentTimeStamp = 0; treatmentTimeBroadcastTimerCtr = 0; @@ -135,11 +143,9 @@ // Initialize treatment sub-modes each time we transition to treatment mode initDialysis(); initTreatmentStop(); - - // Set user alarm recovery actions allowed in this mode - setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); - setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, TRUE ); - setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); + initRinseback(); + initTreatmentRecirc(); + // TODO - init treatment end sub-mode } /*********************************************************************//** @@ -156,28 +162,64 @@ /*********************************************************************//** * @brief - * The userRequestEndTreatment function conveys a user request to end the - * treatment. - * @details Inputs: currentTreatmentState - * @details Outputs: response to user request sent - * @return TRUE if request accepted, FALSE if not + * The getRinsebackCompleted function determines whether a rinseback has been + * completed (indicating blood-side circuit should be primarily saline). + * @details Inputs: rinsebackDone + * @details Outputs: none + * @return rinsebackDone *************************************************************************/ -BOOL userRequestEndTreatment( void ) +BOOL getRinsebackCompleted( void ) { - BOOL result = FALSE; + return rinsebackDone; +} - if ( TREATMENT_STOP_STATE == currentTreatmentState ) - { - pendingUserEndTreatmentRequest = TRUE; - result = TRUE; - } - sendTreatmentEndResponseMsg( result ); +/*********************************************************************//** + * @brief + * The setRinsebackIsCompleted function sets that flag indicating whether a + * rinseback has been completed. Call this function with TRUE when rinseback + * operation is completed. Call this function with FALSE at start of blood + * prime operation. + * @details Inputs: none + * @details Outputs: rinsebackDone + * @param flag TRUE if rinseback has been completed, FALSE if not + * @return none + *************************************************************************/ +void setRinsebackIsCompleted( BOOL flag ) +{ + rinsebackDone = flag; +} - return result; +/*********************************************************************//** + * @brief + * The getBloodIsPrimed function determines whether the blood-side circuit + * has been primed with blood (indicating blood-side circuit should be primarily blood). + * @details Inputs: bloodIsPrimed + * @details Outputs: none + * @return bloodIsPrimed + *************************************************************************/ +BOOL getBloodIsPrimed( void ) // Determine whether the blood-side circuit of the dialyzer has been primed with blood +{ + return bloodIsPrimed; } /*********************************************************************//** * @brief + * The setBloodIsPrimed function sets that flag indicating whether the + * blood-side circuit has been primed with blood. Call this function with + * TRUE when blood prime operation is completed. Call this function with + * FALSE at start of treatment or start of rinseback operation. + * @details Inputs: none + * @details Outputs: bloodIsPrimed + * @param flag TRUE if blood side circuit is primed with blood, FALSE if not + * @return none + *************************************************************************/ +void setBloodIsPrimed( BOOL flag ) +{ + bloodIsPrimed = flag; +} + +/*********************************************************************//** + * @brief * The signalAlarmActionToTreatmentMode function executes the given alarm action * as appropriate while in Treatment Mode. * @details Inputs: none @@ -200,11 +242,11 @@ break; case TREATMENT_RINSEBACK_STATE: - // TODO - implement + signalStopRinseback(); break; case TREATMENT_RECIRC_STATE: - // TODO - implement + signalStopTreatmentRecirc(); break; default: @@ -223,12 +265,20 @@ currentTreatmentState = TREATMENT_DIALYSIS_STATE; break; - case TREATMENT_RINSEBACK_STATE: - // TODO - implement + default: + // Ignore break; + } + break; - case TREATMENT_RECIRC_STATE: - // TODO - implement + case ALARM_ACTION_RINSEBACK: + switch ( currentTreatmentState ) + { + case TREATMENT_STOP_STATE: + lastTreatmentTimeStamp = getMSTimerCount(); + startDialysis(); + transitionToDialysis(); + currentTreatmentState = TREATMENT_DIALYSIS_STATE; break; default: @@ -237,13 +287,17 @@ } break; - case ALARM_ACTION_RINSEBACK: - // TODO - implement - break; - case ALARM_ACTION_END_TREATMENT: - // TODO - temporary code - implement - currentTreatmentState = TREATMENT_END_STATE; + switch ( currentTreatmentState ) + { + case TREATMENT_STOP_STATE: + pendingUserEndTreatmentRequest = TRUE; + break; + + default: + // Ignore + break; + } break; case ALARM_ACTION_ACK: @@ -329,14 +383,17 @@ * @details Outputs: treatmentTimeMS, lastTreatmentTimeStamp * @return next treatment mode state *************************************************************************/ -static TREATMENT_STATE_T handleTreatmentStartState( void ) +static TREATMENT_STATE_T handleTreatmentStartState( void ) // TODO - we need a blood prime state between start and dialysis sub-modes { TREATMENT_STATE_T result = TREATMENT_DIALYSIS_STATE; // Initialize treatment time treatmentTimeMS = 0; lastTreatmentTimeStamp = getMSTimerCount(); + setRinsebackIsCompleted( FALSE ); + //setBloodIsPrimed( TRUE ); TODO - call when blood prime is completed + presTreatmentTimeSecs = SEC_PER_MIN * getTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_DURATION ); presBloodFlowRate = getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ); presDialysateFlowRate = getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ); @@ -866,9 +923,14 @@ DIALYSIS_STATE_T dialysisState = getDialysisState(); UF_STATE_T uFState = getUltrafiltrationState(); SALINE_BOLUS_STATE_T salineBolusInProgress = getSalineBolusState(); + RINSEBACK_STATE_T rBState = getCurrentRinsebackState(); + TREATMENT_RECIRC_STATE_T rCState = getCurrentTreatmentRecircState(); + HEPARIN_STATE_T hepState = HEPARIN_STATE_OFF; // TODO - get Heparin state when implemented + broadcastTreatmentTime( presTreatmentTimeSecs, elapsedTreatmentTimeInSecs, timeRemaining ); - broadcastTreatmentState( currentTreatmentState, uFState, salineBolusInProgress ); + broadcastTreatmentState( (U32)currentTreatmentState, (U32)uFState, (U32)salineBolusInProgress, + (U32)hepState, (U32)rBState, (U32)rCState ); treatmentTimeBroadcastTimerCtr = 0; } } Index: firmware/App/Modes/ModeTreatment.h =================================================================== diff -u -ra2bc96881a5fc3d8f779246b2abebf15a8de9384 -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision a2bc96881a5fc3d8f779246b2abebf15a8de9384) +++ firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -47,6 +47,8 @@ U32 uFState; U32 salineBolusState; U32 heparinState; + U32 rinsebackState; + U32 txRecircState; } TREATMENT_STATE_DATA_T; /// Payload record structure for an ultrafiltration volume change confirmation message. @@ -84,8 +86,10 @@ void signalAlarmActionToTreatmentMode( ALARM_ACTION_T action ); // Execute alarm action as appropriate for Treatment mode TREATMENT_STATE_T getTreatmentState( void ); // Determine the current treatment sub-mode (state) - -BOOL userRequestEndTreatment( void ); // User has requested to end the treatment +BOOL getRinsebackCompleted( void ); // Determine whether a rinseback has been completed +void setRinsebackIsCompleted( BOOL flag ); // Set whether a rinseback has been completed (T blocks rinseback option) +BOOL getBloodIsPrimed( void ); // Determine whether the blood-side circuit of the dialyzer has been primed with blood +void setBloodIsPrimed( BOOL flag ); // Set whether the blood-side circuit of the dialyzer has been primed with blood (F causes Tx start/resume to do blood prime first) void broadcastTreatmentTimeAndState( void ); // Broadcast the times and states of this treatment BOOL verifyTreatmentDurationSettingChange( U32 treatmentTime ); Index: firmware/App/Modes/Rinseback.c =================================================================== diff -u -rc539499ea2dee6d62194d573ac93b313d9e2936d -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision c539499ea2dee6d62194d573ac93b313d9e2936d) +++ firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -16,7 +16,11 @@ ***************************************************************************/ #include "AirTrap.h" +#include "BloodFlow.h" #include "Buttons.h" +#include "DGInterface.h" +#include "DialInFlow.h" +#include "DialOutFlow.h" #include "ModeTreatment.h" #include "OperationModes.h" #include "Rinseback.h" @@ -33,6 +37,12 @@ // ********** private function prototypes ********** +static RINSEBACK_STATE_T handleRinsebackStopInitState( void ); +static RINSEBACK_STATE_T handleRinsebackRunState( void ); +static RINSEBACK_STATE_T handleRinsebackPausedState( void ); +static RINSEBACK_STATE_T handleRinsebackStoppedState( void ); +static RINSEBACK_STATE_T handleRinsebackRunAdditionalState( void ); + /*********************************************************************//** * @brief * The initRinseback function initializes the Rinseback sub-mode module. @@ -57,17 +67,25 @@ { initRinseback(); + // Set user alarm recovery actions allowed in this sub-mode + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, FALSE ); + // Set valves to safe state setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); - setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); - setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); - // Reset saline bolus state in case alarm interrupted one - resetSalineBolus(); - // Stop air trap control - endAirTrapControl(); - // Should always have stopped alarm active in treatment stop sub-mode so that user can take action - activateAlarmNoData( ALARM_ID_TREATMENT_STOPPED_BY_USER ); + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + setValvePosition( VBV, VALVE_POSITION_B_OPEN ); + + // Ensure all pumps except DPi stopped + signalBloodPumpHardStop(); + signalDialOutPumpHardStop(); + // TODO - stop Heparin pump + + // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature + setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + cmdStartDGTrimmerHeater(); } /*********************************************************************//** @@ -79,7 +97,95 @@ *************************************************************************/ void execRinseback( void ) { - // TODO - implement + switch ( rinsebackState ) + { + case RINSEBACK_STOP_INIT_STATE: + rinsebackState = handleRinsebackStopInitState(); + //setBloodIsPrimed( FALSE ); TODO - call in handler when transition to RB run + break; + + case RINSEBACK_RUN_STATE: + rinsebackState = handleRinsebackRunState(); + //setRinsebackIsCompleted( TRUE ); TODO - call in handler when rinseback is done + break; + + case RINSEBACK_PAUSED_STATE: + rinsebackState = handleRinsebackPausedState(); + break; + + case RINSEBACK_STOP_STATE: + rinsebackState = handleRinsebackStoppedState(); + break; + + case RINSEBACK_RUN_ADDITIONAL_STATE: + rinsebackState = handleRinsebackRunAdditionalState(); + break; + + default: + // TODO - s/w fault + break; + } } +static RINSEBACK_STATE_T handleRinsebackStopInitState( void ) +{ + RINSEBACK_STATE_T result = RINSEBACK_STOP_INIT_STATE; + + return result; +} + +static RINSEBACK_STATE_T handleRinsebackRunState( void ) +{ + RINSEBACK_STATE_T result = RINSEBACK_RUN_STATE; + + return result; +} + +static RINSEBACK_STATE_T handleRinsebackPausedState( void ) +{ + RINSEBACK_STATE_T result = RINSEBACK_PAUSED_STATE; + + return result; +} + +static RINSEBACK_STATE_T handleRinsebackStoppedState( void ) +{ + RINSEBACK_STATE_T result = RINSEBACK_STOP_STATE; + + return result; +} + +static RINSEBACK_STATE_T handleRinsebackRunAdditionalState( void ) +{ + RINSEBACK_STATE_T result = RINSEBACK_RUN_ADDITIONAL_STATE; + + return result; +} + +/*********************************************************************//** + * @brief + * The signalStopRinseback function signals the rinseback sub-mode + * to stop per an active alarm. + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void signalStopRinseback( void ) +{ + +} + +/*********************************************************************//** + * @brief + * The getCurrentRinsebackState function returns the current state of the + * rinseback sub-mode. + * @details Inputs: rinsebackState + * @details Outputs: none + * @return rinsebackState + *************************************************************************/ +RINSEBACK_STATE_T getCurrentRinsebackState( void ) +{ + return rinsebackState; +} + /**@}*/ Index: firmware/App/Modes/Rinseback.h =================================================================== diff -u -rc539499ea2dee6d62194d573ac93b313d9e2936d -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/Rinseback.h (.../Rinseback.h) (revision c539499ea2dee6d62194d573ac93b313d9e2936d) +++ firmware/App/Modes/Rinseback.h (.../Rinseback.h) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -38,6 +38,9 @@ void transitionToRinseback( void ); void execRinseback( void ); +void signalStopRinseback( void ); +RINSEBACK_STATE_T getCurrentRinsebackState( void ); + /**@}*/ #endif Index: firmware/App/Modes/TreatmentRecirc.c =================================================================== diff -u -rc539499ea2dee6d62194d573ac93b313d9e2936d -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision c539499ea2dee6d62194d573ac93b313d9e2936d) +++ firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -16,7 +16,11 @@ ***************************************************************************/ #include "AirTrap.h" +#include "BloodFlow.h" #include "Buttons.h" +#include "DGInterface.h" +#include "DialInFlow.h" +#include "DialOutFlow.h" #include "ModeTreatment.h" #include "OperationModes.h" #include "TreatmentRecirc.h" @@ -33,6 +37,9 @@ // ********** private function prototypes ********** +static TREATMENT_RECIRC_STATE_T handleRecircRecircState( void ); +static TREATMENT_RECIRC_STATE_T handleRecircStoppedState( void ); + /*********************************************************************//** * @brief * The initTreatmentRecirc function initializes the Treatment Re-circulate sub-mode @@ -69,6 +76,11 @@ endAirTrapControl(); // Should always have stopped alarm active in treatment stop sub-mode so that user can take action activateAlarmNoData( ALARM_ID_TREATMENT_STOPPED_BY_USER ); + + // Set user alarm recovery actions allowed in this sub-mode + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, FALSE ); } /*********************************************************************//** @@ -81,7 +93,60 @@ *************************************************************************/ void execTreatmentRecirc( void ) { - // TODO - implement + switch ( treatmentRecircState ) + { + case TREATMENT_RECIRC_RECIRC_STATE: + treatmentRecircState = handleRecircRecircState(); + break; + + case TREATMENT_RECIRC_STOPPED_STATE: + treatmentRecircState = handleRecircStoppedState(); + break; + + default: + // TODO - s/w fault + break; + } } +static TREATMENT_RECIRC_STATE_T handleRecircRecircState( void ) +{ + TREATMENT_RECIRC_STATE_T result = TREATMENT_RECIRC_RECIRC_STATE; + + return result; +} + +static TREATMENT_RECIRC_STATE_T handleRecircStoppedState( void ) +{ + TREATMENT_RECIRC_STATE_T result = TREATMENT_RECIRC_STOPPED_STATE; + + return result; +} + +/*********************************************************************//** + * @brief + * The signalStopTreatmentRecirc function signals the treatment re-circulate + * sub-mode to stop per an active alarm. + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void signalStopTreatmentRecirc( void ) +{ + +} + +/*********************************************************************//** + * @brief + * The getCurrentTreatmentRecircState function returns the current state of the + * treatment re-circulate sub-mode. + * @details Inputs: treatmentRecircState + * @details Outputs: none + * @return treatmentRecircState + *************************************************************************/ +TREATMENT_RECIRC_STATE_T getCurrentTreatmentRecircState( void ) +{ + return treatmentRecircState; +} + /**@}*/ Index: firmware/App/Modes/TreatmentRecirc.h =================================================================== diff -u -rc539499ea2dee6d62194d573ac93b313d9e2936d -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/TreatmentRecirc.h (.../TreatmentRecirc.h) (revision c539499ea2dee6d62194d573ac93b313d9e2936d) +++ firmware/App/Modes/TreatmentRecirc.h (.../TreatmentRecirc.h) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -37,6 +37,9 @@ void transitionToTreatmentRecirc( void ); void execTreatmentRecirc( void ); +void signalStopTreatmentRecirc( void ); +TREATMENT_RECIRC_STATE_T getCurrentTreatmentRecircState( void ); + /**@}*/ #endif Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -r30f049651877229042e3f8700c8596e5b9a1e0f4 -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 30f049651877229042e3f8700c8596e5b9a1e0f4) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -63,7 +63,23 @@ // Stop air trap control endAirTrapControl(); // Should always have stopped alarm active in treatment stop sub-mode so that user can take action - activateAlarmNoData( ALARM_ID_TREATMENT_STOPPED_BY_USER ); + if ( FALSE == isAlarmActive( ALARM_ID_TREATMENT_STOPPED_BY_USER ) ) + { + activateAlarmNoData( ALARM_ID_TREATMENT_STOPPED_BY_USER ); + signalAlarmSilence( ALARM_SILENCE_CMD_CANCEL ); + } + + // Set user alarm recovery actions allowed in this sub-mode + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); + if ( TRUE == getRinsebackCompleted() ) + { // block rinseback action if already done + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); + } + else + { + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, TRUE ); + } + setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); } /*********************************************************************//** Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -37,7 +37,6 @@ #define ALARM_STATUS_PUBLISH_INTERVAL ( ALARM_LAMP_AND_AUDIO_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ) #define ALARM_SILENCE_EXPIRES_IN_SECS (60) ///< Alarm silence expiration time in seconds. -#define ALARM_SILENCE_REQUESTED 1 ///< User cmd to request alarm silence (1=silence, 0=cancel silence). #define SUPERVISOR_ALARM_KEY 0xD2C3B4A5 ///< 32-bit key required for clear all alarms request. @@ -428,9 +427,9 @@ * @param cmd ID of user command (1=silence, 0=cancel silence) * @return none *************************************************************************/ -void signalAlarmSilence( U32 cmd ) +void signalAlarmSilence( ALARM_SILENCE_CMD_T cmd ) { - if ( ALARM_SILENCE_REQUESTED == cmd ) + if ( ALARM_SILENCE_CMD_START == cmd ) { if ( FALSE == alarmStatus.alarmsSilenced ) { Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -252,7 +252,7 @@ void clearAlarm( ALARM_ID_T alarm ); void clearAlarmCondition( ALARM_ID_T alarm ); void setAlarmUserActionEnabled( ALARM_USER_ACTION_T action, BOOL enabled ); -void signalAlarmSilence( U32 cmd ); +void signalAlarmSilence( ALARM_SILENCE_CMD_T cmd ); void signalAlarmUserActionInitiated( ALARM_USER_ACTION_T action ); BOOL isAlarmActive( ALARM_ID_T alarm ); ALARM_PRIORITY_T getCurrentAlarmStatePriority( void ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r911f6526ec3ba03ba0131681c7fb371c0abda6bb -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 911f6526ec3ba03ba0131681c7fb371c0abda6bb) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -1187,10 +1187,6 @@ handleUIUserConfirmTreatmentParameters( message ); break; - case MSG_ID_UI_TREATMENT_END_REQUEST: - handleUIUserEndTreatmentRequest( message ); - break; - case MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST: handleChangePressureLimitsRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -1042,10 +1042,13 @@ * @details Outputs: treatment state msg constructed and queued * @param subMode Current state (sub-mode) of treatment * @param uFState Current state of ultrafiltration - * @param salineBolusState 1=saline bolus in progress, 0=not, 2=max bolus volume reached + * @param salineBolusState 1=saline bolus in progress, 0=not, 2=max bolus volume reached + * @param hepState Current state of Heparin controller + * @param rinsebackState Current state of rinseback sub-mode + * @param txRecircState Current state of treatment re-circulate sub-mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastTreatmentState( U32 subMode, U32 uFState, U32 salineBolusState ) +BOOL broadcastTreatmentState( U32 subMode, U32 uFState, U32 salineBolusState, U32 hepState, U32 rinsebackState, U32 txRecircState ) { BOOL result; MESSAGE_T msg; @@ -1060,7 +1063,9 @@ payload.treatmentSubMode = subMode; payload.uFState = uFState; payload.salineBolusState = salineBolusState; - payload.heparinState = 0; // TODO - add this later + payload.heparinState = hepState; + payload.rinsebackState = rinsebackState; + payload.txRecircState = txRecircState; memcpy( payloadPtr, &payload, sizeof( TREATMENT_STATE_DATA_T ) ); @@ -1335,7 +1340,7 @@ memcpy( &cmd, payloadPtr, sizeof( U32 ) ); - signalAlarmSilence( cmd ); + signalAlarmSilence( (ALARM_SILENCE_CMD_T)cmd ); } else { @@ -1655,56 +1660,6 @@ /*********************************************************************//** * @brief - * The handleUIUserEndTreatmentRequest function handles a treatment end - * request message from the UI. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleUIUserEndTreatmentRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( message->hdr.payloadLen == 0 ) - { - result = userRequestEndTreatment(); - } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); -} - -/*********************************************************************//** - * @brief - * The sendTreatmentEndResponseMsg function constructs a treatment end - * request response message to the UI and queues the msg for transmit on - * the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: Treatment end response msg constructed and queued. - * @param accepted T/F - request accepted? - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendTreatmentEndResponseMsg( BOOL accepted ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_TREATMENT_END_RESPONSE; - msg.hdr.payloadLen = sizeof( BOOL ); - - memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); - - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief * The handleTreatmentParametersFromUI function handles a treatment parameters * set and validate request message from the UI. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rfa356a2bce909141f45c6832659fa1ceea5bfbba --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision fa356a2bce909141f45c6832659fa1ceea5bfbba) @@ -96,12 +96,6 @@ // MSG_ID_HD_START_TREATMENT_RESPONSE BOOL sendTreatmentStartResponseMsg( BOOL accepted, U32 reason ); -// MSG_ID_UI_TREATMENT_END_REQUEST -void handleUIUserEndTreatmentRequest( MESSAGE_T *message ); - -// MSG_ID_HD_TREATMENT_END_RESPONSE -BOOL sendTreatmentEndResponseMsg( BOOL accepted ); - // MSG_ID_UI_NEW_TREATMENT_PARAMS void handleTreatmentParametersFromUI( MESSAGE_T *message ); @@ -220,7 +214,7 @@ BOOL broadcastTreatmentTime( U32 secsTotTreatment, U32 secsElapsed, U32 secsRemaining ); // MSG_ID_TREATMENT_STATE -BOOL broadcastTreatmentState( U32 subMode, U32 uFState, U32 salineBolusState ); +BOOL broadcastTreatmentState( U32 subMode, U32 uFState, U32 salineBolusState, U32 hepState, U32 rinsebackState, U32 txRecircState ); // MSG_ID_POWER_OFF_WARNING BOOL broadcastPowerOffWarning( void );