Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r8345f0415ce34f2f47afcbf613a00216769f51c6 -r027a8c7ac2a20cae3304dd6d72d54a1edbc19820 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 8345f0415ce34f2f47afcbf613a00216769f51c6) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 027a8c7ac2a20cae3304dd6d72d54a1edbc19820) @@ -270,8 +270,8 @@ resetAirTrap(); // Send UI default pressure settings since user is not asked to set them. respRecord.artPresLimitWindowmmHg = getSysConfigTreatmentParameterU32DefaultValue( TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW ); - respRecord.venPresLimitWindowmmHg = getSysConfigTreatmentParameterU32DefaultValue( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW ); - respRecord.venPresLimitAsymmetricmmHg = getSysConfigTreatmentParameterU32DefaultValue( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC ); + respRecord.venPresLimitWindowmmHg = getSysConfigTreatmentParameterU32DefaultValue( TREATMENT_PARAM_VEN_PRES_HIGH_LIMIT_WINDOW ); + respRecord.venPresLimitAsymmetricmmHg = getSysConfigTreatmentParameterU32DefaultValue( TREATMENT_PARAM_VEN_PRES_LOW_LIMIT_WINDOW ); respRecord.tmpPresLimitWindowmmHg = getSysConfigTreatmentParameterU32DefaultValue( TREATMENT_PARAM_TMP_PRES_LIMIT_WINDOW ); sendPressureLimitsChangeResponse( &respRecord ); // start DD pre-gen // TODO Index: firmware/App/Services/AlarmMgmtTD.c =================================================================== diff -u -r8345f0415ce34f2f47afcbf613a00216769f51c6 -r027a8c7ac2a20cae3304dd6d72d54a1edbc19820 --- firmware/App/Services/AlarmMgmtTD.c (.../AlarmMgmtTD.c) (revision 8345f0415ce34f2f47afcbf613a00216769f51c6) +++ firmware/App/Services/AlarmMgmtTD.c (.../AlarmMgmtTD.c) (revision 027a8c7ac2a20cae3304dd6d72d54a1edbc19820) @@ -245,7 +245,6 @@ { requestNewOperationMode( MODE_FAUL ); } - // If alarm has stop property, signal stop now if ( TRUE == props.alarmStops ) { Index: firmware/App/Services/StateServices/TubeSetInstall.c =================================================================== diff -u -r8345f0415ce34f2f47afcbf613a00216769f51c6 -r027a8c7ac2a20cae3304dd6d72d54a1edbc19820 --- firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 8345f0415ce34f2f47afcbf613a00216769f51c6) +++ firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 027a8c7ac2a20cae3304dd6d72d54a1edbc19820) @@ -17,6 +17,7 @@ #include "AlarmMgmtTD.h" #include "BloodFlow.h" +#include "DDInterface.h" #include "Messaging.h" #include "OperationModes.h" #include "PeristalticPump.h" @@ -25,6 +26,7 @@ #include "TDDefs.h" #include "Timers.h" #include "TubeSetInstall.h" +#include "TxParams.h" /** * @addtogroup TubeSetInstall @@ -42,6 +44,7 @@ // ********** private data ********** static BOOL confirmTubesetPlaced; ///< Flag indicating user has confirmed tubeset is placed +static BOOL setupConnectionsConfirmed; ///< Flag indicating user has confirmed setup connections are complete. static U32 bloodPumpTimerCounter; ///< Blood Pump timer counter static BOOL bpLastHome; ///< Flag for blood pump last home (for rising-edge) static U32 bpLeftHomeTimerCounter; ///< Timer counter to measure how long BP has been away from home @@ -53,11 +56,12 @@ // ********** private function prototypes ********** -static TUBE_SET_INSTALL_STATE_T handleAwaitTubesetConfirmationState( void ); // Handle Await Tubset Install Confirmation sub-state -static TUBE_SET_INSTALL_STATE_T handleAwaitBPDoorCloseState( void ); // Handle Await Blood Pump Door Close sub-state. -static TUBE_SET_INSTALL_STATE_T handleAutoLoadState( void ); // Handle Auto-Load sub-state -static TUBE_SET_INSTALL_STATE_T handleAutoLoadBackOffState( void ); // Handle Auto-Load Back-off sub-state -static TUBE_SET_INSTALL_STATE_T handleInstallCompleteState( void ); // Handle Install complete state +static TUBE_SET_INSTALL_STATE_T handleAwaitTubesetConfirmationState( void ); ///< Handle Await Tubset Install Confirmation sub-state +static TUBE_SET_INSTALL_STATE_T handleAwaitBPDoorCloseState( void ); ///< Handle Await Blood Pump Door Close sub-state. +static TUBE_SET_INSTALL_STATE_T handleAutoLoadState( void ); ///< Handle Auto-Load sub-state +static TUBE_SET_INSTALL_STATE_T handleAwaitSetupConnectionConfirmationState( void ); ///< Handle Await Setup Connection Confirmation sub-state +static TUBE_SET_INSTALL_STATE_T handleAutoLoadBackOffState( void ); ///< Handle Auto-Load Back-off sub-state +static TUBE_SET_INSTALL_STATE_T handleInstallCompleteState( void ); ///< Handle Install complete state /*********************************************************************//** * @brief @@ -69,12 +73,13 @@ **************************************************************************/ void initTubeSetInstall( void ) { - previousInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; - currentInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; - confirmTubesetPlaced = FALSE; - bloodPumpTimerCounter = 0; - bpLastHome = TRUE; - bpLeftHomeTimerCounter = 0; + previousInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; + currentInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; + confirmTubesetPlaced = FALSE; + setupConnectionsConfirmed = FALSE; + bloodPumpTimerCounter = 0; + bpLastHome = TRUE; + bpLeftHomeTimerCounter = 0; currentTubeSetType = TUBE_SET_TYPE_UNKNOWN; } @@ -107,6 +112,10 @@ currentInstallState = handleAutoLoadBackOffState(); break; + case TUBE_SET_INSTALL_STATE_AWAIT_SETUP_CONNECTION_CONFIRMATION: + currentInstallState = handleAwaitSetupConnectionConfirmationState(); + break; + case TUBE_SET_INSTALL_STATE_COMPLETE: currentInstallState = handleInstallCompleteState(); break; @@ -135,11 +144,24 @@ static TUBE_SET_INSTALL_STATE_T handleAwaitTubesetConfirmationState( void ) { TUBE_SET_INSTALL_STATE_T state = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; + F32 bicarbConvFactor = BICARBONATE_CONVERSION_FACTOR; if ( TRUE == confirmTubesetPlaced ) { // Door closed required from Auto-loading onwards, set to false if not required in subsequent states doorClosedRequired( TRUE ); + + // Request DD to generate dialysate with Qd = 600 mL/min, + // Quf = 0, and dialyzer bypassed. + cmdStartGenerateDialysate( 600.0F, + 0.0F, + getTreatmentParameterF32( TREATMENT_PARAM_DIALYSATE_TEMPERATURE ), + TRUE, + getTreatmentParameterF32( TREATMENT_PARAM_ACID_CONCENTRATE_CONV_FACTOR ), + bicarbConvFactor, + getTreatmentParameterU32( TREATMENT_PARAM_SODIUM ), + getTreatmentParameterU32( TREATMENT_PARAM_BICARBONATE ) ); + confirmTubesetPlaced = FALSE; state = TUBE_SET_INSTALL_STATE_AWAIT_BP_DOOR_CLOSE; } @@ -207,7 +229,7 @@ signalBloodPumpHardStop(); bloodPumpTimerCounter = 0; bpLeftHomeTimerCounter = 0; - state = TUBE_SET_INSTALL_STATE_COMPLETE; + state = TUBE_SET_INSTALL_STATE_AWAIT_SETUP_CONNECTION_CONFIRMATION; } else { @@ -226,6 +248,28 @@ /*********************************************************************//** * @brief + * The handleAwaitSetupConnectionConfirmationState function handles the + * Await Setup Connection Confirmation state of Tube Set install state. + * @details \b Inputs: setupConnectionsConfirmed + * @details \b Outputs: setupConnectionsConfirmed + * @return next Install sub-state + *************************************************************************/ +static TUBE_SET_INSTALL_STATE_T handleAwaitSetupConnectionConfirmationState( void ) +{ + TUBE_SET_INSTALL_STATE_T state = TUBE_SET_INSTALL_STATE_AWAIT_SETUP_CONNECTION_CONFIRMATION; + + if ( TRUE == setupConnectionsConfirmed ) + { + setupConnectionsConfirmed = FALSE; + + state = TUBE_SET_INSTALL_STATE_COMPLETE; + } + + return state; +} + +/*********************************************************************//** + * @brief * The handleAutoLoadBackOffState function handles the Auto-Load Back-Off * state of Tube Set install state. * @details \b Inputs: bloodPumpTimerCounter @@ -337,7 +381,48 @@ /*********************************************************************//** * @brief - * The setTubeSetType function sets the current installed tube set type. + * The handleSetupTubingSetConnectionConfirmRequest function handles a UI request + * to confirm setup connections are complete. + * @details \b Message \b Sent: MSG_ID_TD_SETUP_TUBING_SET_CONNECTIONS_CONFIRM_RESPONSE + * @details \b Inputs: none + * @details \b Outputs: setupConnectionsConfirmed + * @param message UI message which includes the user confirmation of + * setup connections completion. + * @return TRUE if confirmation accepted, FALSE otherwise. + *************************************************************************/ +BOOL handleSetupTubingSetConnectionConfirmRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + UI_RESPONSE_PAYLOAD_T response; + + response.rejectionReason = REQUEST_REJECT_REASON_NONE; + + if ( 0 == message->hdr.payloadLen ) + { + if ( TUBE_SET_INSTALL_STATE_COMPLETE != currentInstallState ) + { + setupConnectionsConfirmed = TRUE; + result = TRUE; + } + else + { + response.rejectionReason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; + } + } + else + { + response.rejectionReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + response.accepted = result; + + sendMessage( MSG_ID_TD_SETUP_TUBING_SET_CONNECTIONS_CONFIRM_RESPONSE, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08*)&response, sizeof( UI_RESPONSE_PAYLOAD_T ) ); + + return result; +} + +/*********************************************************************//** +* The setTubeSetType function sets the current installed tube set type. * @details \b Alarms: ALARM_ID_TD_SOFTWARE_FAULT if tube set is invalid type * @details \b Inputs: none * @details \b Outputs: currentTubeSetType Index: firmware/App/Services/StateServices/TubeSetInstall.h =================================================================== diff -u -r8345f0415ce34f2f47afcbf613a00216769f51c6 -r027a8c7ac2a20cae3304dd6d72d54a1edbc19820 --- firmware/App/Services/StateServices/TubeSetInstall.h (.../TubeSetInstall.h) (revision 8345f0415ce34f2f47afcbf613a00216769f51c6) +++ firmware/App/Services/StateServices/TubeSetInstall.h (.../TubeSetInstall.h) (revision 027a8c7ac2a20cae3304dd6d72d54a1edbc19820) @@ -35,23 +35,25 @@ /// Enumeration of Tube Set install sub-states. enum Tube_Set_Install_States { - TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION = 0, ///< Awaiting user confirmation that tubeset is placed. - TUBE_SET_INSTALL_STATE_AWAIT_BP_DOOR_CLOSE, ///< Waiting for blood pump door to be closed. - TUBE_SET_INSTALL_STATE_AUTO_LOAD, ///< Auto-Load the tubeset state - TUBE_SET_INSTALL_STATE_AUTO_LOAD_BACK_OFF, ///< Auto-Load Back-off state - TUBE_SET_INSTALL_STATE_COMPLETE, ///< Install state complete - NUM_OF_TUBE_SET_INSTALL_SUB_STATES, ///< Num of install sub-states + TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION = 0, // Awaiting user confirmation that tubeset is placed. + TUBE_SET_INSTALL_STATE_AWAIT_BP_DOOR_CLOSE, // Waiting for blood pump door to be closed. + TUBE_SET_INSTALL_STATE_AUTO_LOAD, // Auto-Load the tubeset state + TUBE_SET_INSTALL_STATE_AWAIT_SETUP_CONNECTION_CONFIRMATION, // Awaiting user confirmation that setup connections are complete. + TUBE_SET_INSTALL_STATE_AUTO_LOAD_BACK_OFF, // Auto-Load Back-off state + TUBE_SET_INSTALL_STATE_COMPLETE, // Install state complete + NUM_OF_TUBE_SET_INSTALL_SUB_STATES, // Num of install sub-states }; /// Type for tube set install states enumeration typedef enum Tube_Set_Install_States TUBE_SET_INSTALL_STATE_T; // ********** public function prototypes ********** -void initTubeSetInstall( void ); // Initialize this service -void execTubeSetInstall( void ); // Execute the service state machine (call from ModePreTreat and ModeTreatment) +void initTubeSetInstall( void ); // Initialize this service +void execTubeSetInstall( void ); // Execute the service state machine (call from ModePreTreat and ModeTreatment) -BOOL isTubeSetInstallComplete( void ); // Returns True once auto-load finished successfully -BOOL handleAutoLoadRequest( MESSAGE_T *message ); // Handle UI auto-load confirmation request +BOOL isTubeSetInstallComplete( void ); // Returns True once auto-load finished successfully +BOOL handleAutoLoadRequest( MESSAGE_T *message ); // Handle UI auto-load confirmation request +BOOL handleSetupTubingSetConnectionConfirmRequest( MESSAGE_T *message ); // Handle UI setup tubing set connection confirmation request void setTubeSetType( TUBE_SET_TYPE_T type ); // Set the current installed tube set type TODO: Call this after implementing bar code logic TUBE_SET_TYPE_T getTubeSetType( void ); // Get the current installed tube set type Index: firmware/App/Services/TxParams.c =================================================================== diff -u -r8345f0415ce34f2f47afcbf613a00216769f51c6 -r027a8c7ac2a20cae3304dd6d72d54a1edbc19820 --- firmware/App/Services/TxParams.c (.../TxParams.c) (revision 8345f0415ce34f2f47afcbf613a00216769f51c6) +++ firmware/App/Services/TxParams.c (.../TxParams.c) (revision 027a8c7ac2a20cae3304dd6d72d54a1edbc19820) @@ -141,10 +141,10 @@ { // type min max default { CRITICAL_DATA_TYPE_U32, {.uInt=50}, {.uInt=100}, {.uInt=50} }, // TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW - { CRITICAL_DATA_TYPE_U32, {.uInt=50}, {.uInt=100}, {.uInt=50} }, // TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW - { CRITICAL_DATA_TYPE_U32, {.uInt=20}, {.uInt=35}, {.uInt=35} }, // TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC + { CRITICAL_DATA_TYPE_U32, {.uInt=50}, {.uInt=100}, {.uInt=50} }, // TREATMENT_PARAM_VEN_PRES_HIGH_LIMIT_WINDOW + { CRITICAL_DATA_TYPE_U32, {.uInt=20}, {.uInt=35}, {.uInt=35} }, // TREATMENT_PARAM_VEN_PRES_LOW_LIMIT_WINDOW { CRITICAL_DATA_TYPE_U32, {.uInt=20}, {.uInt=50}, {.uInt=20} }, // TREATMENT_PARAM_TMP_PRES_LIMIT_WINDOW - { CRITICAL_DATA_TYPE_U32, {.uInt=100}, {.uInt=500}, {.uInt=200} }, // TREATMENT_PARAM_RINSEBACK_FLOW_RATEs + { CRITICAL_DATA_TYPE_U32, {.uInt=100}, {.uInt=500}, {.uInt=200} }, // TREATMENT_PARAM_RINSEBACK_FLOW_RATE { CRITICAL_DATA_TYPE_U32, {.uInt=300}, {.uInt=1000}, {.uInt=300} }, // TREATMENT_PARAM_PRIME_DISCARD_VOLUME { CRITICAL_DATA_TYPE_U32, {.uInt=70}, {.uInt=140}, {.uInt=90} }, // TREATMENT_PARAM_SYSTOLIC_BP_LOW_ALARM_LIMIT { CRITICAL_DATA_TYPE_U32, {.uInt=100}, {.uInt=260}, {.uInt=200} }, // TREATMENT_PARAM_SYSTOLIC_BP_HIGH_ALARM_LIMIT @@ -1817,12 +1817,12 @@ response.arterialPressureLimitWindowRejectionReason = REQUEST_REJECT_REASON_PARAM_OUT_OF_RANGE; } - if ( FALSE == isVenousPressureLimitWindowValid( request.venousPressureLimitWindowMMHG ) ) + if ( FALSE == isVenousPressureLimitWindowValid( request.venousHighPressureLimitWindowMMHG ) ) { response.venousPressureLimitWindowRejectionReason = REQUEST_REJECT_REASON_PARAM_OUT_OF_RANGE; } - if ( FALSE == isVenousAsymmetricPressureLimitWindowValid( request.venousAsymmetricPressureLimitWindowMMHG ) ) + if ( FALSE == isVenousAsymmetricPressureLimitWindowValid( request.venousLowPressureLimitWindowMMHG ) ) { response.venousAsymmetricPressureLimitWindowRejectionReason = REQUEST_REJECT_REASON_PARAM_OUT_OF_RANGE; } @@ -1842,9 +1842,9 @@ { setSysConfigTreatmentParameterU32( TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW, request.arterialPressureLimitWindowMMHG ); - setSysConfigTreatmentParameterU32( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW, request.venousPressureLimitWindowMMHG ); + setSysConfigTreatmentParameterU32( TREATMENT_PARAM_VEN_PRES_HIGH_LIMIT_WINDOW, request.venousHighPressureLimitWindowMMHG ); - setSysConfigTreatmentParameterU32( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC, request.venousAsymmetricPressureLimitWindowMMHG ); + setSysConfigTreatmentParameterU32( TREATMENT_PARAM_VEN_PRES_LOW_LIMIT_WINDOW, request.venousLowPressureLimitWindowMMHG ); setSysConfigTreatmentParameterU32( TREATMENT_PARAM_TMP_PRES_LIMIT_WINDOW, request.tmpPressureLimitWindowMMHG ); @@ -1911,8 +1911,8 @@ pressureValid = isPressureLimitValueValid( value, - getU32SysConfigTreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW ), - getU32SysConfigTreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW ) ); + getU32SysConfigTreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRES_HIGH_LIMIT_WINDOW ), + getU32SysConfigTreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRES_LOW_LIMIT_WINDOW ) ); return pressureValid; } @@ -1932,8 +1932,8 @@ pressureValid = isPressureLimitValueValid( value, - getU32SysConfigTreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC ), - getU32SysConfigTreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC ) ); + getU32SysConfigTreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRES_HIGH_LIMIT_WINDOW ), + getU32SysConfigTreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRES_LOW_LIMIT_WINDOW ) ); return pressureValid; }