Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r79c2105d7ec35f3caeb977f6e2cc1b494853d211 -rdb8ff28e816a37e033e36b76ab5949be78114125 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 79c2105d7ec35f3caeb977f6e2cc1b494853d211) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision db8ff28e816a37e033e36b76ab5949be78114125) @@ -23,6 +23,7 @@ #include "ModeTxParams.h" #include "ModeStandby.h" #include "OperationModes.h" +#include "SystemCommTD.h" /** * @addtogroup TDStandbyMode @@ -71,7 +72,7 @@ // Re-initialize when transitioning to standby mode initStandbyMode(); - initDDInterface(); + resetDDInterface(); setCurrentSubState( NO_SUB_STATE ); // Set user alarm recovery actions allowed in this mode @@ -203,7 +204,7 @@ static TD_STANDBY_STATE_T handleStandbyModeWaitForTreatmentState( void ) { TD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; -// DG_OP_MODE_T dgOperationMode = getDDOpMode(); + DD_OP_MODE_T ddOperationMode = getDDOpMode(); // switch ( dgOperationMode ) // { @@ -293,6 +294,16 @@ { rejReason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; } + // Verify DD is communicating with HD + else if ( isDDCommunicating() != TRUE ) + { + rejReason = REQUEST_REJECT_REASON_DD_COMM_LOST; + } + // Verify DD is not busy + else if ( ( DD_MODE_STAN != getDDOpMode() ) || ( DD_STANDBY_MODE_STATE_IDLE != getDDSubMode() ) ) // || ( isDDPOSTPassed() != TRUE ) ) + { + rejReason = REQUEST_REJECT_REASON_DD_NOT_IN_STANDBY_IDLE_STATE; + } else { // If request to start treatment not rejected, set flag to initiate treatment workflow Index: firmware/App/Modes/ModeTxParams.c =================================================================== diff -u -raa6d45143096dfab776ce2ed7c775cfe2dd6db18 -rdb8ff28e816a37e033e36b76ab5949be78114125 --- firmware/App/Modes/ModeTxParams.c (.../ModeTxParams.c) (revision aa6d45143096dfab776ce2ed7c775cfe2dd6db18) +++ firmware/App/Modes/ModeTxParams.c (.../ModeTxParams.c) (revision db8ff28e816a37e033e36b76ab5949be78114125) @@ -105,7 +105,7 @@ /// Treatment parameter properties (types, ranges and defaults). const TREATMENT_PARAMS_PROPERTIES_T TREAT_PARAMS_PROPERTIES[ NUM_OF_TREATMENT_PARAMS ] = -{ +{ // type min max default { CRITICAL_DATA_TYPE_U32, {.uInt=50}, {.uInt=500}, {.uInt=50} }, // TREATMENT_PARAM_BLOOD_FLOW { CRITICAL_DATA_TYPE_U32, {.uInt=50}, {.uInt=600}, {.uInt=50} }, // TREATMENT_PARAM_DIALYSATE_FLOW { CRITICAL_DATA_TYPE_U32, {.uInt=60}, {.uInt=480}, {.uInt=60} }, // TREATMENT_PARAM_TREATMENT_DURATION @@ -114,7 +114,7 @@ { CRITICAL_DATA_TYPE_U32, {.uInt=0}, {.uInt=0}, {.uInt=0} }, // TREATMENT_PARAM_HEPARIN_TYPE { CRITICAL_DATA_TYPE_U32, {.uInt=0}, {.uInt=2}, {.uInt=0} }, // TREATMENT_PARAM_ACID_CONCENTRATE { CRITICAL_DATA_TYPE_U32, {.uInt=0}, {.uInt=0}, {.uInt=0} }, // TREATMENT_PARAM_BICARB_CONCENTRATE - { CRITICAL_DATA_TYPE_U32, {.uInt=0}, {.uInt=5}, {.uInt=0} }, // TREATMENT_PARAM_DIALYZER_TYPE + { CRITICAL_DATA_TYPE_U32, {.uInt=0}, {.uInt=6}, {.uInt=0} }, // TREATMENT_PARAM_DIALYZER_TYPE { CRITICAL_DATA_TYPE_U32, {.uInt=0}, {.uInt=60}, {.uInt=0} }, // TREATMENT_PARAM_BP_MEAS_INTERVAL { CRITICAL_DATA_TYPE_U32, {.uInt=100}, {.uInt=300}, {.uInt=200} }, // TREATMENT_PARAM_RINSEBACK_FLOW_RATE { CRITICAL_DATA_TYPE_U32, {.uInt=200}, {.uInt=400}, {.uInt=300} }, // TREATMENT_PARAM_RINSEBACK_VOLUME @@ -701,11 +701,12 @@ BOOL signalUserConfirmationOfTreatmentParameters( MESSAGE_T *message ) { BOOL result = FALSE; - BOOL confirmed = FALSE; // Verify message payload length is valid if ( sizeof( BOOL ) == message->hdr.payloadLen ) { + BOOL confirmed = FALSE; + memcpy( &confirmed, message->payload, sizeof( BOOL ) ); if ( ( MODE_TPAR == getCurrentOperationMode() ) && ( TD_TREATMENT_PARAMS_MODE_STATE_WAIT_4_UI_2_CONFIRM == currentTreatmentParamsState ) ) { Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -r036a75d76ab01912646a480b935d97187a231a19 -rdb8ff28e816a37e033e36b76ab5949be78114125 --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 036a75d76ab01912646a480b935d97187a231a19) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision db8ff28e816a37e033e36b76ab5949be78114125) @@ -67,23 +67,14 @@ { U32 i; - // NOTE: the active reservoir is set to reservoir 1 since DG will send active reservoir 1 as active on power up - ddStarted = FALSE; ddCurrentOpMode = DD_MODE_INIT; ddSubMode = 0; dialysatePressure = 0.0F; - ddStartCommandSent = FALSE; ddOpModeDataFreshFlag = FALSE; ddDialysatePressureFreshFlag = FALSE; - dialysateDeliveryCmdSet.start = FALSE; - dialysateDeliveryCmdSet.dialRate = 0.0F; - dialysateDeliveryCmdSet.ufRate = 0.0F; - dialysateDeliveryCmdSet.dialTemp = 0.0F; - dialysateDeliveryCmdSet.bypassDialyzer = TRUE; - dialysateDeliveryCmdSet.acidType = 0; - dialysateDeliveryCmdSet.bicarbType = 0; + resetDDInterface(); // initialize DD command response for ( i = 0; i < NUM_OF_DD_COMMANDS; i++ ) @@ -96,6 +87,28 @@ // initPersistentAlarm( ALARM_ID_TD_DD_NEW_OPERATION_MODE_MESSAGE_NOT_RECEIVE, DD_DATA_FRESHNESS_TIMEOUT_MS, DD_DATA_FRESHNESS_TIMEOUT_MS ); } +/*********************************************************************//** + * @brief + * The resetDDInterface function resets the DDInterface unit before starting + * a new treatment work flow. + * @details \b Inputs: none + * @details \b Outputs: DDInterface unit reset. + * @return none + *************************************************************************/ +void resetDDInterface( void ) +{ + ddStarted = FALSE; + ddStartCommandSent = FALSE; + + dialysateDeliveryCmdSet.start = FALSE; + dialysateDeliveryCmdSet.dialRate = 0.0F; + dialysateDeliveryCmdSet.ufRate = 0.0F; + dialysateDeliveryCmdSet.dialTemp = 0.0F; + dialysateDeliveryCmdSet.bypassDialyzer = TRUE; + dialysateDeliveryCmdSet.acidType = 0; + dialysateDeliveryCmdSet.bicarbType = 0; +} + /**********************************************************************//** * @brief * The checkDGDataFreshness function checks the freshness of data coming from @@ -293,6 +306,7 @@ dialysateDeliveryCmdSet.bicarbType = (U32)bicarb; sendMessage( MSG_ID_DD_GEN_DIALYSATE_REQUEST_DATA, COMM_BUFFER_OUT_CAN_TD_2_DD, (U08*)(&dialysateDeliveryCmdSet), sizeof( DIALYSATE_DELIVERY_REQ_PAYLOAD_T ) ); + ddStartCommandSent = TRUE; } /*********************************************************************//** Index: firmware/App/Services/DDInterface.h =================================================================== diff -u -r036a75d76ab01912646a480b935d97187a231a19 -rdb8ff28e816a37e033e36b76ab5949be78114125 --- firmware/App/Services/DDInterface.h (.../DDInterface.h) (revision 036a75d76ab01912646a480b935d97187a231a19) +++ firmware/App/Services/DDInterface.h (.../DDInterface.h) (revision db8ff28e816a37e033e36b76ab5949be78114125) @@ -44,6 +44,7 @@ // ********** public function prototypes ********** void initDDInterface( void ); +void resetDDInterface( void ); void execDDInterfaceMonitor( void );