Index: firmware/App/Services/TDInterface.c =================================================================== diff -u -r6679a2cd813b21a8cb4c58b3eeb721e0eef9a10b -rbce6e6d1cfb6e8a0b186419416460ead3a44e5e1 --- firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision 6679a2cd813b21a8cb4c58b3eeb721e0eef9a10b) +++ firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision bce6e6d1cfb6e8a0b186419416460ead3a44e5e1) @@ -17,9 +17,9 @@ #include "Messaging.h" #include "MessagePayloads.h" +#include "ModeGenDialysate.h" #include "ModeInitPOST.h" #include "ModeStandby.h" -#include "ModeGenDialysate.h" #include "OperationModes.h" #include "PersistentAlarm.h" #include "SystemCommDD.h" @@ -343,17 +343,9 @@ memcpy( &startTxRequest, message->payload, sizeof( DIALYSATE_DELIVERY_REQ_PAYLOAD_T ) ); + // Process the dialysate delivery request message if ( ( DD_MODE_STAN == ddMode ) && ( TRUE == startTxRequest.start ) ) { - result = requestDDStart(); - } - else if ( ( DD_MODE_GEND == ddMode ) && ( FALSE == startTxRequest.start ) ) - { - result = requestDDStop(); - } - - if ( ( DD_MODE_STAN == ddMode ) && ( DD_MODE_GEND == ddMode ) ) - { // Set dialysate flow rate, UF rate and dialysate temperature setTDDialysateFlowrate( startTxRequest.dialRate ); setTDUFRate( startTxRequest.ufRate ); @@ -363,8 +355,30 @@ setTDAcidAndBicarbType( startTxRequest.acidType, startTxRequest.bicarbType ); setTDDialyzerBypass( startTxRequest.bypassDialyzer ); - result |= TRUE; + // start dialysate generation + result = requestDDStart(); } + else if ( DD_MODE_GEND == ddMode ) + { + if ( FALSE == startTxRequest.start ) + { + // stop dialysate generation by transitioning to standby mode + requestNewOperationMode( DD_MODE_STAN ); + } + else + { + // Set dialysate flow rate, UF rate and dialysate temperature + setTDDialysateFlowrate( startTxRequest.dialRate ); + setTDUFRate( startTxRequest.ufRate ); + setTDTargetDialysateTemperature( startTxRequest.dialTemp ); + + // Set concentrate types, Bypass dialyzer + setTDAcidAndBicarbType( startTxRequest.acidType, startTxRequest.bicarbType ); + setTDDialyzerBypass( startTxRequest.bypassDialyzer ); + } + + result = TRUE; + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DD_2_TD, result );