Index: firmware/App/Modes/ModePreGenDialysate.c =================================================================== diff -u -r6e36d2fd90b130f540494f4128951d81e7dc5ed5 -rde4b330865ad6f9966c76f3b335d5b3966f8a1b2 --- firmware/App/Modes/ModePreGenDialysate.c (.../ModePreGenDialysate.c) (revision 6e36d2fd90b130f540494f4128951d81e7dc5ed5) +++ firmware/App/Modes/ModePreGenDialysate.c (.../ModePreGenDialysate.c) (revision de4b330865ad6f9966c76f3b335d5b3966f8a1b2) @@ -40,6 +40,7 @@ static DD_PRE_GEN_DAILYSATE_STATE_T preGenDialysateState; ///< Currently active pre-gen dialysate state. static OVERRIDE_U32_T pendingStartDDGenDialRequest; ///< Flag indicating TD has requested DD start the generation dialysate request(Overridable). +static OVERRIDE_U32_T pendingStopDDPreGenDialRequest; ///< Flag indicating TD has requested DD stop the pre generation dialysate (Overridable). static U32 preGenDialysatePublishTimerCounter; ///< Pre-Gen Dialysate data broadcast timer counter used to schedule when to transmit data. static OVERRIDE_U32_T preGenDialysateModePublishInterval; ///< Interval (in task intervals) at which to publish pre-gen dialysate mode data to CAN bus. @@ -63,6 +64,10 @@ pendingStartDDGenDialRequest.ovData = FALSE; pendingStartDDGenDialRequest.ovInitData = FALSE; pendingStartDDGenDialRequest.override = OVERRIDE_RESET; + pendingStopDDPreGenDialRequest.data = FALSE; + pendingStopDDPreGenDialRequest.ovData = FALSE; + pendingStopDDPreGenDialRequest.ovInitData = FALSE; + pendingStopDDPreGenDialRequest.override = OVERRIDE_RESET; preGenDialysateModePublishInterval.data = PRE_GEN_DIALYSATE_DATA_PUB_INTERVAL; preGenDialysateModePublishInterval.ovData = PRE_GEN_DIALYSATE_DATA_PUB_INTERVAL; preGenDialysateModePublishInterval.ovInitData = 0; @@ -105,6 +110,12 @@ pendingStartDDGenDialRequest.data = FALSE; requestNewOperationMode( DD_MODE_GEND ); } + //TODO: Transition to post gen dialysate if concentrate priming has been started + if ( TRUE == getU32OverrideValue( &pendingStopDDPreGenDialRequest ) ) + { + pendingStopDDPreGenDialRequest.data = FALSE; + requestNewOperationMode( DD_MODE_STAN ); + } // execute current pre-gen dialysate state switch ( preGenDialysateState ) @@ -166,21 +177,16 @@ * The requestDDPreGenStop function handles an TD request to stop * pre-generation dialysis mode. * @details \b Inputs: Pre generation dialysate mode / state - * @details \b Outputs: mode transition + * @details \b Outputs: pendingStopDDPreGenDialRequest * @return TRUE if request accepted, FALSE if not. *************************************************************************/ BOOL requestDDPreGenStop( void ) { BOOL status = FALSE; - //TODO: Transition to post gen dialysate if concentrate priming has been started - - //TODO: Tranistion to standby if concentrate priming is not yet started if ( DD_MODE_PREG == getCurrentOperationMode() ) { - // Transition to mode standby - requestNewOperationMode( DD_MODE_STAN ); - + pendingStopDDPreGenDialRequest.data = TRUE; status = TRUE; } @@ -267,4 +273,21 @@ return result; } +/*********************************************************************//** + * @brief + * The testDDstopPreGenDialysateOverride function sets the override value + * to stop the pre gen dialysate operation mode. + * @details Inputs: pendingStopDDPreGenDialRequest + * @details Outputs: pendingStopDDPreGenDialRequest + * @param message Override message from Dialin which includes the flag + * to override the operation mode. + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testDDstopPreGenDialysateOverride( MESSAGE_T *message ) +{ + BOOL result = u32Override( message, &pendingStopDDPreGenDialRequest, FALSE, TRUE ); + + return result; +} + /**@}*/