Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -r176bb5bc32a18891912e179dc1bc9293b370bed4 -rc048e88d130c4c30f9538330e8fcf23fcc581806 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 176bb5bc32a18891912e179dc1bc9293b370bed4) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision c048e88d130c4c30f9538330e8fcf23fcc581806) @@ -47,6 +47,7 @@ static BOOL patientDisconnectHandled; ///< Flag indicates patient disconnect actions have been handled static BOOL disposableRemovalConfirmed; ///< Flag indicates user confirms disposable removal. static DISINFECT_SELECTION_T selectedDisinfectionSelection; ///< Selected disinfection option from UI.static BOOL disinfectionSelectionReceived; +static BOOL disinfectionSelectionReceived; static volatile U32 postTreatmentStateBroadcastTimer; ///< Timer counter for pending power off request. static TD_POST_TREATMENT_STATE_T currentPostTreatmentState; ///< Current Post-Treatment sub-state @@ -317,14 +318,36 @@ *************************************************************************/ static TD_POST_TREATMENT_STATE_T handleDisinfectionState( void ) { - TD_POST_TREATMENT_STATE_T state = - TD_POST_TREATMENT_DISINFECTION_STATE; + TD_POST_TREATMENT_STATE_T state = TD_POST_TREATMENT_DISINFECTION_STATE; + static DD_COMMAND_T command = DD_CMD_NONE; + if ( TRUE == disinfectionSelectionReceived ) { + switch ( selectedDisinfectionSelection ) + { + case DISINFECT_SEL_SKIP: + command = DD_CMD_START_DISINFECT_SKIP; + break; + case DISINFECT_SEL_FLUSH: + command = DD_CMD_START_DISINFECT_FLUSH; + break; + case DISINFECT_SEL_HEAT: + command = DD_CMD_START_DISINFECT_HEAT; + break; + case DISINFECT_SEL_HEAT_CITRIC: + command = DD_CMD_START_DISINFECT_HEAT_CITRIC; + break; + case DISINFECT_SEL_SUBSTITUTION_PORT: + command = DD_CMD_START_DISINFECT_SUBSTITUTION_PORT; + break; + default: + command = DD_CMD_NONE; + break; + } +// command = selectedDisinfectionSelection + DD_CMD_START_DISINFECT_SKIP; // Save selected disinfection option in Standby. - signalStandbyDisinfectionSelection( - selectedDisinfectionSelection ); + signalStandbyDisinfectionSelection( command ); // Request DD transition to Standby. cmdStopGenerateDialysate(); @@ -337,41 +360,7 @@ return state; } -/*********************************************************************//** - * @brief - * The handleDisinfectionConfirmCmd function handles user selection - * of the Post-Treatment disinfection operation. - * @details \b Inputs: Disinfection selection message. - * @details \b Outputs: Acceptance response and selected disinfection command. - * @param message Pointer to the message to handle. - * @return TRUE if the selection is accepted, FALSE otherwise. - *************************************************************************/ -BOOL handleDisinfectionConfirmCmd( MESSAGE_T *message ) -{ - BOOL result = FALSE; - TD_OP_MODE_T mode = getCurrentOperationMode(); - UI_RESPONSE_PAYLOAD_T response; - response.rejectionReason = REQUEST_REJECT_REASON_NONE; - - if ( sizeof( U32 ) == message->hdr.payloadLen ) - { - disinfectionSelectionReceived = TRUE; - } - else - { - response.rejectionReason = - REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; - } - - response.accepted = result; - - sendMessage( MSG_ID_TD_DISINFECT_RESPONSE, COMM_BUFFER_OUT_CAN_TD_2_UI, - (U08 *)&response, sizeof( UI_RESPONSE_PAYLOAD_T ) ); - - return result; -} - /*********************************************************************//** * @brief * The signalUserConfirmPatientDisconnection signals post-treatment mode @@ -406,9 +395,10 @@ * @details \b Outputs: selectedDisinfectionCommand * @return none *************************************************************************/ -void signalUserConfirmDisinfection( DISINFECT_SELECTION_T selection ) +void signalUserConfirmDisinfection( DISINFECT_SELECTION_T options ) { - selectedDisinfectionSelection = selection; + disinfectionSelectionReceived = TRUE; + selectedDisinfectionSelection = options; }