Index: firmware/App/Controllers/BoostPump.h =================================================================== diff -u -r17a448770daa138ebeb6ce79974966e650828f25 -rcd1aa72cf45af72e12e47f61df2b218e5683cd64 --- firmware/App/Controllers/BoostPump.h (.../BoostPump.h) (revision 17a448770daa138ebeb6ce79974966e650828f25) +++ firmware/App/Controllers/BoostPump.h (.../BoostPump.h) (revision cd1aa72cf45af72e12e47f61df2b218e5683cd64) @@ -54,6 +54,7 @@ void initBoostPump( void ); void execBoostPumpController( void ); +void execBoostPumpMonitor( void ); void signalBoostPumpStop( void ); BOOL isBoostPumpRunning( void ); @@ -67,6 +68,8 @@ F32 getTargetBoostPumpPressure( void ); BOOL testBoostPumpDataPublishIntervalOverride( MESSAGE_T *message ); +BOOL testBoostPumpTargetPressureOverride( MESSAGE_T *message ); +BOOL testBoostPumpTargetFlowOverride( MESSAGE_T *message ); Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -r17a448770daa138ebeb6ce79974966e650828f25 -rcd1aa72cf45af72e12e47f61df2b218e5683cd64 --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 17a448770daa138ebeb6ce79974966e650828f25) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision cd1aa72cf45af72e12e47f61df2b218e5683cd64) @@ -53,6 +53,7 @@ // ********** public function prototypes ********** void initROPump( void ); +void execROPumpMonitor( void ); void execROPumpController( void ); void signalROPumpHardStop( void ); @@ -67,9 +68,10 @@ F32 getTargetROPumpPressure( void ); BOOL testROPumpDataPublishIntervalOverride( MESSAGE_T *message ); +BOOL testROPumpTargetPressureOverride( MESSAGE_T *message ); +BOOL testROPumpTargetFlowOverride( MESSAGE_T *message ); - /**@}*/ #endif Index: firmware/App/Modes/FilterFlush.c =================================================================== diff -u -r99498a5bab0a1f4c706376feceadc66df6d1c22e -rcd1aa72cf45af72e12e47f61df2b218e5683cd64 --- firmware/App/Modes/FilterFlush.c (.../FilterFlush.c) (revision 99498a5bab0a1f4c706376feceadc66df6d1c22e) +++ firmware/App/Modes/FilterFlush.c (.../FilterFlush.c) (revision cd1aa72cf45af72e12e47f61df2b218e5683cd64) @@ -1 +1,141 @@ +/************************************************************************** +* +* Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +* +* THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +* WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +* +* @file FilterFlush.c +* +* @author (last) Michael Garthwaite +* @date (last) 28-Feb-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 28-Feb-2025 +* +***************************************************************************/ + + +#include "FilterFlush.h" +#include "MessageSupport.h" +#include "Messaging.h" +#include "OperationModes.h" +#include "TaskGeneral.h" +#include "Timers.h" + +/** + * @addtogroup FPFilterFlush + * @{ + */ + +// ********** private definitions ********** + +#define FILTER_FLUSH_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the gen water mode data published. + +// ********** private data ********** + +static FP_FILTER_FLUSH_STATE_T filterFlushState; ///< Currently active generate water state. +static U32 filterFlushDataPublicationTimerCounter; ///< Used to schedule generate water data publication to CAN bus. +static OVERRIDE_U32_T filterFlushDataPublishInterval; ///< Generate water mode data publish interval. + + +// ********** private function prototypes ********** + +static void publishFilterFlushData( void ); +static RO_GENW_MODE_STATE_T handleFilterFlushProgressState( void ); +static RO_GENW_MODE_STATE_T handleFilterFlushPausedState( void ); +static void setModeGenWTransition( FP_FILTER_FLUSH_STATE_T state ); + +/*********************************************************************//** + * @brief + * The initFilterFlush function initializes the filter flush unit. + * @details \b Inputs: none + * @details \b Outputs: filter flush unit initialized + * @return none + *************************************************************************/ +void initFilterFlush( void ) +{ + filterFlushState = FILTER_FLUSH_PAUSED; + filterFlushDataPublishInterval.data = FILTER_FLUSH_DATA_PUBLISH_INTERVAL; + filterFlushDataPublishInterval.ovData = FILTER_FLUSH_DATA_PUBLISH_INTERVAL; + filterFlushDataPublishInterval.ovInitData = 0; + filterFlushDataPublishInterval.override = OVERRIDE_RESET; + filterFlushDataPublicationTimerCounter = 0; + +} + +/*********************************************************************//** + * @brief + * The getCurrentFilterFlushState function returns the current state of + * filter flush. + * @details \b Inputs: filterFlushState + * @details \b Outputs: filterFlushState + * @return the current state of gen water mode + *************************************************************************/ +RO_GENW_MODE_STATE_T getCurrentFilterFlushState( void ) +{ + return filterFlushState; +} + +/*********************************************************************//** + * @brief + * The getFilterFlushPublishInterval function gets the filter flush + * mode data publish interval. + * @details \b Inputs: filterFlushDataPublishInterval + * @details \b Outputs: none + * @return the interval at generate water mode data being published. + *************************************************************************/ +static U32 getFilterFlushPublishInterval( void ) +{ + U32 result = getU32OverrideValue( &filterFlushDataPublishInterval ); + + return result; +} + +/*********************************************************************//** + * @brief + * The publishGenWModeData function broadcasts the generate water + * mode data at defined interval. + * @details \b Inputs: genDialysateDataPublicationTimerCounter + * @details \b Outputs: DD generate water data broadcast message sent + * @details \b Message \Sent: MSG_ID_RO_GEN_WATER_MODE_DATA to publish the + * generate water mode data. + * @return none + *************************************************************************/ +static void publishFilterFlushData( void ) +{ + if ( ++filterFlushDataPublicationTimerCounter >= getFilterFlushPublishInterval() ) + { + FILTER_FLUSH_DATA_T data; + + data.filterFlushExecState = (U32)getCurrentGenWaterState(); + + broadcastData( MSG_ID_FP_GEN_WATER_MODE_DATA, COMM_BUFFER_OUT_CAN_RO_BROADCAST, (U08*)&data, sizeof( GEN_WATER_MODE_DATA_T ) ); + + filterFlushDataPublicationTimerCounter = 0; + } +} + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testROGenWaterDataPublishIntervalOverride function overrides the + * DD generate water mode data publish interval. + * @details \b Inputs: genWaterDataPublishInterval + * @details \b Outputs: genWaterDataPublishInterval + * @param Override message from Dialin which includes the interval + * (in ms) to override the RO generate water data publish interval to. + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testFilterFlushDataPublishIntervalOverride( MESSAGE_T *message ) +{ + BOOL result = u32BroadcastIntervalOverride( message, &filterFlushDataPublishInterval, TASK_GENERAL_INTERVAL ); + + return result; +} + +/**@}*/ Index: firmware/App/Modes/FilterFlush.h =================================================================== diff -u -r99498a5bab0a1f4c706376feceadc66df6d1c22e -rcd1aa72cf45af72e12e47f61df2b218e5683cd64 --- firmware/App/Modes/FilterFlush.h (.../FilterFlush.h) (revision 99498a5bab0a1f4c706376feceadc66df6d1c22e) +++ firmware/App/Modes/FilterFlush.h (.../FilterFlush.h) (revision cd1aa72cf45af72e12e47f61df2b218e5683cd64) @@ -1,15 +1,51 @@ -/* - * FilterFlush.h +/************************************************************************** +* +* Copyright (c) 2024-2025 Diality Inc. - All Rights Reserved. +* +* THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +* WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +* +* @file FilterFlush.h +* +* @author (last) Michael Garthwaite +* @date (last) 03-Mar-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 03-Mar-2025 +* +***************************************************************************/ + +#ifndef __FILTER_FLUSH_H__ +#define __FILTER_FLUSH_H__ + +#include "FPCommon.h" +#include "RODefs.h" + +/** + * @defgroup FPFilterFlush FPFilterFlush + * @brief Filter Flush unit. Manages filter flush functions via a state machine. * - * Created on: May 30, 2025 - * Author: fw + * @addtogroup FPFilterFlush + * @{ */ -#ifndef APP_MODES_FILTERFLUSH_H_ -#define APP_MODES_FILTERFLUSH_H_ +// ********** public definitions ********** +/// Filter Flush data structure +typedef struct +{ + U32 filterFlushExecState; ///< Filter Flush execution state +} FILTER_FLUSH_DATA_T; +// ********** public function prototypes ********** +void initFilterFlushMode( void ); // Initialize this gen water mode unit +U32 transitionToFilterFlushMode( void ); // Transition to gen water mode +U32 execFilterFlushMode( void ); // Execute the gen water mode state machine (call from OperationModes) +FP_FILTER_FLUSH_STATE_T getCurrentFilterFlushState( void ); // Get the current state of the gen water mode -#endif /* APP_MODES_FILTERFLUSH_H_ */ +/**@}*/ + + +#endif Index: firmware/App/Modes/ModeWaterGen.c =================================================================== diff -u -r99498a5bab0a1f4c706376feceadc66df6d1c22e -rcd1aa72cf45af72e12e47f61df2b218e5683cd64 --- firmware/App/Modes/ModeWaterGen.c (.../ModeWaterGen.c) (revision 99498a5bab0a1f4c706376feceadc66df6d1c22e) +++ firmware/App/Modes/ModeWaterGen.c (.../ModeWaterGen.c) (revision cd1aa72cf45af72e12e47f61df2b218e5683cd64) @@ -252,8 +252,8 @@ return state; } -/** - * *******************************************************************//** + +/*********************************************************************//** * @brief * The getCurrentGenWaterState function returns the current state of the * gen water mode. @@ -280,13 +280,14 @@ return result; } + /*********************************************************************//** * @brief * The publishGenWModeData function broadcasts the generate water * mode data at defined interval. * @details \b Inputs: genDialysateDataPublicationTimerCounter - * @details \b Outputs: DD generate water data broadcast message sent - * @details \b Message \Sent: MSG_ID_RO_GEN_WATER_MODE_DATA to publish the + * @details \b Outputs: FP generate water data broadcast message sent + * @details \b Message \Sent: MSG_ID_FP_GEN_WATER_MODE_DATA to publish the * generate water mode data. * @return none *************************************************************************/ @@ -297,7 +298,7 @@ GEN_WATER_MODE_DATA_T data; data.genWaterExecState = (U32)getCurrentGenWaterState(); - data.setFlowRate = (F32)getDDPermeateFlowRate(); + data.setFlowRate = (F32)getDDPermeateFlowRate(); broadcastData( MSG_ID_FP_GEN_WATER_MODE_DATA, COMM_BUFFER_OUT_CAN_RO_BROADCAST, (U08*)&data, sizeof( GEN_WATER_MODE_DATA_T ) ); Index: firmware/App/Modes/ModeWaterGen.h =================================================================== diff -u -r99498a5bab0a1f4c706376feceadc66df6d1c22e -rcd1aa72cf45af72e12e47f61df2b218e5683cd64 --- firmware/App/Modes/ModeWaterGen.h (.../ModeWaterGen.h) (revision 99498a5bab0a1f4c706376feceadc66df6d1c22e) +++ firmware/App/Modes/ModeWaterGen.h (.../ModeWaterGen.h) (revision cd1aa72cf45af72e12e47f61df2b218e5683cd64) @@ -22,10 +22,10 @@ #include "RODefs.h" /** - * @defgroup GenWaterMode GenWaterMode + * @defgroup FPGenWaterMode FPGenWaterMode * @brief Generate Water unit. Manages water generation functions via a state machine. * - * @addtogroup GenWaterMode + * @addtogroup FPGenWaterMode * @{ */