Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r4fb1e15d35f6b968bab5620909c30baec98bfd4e -rf7c714a1a09b10d85a8b013712532d37b4d7b97a --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 4fb1e15d35f6b968bab5620909c30baec98bfd4e) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision f7c714a1a09b10d85a8b013712532d37b4d7b97a) @@ -15,38 +15,25 @@ * ***************************************************************************/ -#include "gio.h" - -//#include "ModeChemicalDisinfect.h" -//#include "ModeChemicalDisinfectFlush.h" -//#include "ModeDrain.h" #include "ModeFault.h" -//#include "ModeFill.h" -//#include "ModeFlush.h" -//#include "ModeGenIdle.h" -//#include "ModeHeatDisinfect.h" -//#include "ModeHeatDisinfectActiveCool.h" #include "ModeInitPOST.h" -//#include "ModeROPermeateSample.h" #include "ModeService.h" -//#include "ModeSolo.h" #include "ModeStandby.h" -//#include "NVDataMgmt.h" -#include "OperationModes.h" -//#include "ROPump.h" +#include "MessageSupport.h" #include "Messaging.h" +#include "OperationModes.h" #include "TaskGeneral.h" -#include "MessageSupport.h" + /** * @addtogroup DDOperationModes * @{ */ // ********** private definitions ********** -#define BROADCAST_DG_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the operation mode is published on the CAN bus. -// The data publish counter offset is a lower number to make sure DG is sending its status to the HD from the beginning and alarm 140 is not raised +#define BROADCAST_DD_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the operation mode is published on the CAN bus. +// The data publish counter offset is a lower number to make sure DD is sending its status to the TD from the beginning and alarm 140 is not raised #define DATA_PUBLISH_COUNTER_START_COUNT 2 ///< Data publish counter start count. // ********** private data ********** @@ -57,8 +44,8 @@ static U32 currentSubMode; ///< The currently active state of the active mode. static TD_MODE_SUB_MODE_T tdModes; ///< TD operations mode. -/// DG operation mode data publish interval. -static OVERRIDE_U32_T dgOpModePublishInterval = { BROADCAST_DG_OP_MODE_INTERVAL, BROADCAST_DG_OP_MODE_INTERVAL, 0, 0 }; +/// DD operation mode data publish interval. +static OVERRIDE_U32_T ddOpModePublishInterval = { BROADCAST_DD_OP_MODE_INTERVAL, BROADCAST_DD_OP_MODE_INTERVAL, 0, 0 }; static U32 dataPublishCounter; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. static U32 currentSubState; ///< The currently active sub state. @@ -80,16 +67,15 @@ static DD_OP_MODE_T arbitrateModeRequest( void ); static void transitionToNewOperationMode( DD_OP_MODE_T newMode ); -static U32 getDGOpModePublishInterval( void ); +static U32 getDDOpModePublishInterval( void ); static void broadcastOperationMode( void ); static void sendOperationStatusEvent( void ); /*********************************************************************//** * @brief - * The initOperationModes function initializes the operation modes module. + * The initOperationModes function initializes the operation modes unit. * @details \b Inputs: none - * @details \b Outputs: modeRequest, lastMode, currentMode, currentSubMode, - * dataPublishCounter + * @details \b Outputs: unit vairables initialized. * @return none *************************************************************************/ void initOperationModes( void ) @@ -116,15 +102,10 @@ // initServiceMode(); initInitAndPOSTMode(); // initStandbyMode(); -// initSoloMode(); // initGenIdleMode(); -// initFillMode(); -// initDrainMode(); // initFlushMode(); // initHeatDisinfectMode(); -// initChemicalDisinfectMode(); // initHeatDisinfectActiveCoolMode(); -// initChemicalDisinfectFlushMode(); // initROPermeateSampleMode(); } @@ -137,6 +118,8 @@ * @details \b Inputs: currentMode, currentSubMode * @details \b Outputs: currentMode, currentSubMode * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when illegal mode transition requested + * @details \b Message \b Sent: DD_EVENT_SUB_MODE_CHANGE to update DD operation mode + * changes.ALARM_ID_DD_SOFTWARE_FAULT if legal mode is not found. * and invalid operation mode encountered. * @return none *************************************************************************/ @@ -193,43 +176,23 @@ case DD_MODE_STAN: currentSubMode = execStandbyMode(); break; -// -// case DG_MODE_SOLO: -// currentSubMode = execSoloMode(); -// break; -// -// case DG_MODE_GENE: + +// case DD_MODE_GENE: // currentSubMode = execGenIdleMode(); // break; // -// case DG_MODE_FILL: -// currentSubMode = execFillMode(); -// break; -// -// case DG_MODE_DRAI: -// currentSubMode = execDrainMode(); -// break; -// -// case DG_MODE_FLUS: +// case DD_MODE_FLUS: // currentSubMode = execFlushMode(); // break; // // case DD_MODE_HEAT: // currentSubMode = execHeatDisinfectMode(); // break; // -// case DG_MODE_CHEM: -// currentSubMode = execChemicalDisinfectMode(); -// break; -// // case DD_MODE_HCOL: // currentSubMode = execHeatDisinfectActiveCoolMode(); // break; // -// case DG_MODE_CHFL: -// currentSubMode = execChemicalDisinfectFlushMode(); -// break; -// // case DD_MODE_ROPS: // currentSubMode = execROPermeateSampleMode(); // break; @@ -358,6 +321,8 @@ * to new operation mode. * @details \b Inputs: currentSubMode * @details \b Outputs: Transition to new mode + * @details \b Message \Sent: DD_EVENT_OP_MODE_CHANGE ( Evend Id :1) to update + * operation mode changes. ALARM_ID_DD_SOFTWARE_FAULT if legal mode is not found. * @param newMode new op mode to transition to * @return none *************************************************************************/ @@ -373,45 +338,39 @@ case DD_MODE_FAUL: currentSubMode = transitionToFaultMode(); break; + case DD_MODE_SERV: currentSubMode = transitionToServiceMode(); break; + case DD_MODE_INIT: currentSubMode = transitionToInitAndPOSTMode(); break; + case DD_MODE_STAN: currentSubMode = transitionToStandbyMode(); break; -// case DG_MODE_SOLO: -// currentSubMode = transitionToSoloMode(); -// break; -// case DG_MODE_GENE: + +// case DD_MODE_GENE: // currentSubMode = transitionToGenIdleMode(); // break; -// case DG_MODE_FILL: -// currentSubMode = transitionToFillMode(); -// break; -// case DG_MODE_DRAI: -// currentSubMode = transitionToDrainMode(); -// break; -// case DG_MODE_FLUS: + +// case DD_MODE_FLUS: // currentSubMode = transitionToFlushMode(); // break; + // case DD_MODE_HEAT: // currentSubMode = transitionToHeatDisinfectMode(); // break; -// case DG_MODE_CHEM: -// currentSubMode = transitionToChemicalDisinfectMode(); -// break; + // case DD_MODE_HCOL: // currentSubMode = transitionToHeatDisinfectActiveCoolMode(); // break; -// case DG_MODE_CHFL: -// currentSubMode = transitionToChemicalDisinfectFlushMode(); -// break; + // case DD_MODE_ROPS: // currentSubMode = transitionToROPermeateSampleMode(); // break; + default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_OP_MODES_INVALID_MODE_TO_TRANSITION_TO, (U32)newMode ) break; @@ -430,11 +389,13 @@ * the prescribed interval. * @details \b Inputs: broadcastModeIntervalCtr * @details \b Outputs: DD operation mode broadcast message sent + * @details \b Message \Sent: MSG_ID_DD_OP_MODE_DATA to publish the operation + * mode and sub mode details. * @return none *************************************************************************/ static void broadcastOperationMode( void ) { - if ( ++dataPublishCounter >= getDGOpModePublishInterval() ) + if ( ++dataPublishCounter >= getDDOpModePublishInterval() ) { OP_MODES_DATA_T data; @@ -449,19 +410,19 @@ /*********************************************************************//** * @brief - * The getDGOpModePublishInterval function gets the current DG operation mode + * The getDDOpModePublishInterval function gets the current DD operation mode * data publish interval. - * @details \b Inputs: dgOpModePublishInterval - * @details \b Outputs: DG operation mode broadcast message sent + * @details \b Inputs: ddOpModePublishInterval + * @details \b Outputs: DD operation mode broadcast message sent * @return none *************************************************************************/ -static U32 getDGOpModePublishInterval( void ) +static U32 getDDOpModePublishInterval( void ) { - U32 result = dgOpModePublishInterval.data; + U32 result = ddOpModePublishInterval.data; - if ( OVERRIDE_KEY == dgOpModePublishInterval.override ) + if ( OVERRIDE_KEY == ddOpModePublishInterval.override ) { - result = dgOpModePublishInterval.ovData; + result = ddOpModePublishInterval.ovData; } return result; @@ -482,10 +443,12 @@ /*********************************************************************//** * @brief - * The sendOperationStatusEvent function constructs and sends an DG operation + * The sendOperationStatusEvent function constructs and sends an DD operation * status event. * @details \b Inputs: currentMode, currentSubMode, currentSubState * @details \b Outputs: dat1, dat2. + * @details \b Message \b Sent: DD_EVENT_OPERATION_STATUS to update + * operation mode, sub mode and sub state details. * @return none *************************************************************************/ static void sendOperationStatusEvent() @@ -516,7 +479,7 @@ *************************************************************************/ void setTDOperationMode( U32 mode, U32 subMode ) { - // thread protection for queue operations + // thread protection for mode and sub mode updation together. _disable_IRQ(); tdModes.tdMode = (TD_OP_MODE_T)mode; tdModes.tdSubMode = subMode; @@ -539,6 +502,7 @@ mode->tdSubMode = tdModes.tdSubMode; } + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -574,14 +538,14 @@ /*********************************************************************//** * @brief - * The testSetDGOpModePublishIntervalOverride function overrides the - * DG operation mode publish interval. + * The testSetDDOpModePublishIntervalOverride function overrides the + * DD operation mode publish interval. * @details \b Inputs: none - * @details \b Outputs: dgOpModePublishInterval - * @param value override DG operation mode publish interval with (in ms) + * @details \b Outputs: ddOpModePublishInterval + * @param value override DD operation mode publish interval with (in ms) * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetDGOpModePublishIntervalOverride( U32 value ) +BOOL testSetDDOpModePublishIntervalOverride( U32 value ) { BOOL result = FALSE; @@ -590,30 +554,30 @@ U32 intvl = value / TASK_GENERAL_INTERVAL; result = TRUE; - dgOpModePublishInterval.ovData = intvl; - dgOpModePublishInterval.override = OVERRIDE_KEY; + ddOpModePublishInterval.ovData = intvl; + ddOpModePublishInterval.override = OVERRIDE_KEY; } return result; } /*********************************************************************//** * @brief - * The testResetDGOpModePublishIntervalOverride function resets the - * override of the DG operation mode publish interval. + * The testResetDDOpModePublishIntervalOverride function resets the + * override of the DD operation mode publish interval. * @details \b Inputs: none - * @details \b Outputs: dgOpModePublishInterval + * @details \b Outputs: ddOpModePublishInterval * @return TRUE if override reset successful, FALSE if not *************************************************************************/ -BOOL testResetDGOpModePublishIntervalOverride( void ) +BOOL testResetDDOpModePublishIntervalOverride( void ) { BOOL result = FALSE; if ( TRUE == isTestingActivated() ) { result = TRUE; - dgOpModePublishInterval.override = OVERRIDE_RESET; - dgOpModePublishInterval.ovData = dgOpModePublishInterval.ovInitData; + ddOpModePublishInterval.override = OVERRIDE_RESET; + ddOpModePublishInterval.ovData = ddOpModePublishInterval.ovInitData; } return result;