Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rb631516f8159c25ba2ffd215afa696795d97a28c -r5fa15db8e36792f83650711ab29755912d229437 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision b631516f8159c25ba2ffd215afa696795d97a28c) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 5fa15db8e36792f83650711ab29755912d229437) @@ -25,6 +25,7 @@ #include "ROPump.h" #include "SystemComm.h" #include "SystemCommMessages.h" +#include "TaskGeneral.h" #include "Timers.h" #include "Valves.h" @@ -35,9 +36,10 @@ // ********** private definitions ********** -#define FILTER_FLUSH_TIME_MS ( 120 * MS_PER_SECOND ) ///< Duration of filter flush state (in ms). -#define WATER_SAMPLE_TIME_MS ( 10 * MS_PER_SECOND ) ///< Duration of water sample state (in ms). -#define FLUSH_EXPIRATION_TIME_MS ( 10 * SEC_PER_MIN * MS_PER_SECOND ) ///< Duration in which a filter flush is valid (in ms). +#define FILTER_FLUSH_TIME_MS ( 120 * MS_PER_SECOND ) ///< Duration of filter flush state (in ms). +#define WATER_SAMPLE_TIME_MS ( 10 * MS_PER_SECOND ) ///< Duration of water sample state (in ms). +#define FLUSH_EXPIRATION_TIME_MS ( 10 * SEC_PER_MIN * MS_PER_SECOND ) ///< Duration in which a filter flush is valid (in ms). +#define FILTER_FLUSH_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Filter flush data broadcast interval. // ********** private data ********** @@ -50,6 +52,7 @@ static BOOL pendingStartDGRequest = FALSE; ///< Flag indicating HD has requested DG start (go to re-circulate mode). static U32 waterSampleStartTime = 0; ///< Time stamp for start of water sample state. static U32 filterFlushStartTime = 0; ///< Time stamp for start of filter flush state. +static U32 filterFlushPublishTimerCounter = 0; ///< Filter flush data publish timer counter. // ********** private function prototypes ********** @@ -75,6 +78,7 @@ waterSampleStartTime = 0; filterFlushStartTime = 0; + filterFlushPublishTimerCounter = 0; pendingStartDGRequest = FALSE; } @@ -201,6 +205,15 @@ state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; } + if ( FILTER_FLUSH_DATA_PUBLISH_INTERVAL <= filterFlushPublishTimerCounter++ ) + { + U32 const timeout = FILTER_FLUSH_TIME_MS / MS_PER_SECOND; + U32 const countdown = ( ( getMSTimerCount() - filterFlushStartTime ) / MS_PER_SECOND ); + filterFlushPublishTimerCounter = 0; + + broadcastFilterFlushData( timeout, countdown ); + } + return state; } Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rb631516f8159c25ba2ffd215afa696795d97a28c -r5fa15db8e36792f83650711ab29755912d229437 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision b631516f8159c25ba2ffd215afa696795d97a28c) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5fa15db8e36792f83650711ab29755912d229437) @@ -884,6 +884,36 @@ /*********************************************************************//** * @brief + * The broadcastFilterFlushData function sends out the filter flush progress data. + * @details Inputs: none + * @details Outputs: filter flush data msg constructed and queued + * @param timeout flush filter timeout (in sec) + * @param countdown flush filter timeout count down (in sec) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastFilterFlushData( U32 timeout, U32 countdown ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_FILTER_FLUSH_PROGRESS; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &timeout, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &countdown, sizeof( U32 ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The sendCommandResponseMsg function constructs a command response to HD * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r6145c5d1a645646587fb077df3c61eef2354f744 -r5fa15db8e36792f83650711ab29755912d229437 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 6145c5d1a645646587fb077df3c61eef2354f744) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5fa15db8e36792f83650711ab29755912d229437) @@ -99,6 +99,9 @@ // MSG_ID_DG_UV_REACTORS_DATA BOOL broadcastUVReactorsData( UV_REACTORS_DATA_T *uvReactorsData ); +// MSG_ID_DG_FILTER_FLUSH_PROGRESS +BOOL broadcastFilterFlushData( U32 timeout, U32 countdown ); + // MSG_ID_DG_COMMAND_RESPONSE void sendCommandResponseMsg( DG_CMD_RESPONSE_T *cmdResponsePtr );