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; } /*********************************************************************//**