Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r1a5efe97f5f39594b45797fded52cafce92afe80 -r6818dafc0839d6e8585f5e6f35013f539ad5a0ed --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 1a5efe97f5f39594b45797fded52cafce92afe80) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 6818dafc0839d6e8585f5e6f35013f539ad5a0ed) @@ -47,6 +47,8 @@ static DG_OP_MODE_T lastMode = DG_MODE_INIT; ///< Last operation mode prior to current mode. static DG_OP_MODE_T currentMode = DG_MODE_INIT; ///< The currently active mode. static U32 currentSubMode = 0; ///< The currently active state of the active mode. +/// DG operation mode data publish interval. +static OVERRIDE_U32_T dgOpModePublishInterval = { BROADCAST_DG_OP_MODE_INTERVAL, BROADCAST_DG_OP_MODE_INTERVAL, 0, 0 }; static U32 broadcastModeIntervalCtr = 11; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. /// This matrix determines legal transitions from one mode to another. @@ -71,6 +73,7 @@ static DG_OP_MODE_T arbitrateModeRequest( void ); static void transitionToNewOperationMode( DG_OP_MODE_T newMode ); +static U32 getDGOpModePublishInterval( void ); static void broadcastOperationMode( void ); /*********************************************************************//** @@ -345,11 +348,84 @@ *************************************************************************/ static void broadcastOperationMode( void ) { - if ( ++broadcastModeIntervalCtr >= BROADCAST_DG_OP_MODE_INTERVAL ) + if ( ++broadcastModeIntervalCtr >= getDGOpModePublishInterval() ) { broadcastModeIntervalCtr = 0; broadcastDGOperationMode( (U32)currentMode, currentSubMode ); } } +/*********************************************************************//** + * @brief + * The getDGOpModePublishInterval function gets the current DG operation mode + * data publish interval. + * @details Inputs: dgOpModePublishInterval + * @details Outputs: DG operation mode broadcast message sent + * @return none + *************************************************************************/ +static U32 getDGOpModePublishInterval( void ) +{ + U32 result = dgOpModePublishInterval.data; + + if ( OVERRIDE_KEY == dgOpModePublishInterval.override ) + { + result = dgOpModePublishInterval.ovData; + } + + return result; +} + + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testSetDGOpModePublishIntervalOverride function overrides the + * DG operation mode publish interval. + * @details Inputs: none + * @details Outputs: dgOpModePublishInterval + * @param value override DG operation mode publish interval with (in ms) + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetDGOpModePublishIntervalOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + U32 intvl = value / TASK_GENERAL_INTERVAL; + + result = TRUE; + dgOpModePublishInterval.ovData = intvl; + dgOpModePublishInterval.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetDGOpModePublishIntervalOverride function resets the + * override of the DG operation mode publish interval. + * @details Inputs: none + * @details Outputs: dgOpModePublishInterval + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetDGOpModePublishIntervalOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + dgOpModePublishInterval.override = OVERRIDE_RESET; + dgOpModePublishInterval.ovData = dgOpModePublishInterval.ovInitData; + } + + return result; +} + /**@}*/ Index: firmware/App/Modes/OperationModes.h =================================================================== diff -u -r0c3e4f0618d7e42f35386fe5acf450fbb61481b6 -r6818dafc0839d6e8585f5e6f35013f539ad5a0ed --- firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 0c3e4f0618d7e42f35386fe5acf450fbb61481b6) +++ firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 6818dafc0839d6e8585f5e6f35013f539ad5a0ed) @@ -39,6 +39,9 @@ DG_OP_MODE_T getCurrentOperationMode( void ); // get the current operation mode DG_OP_MODE_T getPreviousOperationMode( void ); // get the previous operation mode +BOOL testSetDGOpModePublishIntervalOverride( U32 value ); +BOOL testResetDGOpModePublishIntervalOverride( void ); + /**@}*/ #endif Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r4703ecb3194b11c65d33602940315f262ef7ac27 -r6818dafc0839d6e8585f5e6f35013f539ad5a0ed --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 4703ecb3194b11c65d33602940315f262ef7ac27) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 6818dafc0839d6e8585f5e6f35013f539ad5a0ed) @@ -1258,6 +1258,10 @@ handleSetFluidLeakStateDetectorOverrideRequest( message ); break; + case MSG_ID_DG_OP_MODE_PUBLISH_INTERVAL_OVERRIDE: + handleSetDGOpModeBroadcastIntervalOverrideRequest( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r4703ecb3194b11c65d33602940315f262ef7ac27 -r6818dafc0839d6e8585f5e6f35013f539ad5a0ed --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 4703ecb3194b11c65d33602940315f262ef7ac27) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6818dafc0839d6e8585f5e6f35013f539ad5a0ed) @@ -2985,6 +2985,38 @@ /*********************************************************************//** * @brief +* The handleSetDGOpModeBroadcastIntervalOverrideRequest function handles a request +* to override the publish interval of the DG operation mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +BOOL handleSetDGOpModeBroadcastIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetDGOpModePublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetDGOpModePublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief * The handleROPumpTargetPressureOverride function handles a request * to override the RO pump target pressure. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r4703ecb3194b11c65d33602940315f262ef7ac27 -r6818dafc0839d6e8585f5e6f35013f539ad5a0ed --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 4703ecb3194b11c65d33602940315f262ef7ac27) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 6818dafc0839d6e8585f5e6f35013f539ad5a0ed) @@ -370,6 +370,9 @@ // MSG_ID_DG_START_STOP_CHEM_DSINFECT BOOL handleStartStopDGChemicalDisinfect( MESSAGE_T *message ); +// MSG_ID_DG_OP_MODE_PUBLISH_INTERVAL_OVERRIDE +BOOL handleSetDGOpModeBroadcastIntervalOverrideRequest( MESSAGE_T *message ); + /**@}*/ #endif