Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r6e36d2fd90b130f540494f4128951d81e7dc5ed5 -rde4b330865ad6f9966c76f3b335d5b3966f8a1b2 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 6e36d2fd90b130f540494f4128951d81e7dc5ed5) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision de4b330865ad6f9966c76f3b335d5b3966f8a1b2) @@ -57,6 +57,7 @@ static OVERRIDE_F32_T targetHydChamberFluidTemp; ///< Target hydraulics chamber fluid temperature. static OVERRIDE_U32_T isDialDeliveryInProgress; ///< To indicate dialysate started delivering to dialyzer for treatment (overrideable) static OVERRIDE_U32_T isDialysateGoodtoDeliver; ///< Flag indicating whether ready to deliver dialysate or not. +static OVERRIDE_U32_T pendingStopDDGenDialRequest; ///< Flag indicating TD has requested DD stop the generate dialysate (Overridable). static U32 genDialysateDataPublicationTimerCounter; ///< Used to schedule generate dialysate data publication to CAN bus. static OVERRIDE_U32_T genDialysateDataPublishInterval; ///< Generate dialysate mode data publish interval. static F32 lastDialTargetTemperatureSet; ///< last dialysate target temperature set for heater control @@ -95,6 +96,10 @@ isDialDeliveryInProgress.ovData = FALSE; isDialDeliveryInProgress.ovInitData = FALSE; isDialDeliveryInProgress.override = OVERRIDE_RESET; + pendingStopDDGenDialRequest.data = FALSE; + pendingStopDDGenDialRequest.ovData = FALSE; + pendingStopDDGenDialRequest.ovInitData = FALSE; + pendingStopDDGenDialRequest.override = OVERRIDE_RESET; genDialysateDataPublishInterval.data = GEN_DIALYSATE_DATA_PUBLISH_INTERVAL; genDialysateDataPublishInterval.ovData = GEN_DIALYSATE_DATA_PUBLISH_INTERVAL; genDialysateDataPublishInterval.ovInitData = 0; @@ -233,13 +238,20 @@ /*********************************************************************//** * @brief * The execGenDialysateMode function executes the Gen dialysate mode state machine. - * @details \b Inputs: none + * @details \b Inputs: pendingStopDDGenDialRequest,genDialysateState * @details \b Outputs: Gen dialysate mode state machine executed * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong gen dialysate state invoked. * @return current state. *************************************************************************/ U32 execGenDialysateMode( void ) { + //TODO: Transition to post gen dialysate then standby. + if ( TRUE == getU32OverrideValue( &pendingStopDDGenDialRequest ) ) + { + pendingStopDDGenDialRequest.data = FALSE; + requestNewOperationMode( DD_MODE_STAN ); + } + // Continuous water inlet pressure check if ( genDialysateState != DD_GEND_DIALYSATE_DELIVERY_PAUSE ) { @@ -414,18 +426,19 @@ * The requestDDGenDialyasteStop function handles an TD request to stop * generation dialysis mode. * @details \b Inputs: Generation dialysate mode / state - * @details \b Outputs: mode transition + * @details \b Outputs: mode pendingStopDDGenDialRequest * @return TRUE if request accepted, FALSE if not. *************************************************************************/ BOOL requestDDGenDialyasteStop( void ) { - BOOL status = TRUE; + BOOL status = FALSE; - //TODO: Transition to post gen dialysate and standby + if ( DD_MODE_GEND == getCurrentOperationMode() ) + { + pendingStopDDGenDialRequest.data = TRUE; + status = TRUE; + } - // Transition to mode standby - requestNewOperationMode( DD_MODE_STAN ); - return status; } @@ -665,6 +678,24 @@ /*********************************************************************//** * @brief + * The testDDstopGenDialysateOverride function sets the override value + * to stop the gen dialysate operation mode. + * @details Inputs: pendingStopDDGenDialRequest + * @details Outputs: pendingStopDDGenDialRequest + * @param message Override message from Dialin which includes the flag + * to override the operation mode. + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testDDstopGenDialysateOverride( MESSAGE_T *message ) +{ + BOOL result = u32Override( message, &pendingStopDDGenDialRequest, FALSE, TRUE ); + + return result; +} + + +/*********************************************************************//** + * @brief * The testGenDExecStateOverride function sets the Gen dialysate execution state * machine to given state. * @details \b Inputs: tester logged in, execStateSet