Index: firmware/App/Services/TDInterface.c =================================================================== diff -u -rbd522c8ffdf75130571e5b6a79d1b1d6acd78b1c -r67453852a25077d0da103dca88449ee79d628680 --- firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision bd522c8ffdf75130571e5b6a79d1b1d6acd78b1c) +++ firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision 67453852a25077d0da103dca88449ee79d628680) @@ -95,6 +95,8 @@ static U32 tdSubMode; ///< Current state (sub-mode) of current TD operation mode. static BOOL tdDialyzerBypass; ///< TD dialyzer bypass static BOOL tdOpModeDataFreshFlag = FALSE; ///< Flag to signal/process fresh TD op mode data +static BOOL chamberHValveOpen; ///< Chamber H vent valve open status +static BOOL primeFluidDiscardStart; ///< Priming fluid discard start status static OVERRIDE_F32_T tdDialysateFlowrate; ///< TD Dialysate flow rate static OVERRIDE_F32_T tdUFRate; ///< TD ultrafiltration rate @@ -238,6 +240,34 @@ /*********************************************************************//** * @brief + * The setChamberHValveStatus function sets the requested Chamber H vent + * valve open state, used to open chamber H valve to depressurize. + * @details \b Inputs: none + * @details \b Outputs: chamberHValveOpen + * @param flag TRUE to request the Chamber H vent valve open, FALSE to close it + * @return none + *************************************************************************/ +void setChamberHValveStatus( BOOL flag ) +{ + chamberHValveOpen = flag; +} + +/*********************************************************************//** + * @brief + * The setprimeFluidDiscardStatus function sets the requested priming fluid + * discard state, used to discard priming fluid. + * @details \b Inputs: none + * @details \b Outputs: primeFluidDiscardStart + * @param flag TRUE to request priming fluid discard start, FALSE to stop it + * @return none + *************************************************************************/ +void setprimeFluidDiscardStatus( BOOL flag ) +{ + primeFluidDiscardStart = flag; +} + +/*********************************************************************//** + * @brief * The setTDOpMode function sets the latest TD operating mode reported by * the TD (called by TD published message handler). * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if reported TD mode is invalid. @@ -364,6 +394,32 @@ /*********************************************************************//** * @brief + * The getChamberHValveStatus function returns the current Chamber H vent + * valve open request status. + * @details \b Inputs: chamberHValveOpen + * @details \b Outputs: none + * @return TRUE if Chamber H vent valve open is requested, FALSE if not + *************************************************************************/ +BOOL getChamberHValveStatus( void ) +{ + return chamberHValveOpen; +} + +/*********************************************************************//** + * @brief + * The getprimeFluidDiscardStatus function returns the current priming fluid + * discard request status. + * @details \b Inputs: primeFluidDiscardStart + * @details \b Outputs: none + * @return TRUE if priming fluid discard is requested, FALSE if not + *************************************************************************/ +BOOL getprimeFluidDiscardStatus( void ) +{ + return primeFluidDiscardStart; +} + +/*********************************************************************//** + * @brief * The getTDTargetDialysateTemperature function gets the latest TD * target dialysate temperature rate. * @details \b Inputs: tdDialysateTemp @@ -609,7 +665,35 @@ return result; } +/*********************************************************************//** + * @brief + * The handlePrimeDataRequestMsg function handles a prime data request + * from TD, updates Chamber H vent valve and priming fluid discard requests. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return TRUE if message is sucessfully parsed, FALSE if not. + *************************************************************************/ +BOOL handlePrimeDataRequestMsg( MESSAGE_T *message ) +{ + BOOL result = FALSE; + if ( message->hdr.payloadLen == sizeof( PRIME_DATA_REQ_PAYLOAD_T ) ) + { + PRIME_DATA_REQ_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof( PRIME_DATA_REQ_PAYLOAD_T ) ); + + setChamberHValveStatus( payload.chamberHValveOpen ); + setprimeFluidDiscardStatus( payload.primeFluidDiscardStart ); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DD_2_TD, result ); + + return result; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/