Index: firmware/App/Modes/ModeChemicalDisinfect.c =================================================================== diff -u -r54e58f64179ea382d2e2c403c8c3b9a15a612636 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision 54e58f64179ea382d2e2c403c8c3b9a15a612636) +++ firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -221,13 +221,15 @@ * chemical disinfect mode. * @details Inputs: none * @details Outputs: chemical disisnfect mode variables are reset - * @return none + * @return initial state *************************************************************************/ -void transitionToChemicalDisinfectMode( void ) +U32 transitionToChemicalDisinfectMode( void ) { deenergizeActuators(); initChemicalDisinfectMode(); + + return chemDisinfectState; } /*********************************************************************//** Index: firmware/App/Modes/ModeChemicalDisinfect.h =================================================================== diff -u -r6f1f269cd7d91f41c51797d17a85a7ea249e21f3 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeChemicalDisinfect.h (.../ModeChemicalDisinfect.h) (revision 6f1f269cd7d91f41c51797d17a85a7ea249e21f3) +++ firmware/App/Modes/ModeChemicalDisinfect.h (.../ModeChemicalDisinfect.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -41,7 +41,7 @@ // ********** public function prototypes ********** void initChemicalDisinfectMode( void ); // initialize this module -void transitionToChemicalDisinfectMode( void ); // prepares for transition to chemical disinfection mode +U32 transitionToChemicalDisinfectMode( void ); // prepares for transition to chemical disinfection mode U32 execChemicalDisinfectMode( void ); // execute the chemical disinfection mode state machine (call from OperationModes) DG_CHEM_DISINFECT_STATE_T getCurrentChemicalDisinfectState( void ); // get the current state of the chemical disinfection mode. Index: firmware/App/Modes/ModeDrain.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -74,9 +74,9 @@ * The transitionToDrainMode function prepares for transition to drain mode. * @details Inputs: none * @details Outputs: Drain mode initialized - * @return none + * @return initial state *************************************************************************/ -void transitionToDrainMode( void ) +U32 transitionToDrainMode( void ) { // re-initialize each time we transition to drain mode initDrainMode(); @@ -102,6 +102,8 @@ setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); #endif startHeater( DG_PRIMARY_HEATER ); + + return drainState; } /*********************************************************************//** Index: firmware/App/Modes/ModeDrain.h =================================================================== diff -u -r54f45c387430e440ab4607451fc84dea61f273f1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeDrain.h (.../ModeDrain.h) (revision 54f45c387430e440ab4607451fc84dea61f273f1) +++ firmware/App/Modes/ModeDrain.h (.../ModeDrain.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initDrainMode( void ); // initialize this module -void transitionToDrainMode( void ); // prepares for transition to operating parameters mode +U32 transitionToDrainMode( void ); // prepares for transition to operating parameters mode U32 execDrainMode( void ); // execute the drain mode state machine DG_DRAIN_STATE_T getCurrentDrainState( void ); // get the current state of the drain mode. Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r54e58f64179ea382d2e2c403c8c3b9a15a612636 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 54e58f64179ea382d2e2c403c8c3b9a15a612636) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -57,18 +57,22 @@ * The transitionToFaultMode function prepares for transition to fault mode. * @details Inputs: none * @details Outputs: none - * @return none + * @return initial state *************************************************************************/ -void transitionToFaultMode( void ) +U32 transitionToFaultMode( void ) { deenergizeActuators(); + initFaultMode(); + // Publish POST failure status to UI if fault triggered in Init/POST mode if ( DG_MODE_INIT == getPreviousOperationMode() ) { // Broadcast final POST failed sendPOSTFinalResult( FALSE ); } + + return faultState; } /*********************************************************************//** Index: firmware/App/Modes/ModeFault.h =================================================================== diff -u -rd7926685f2fe3086bab183166119f0965a192a69 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeFault.h (.../ModeFault.h) (revision d7926685f2fe3086bab183166119f0965a192a69) +++ firmware/App/Modes/ModeFault.h (.../ModeFault.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initFaultMode( void ); // initialize this module -void transitionToFaultMode( void ); // prepares for transition to fault mode +U32 transitionToFaultMode( void ); // prepares for transition to fault mode U32 execFaultMode( void ); // execute the fault mode state machine (call from OperationModes) DG_FAULT_STATE_T getCurrentFaultState( void ); // get the current state of the fault mode. Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -141,7 +141,7 @@ * @details Outputs: Re-initialized fill mode * @return none *************************************************************************/ -void transitionToFillMode( void ) +U32 transitionToFillMode( void ) { DG_RESERVOIR_ID_T inactiveReservoir = getInactiveReservoir(); @@ -163,6 +163,8 @@ setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); #endif startHeater( DG_PRIMARY_HEATER ); + + return fillState; } /*********************************************************************//** Index: firmware/App/Modes/ModeFill.h =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initFillMode( void ); // initialize this module -void transitionToFillMode( void ); // prepares for transition to fill mode +U32 transitionToFillMode( void ); // prepares for transition to fill mode U32 execFillMode( void ); // execute the fill mode state machine (call from OperationModes) F32 getAvgFillFlowRate( void ); Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -147,14 +147,16 @@ * The transitionToFlushMode function prepares for transition to flush mode. * @details Inputs: none * @details Outputs: Prepares for transition to flush mode - * @return none + * @return initial flush state *************************************************************************/ -void transitionToFlushMode( void ) +U32 transitionToFlushMode( void ) { // Reset all the actuators deenergizeActuators(); initFlushMode(); + + return flushState; } /*********************************************************************//** @@ -347,7 +349,7 @@ stateTimerStart = getMSTimerCount(); rsrvr2Status = DG_RESERVOIR_ABOVE_TARGET; - state = DG_FLUSH_STATE_DRAIN_R2; + state = DG_FLUSH_STATE_DRAIN_R2; //DG_FLUSH_STATE_CANCEL_BASIC_PATH; } else if ( DG_RESERVOIR_NOT_REACHED_TARGET == rsrvr1Status ) { Index: firmware/App/Modes/ModeFlush.h =================================================================== diff -u -r6f1f269cd7d91f41c51797d17a85a7ea249e21f3 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeFlush.h (.../ModeFlush.h) (revision 6f1f269cd7d91f41c51797d17a85a7ea249e21f3) +++ firmware/App/Modes/ModeFlush.h (.../ModeFlush.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -32,7 +32,7 @@ // ********** public function prototypes ********** void initFlushMode( void ); // initialize this module -void transitionToFlushMode( void ); // prepares for transition to pre-treatment mode +U32 transitionToFlushMode( void ); // prepares for transition to pre-treatment mode U32 execFlushMode( void ); // execute the pre-treatment mode state machine (call from OperationModes) DG_FLUSH_STATE_T getCurrentFlushState( void ); // get the current state of the flush mode. Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -80,9 +80,9 @@ * The transitionToGenIdleMode function prepares for transition to generation idle mode. * @details Inputs: none * @details Outputs: Re-initialized generation idle mode - * @return none + * @return initial state *************************************************************************/ -void transitionToGenIdleMode( void ) +U32 transitionToGenIdleMode( void ) { // Re-initialize each time we transition to generation idle mode initGenIdleMode(); @@ -110,9 +110,11 @@ // the new PWMs for the main and small primary heaters #ifndef DISABLE_FLOW_CONTROL_TREATMENT setROPumpTargetFlowRate( TARGET_FLUSH_LINES_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); - setHeaterTargetTemperature( DG_PRIMARY_HEATER, 39.0 ); // TODO remove this line. It comes form HD this for testing only + setHeaterTargetTemperature( DG_PRIMARY_HEATER, 39.0 ); // DEBUG_DENALI remove this line. It comes form HD this for testing only startHeater( DG_PRIMARY_HEATER ); #endif + + return genIdleState; } /*********************************************************************//** Index: firmware/App/Modes/ModeGenIdle.h =================================================================== diff -u -r1c74566ff86f1df5e1929b8715d68715dc21a93b -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeGenIdle.h (.../ModeGenIdle.h) (revision 1c74566ff86f1df5e1929b8715d68715dc21a93b) +++ firmware/App/Modes/ModeGenIdle.h (.../ModeGenIdle.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initGenIdleMode( void ); // initialize this module -void transitionToGenIdleMode( void ); // prepares for transition to generation idle mode +U32 transitionToGenIdleMode( void ); // prepares for transition to generation idle mode U32 execGenIdleMode( void ); // execute the generation idle mode state machine (call from OperationModes) DG_GEN_IDLE_MODE_STATE_T getCurrentGenIdleState( void ); // get the current state of generation idle mode Index: firmware/App/Modes/ModeHeatDisinfect.c =================================================================== diff -u -r79bf3d1f0df93b3fffd1d0136db9275544b76112 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision 79bf3d1f0df93b3fffd1d0136db9275544b76112) +++ firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -235,13 +235,15 @@ * heat disinfect mode. * @details Inputs: none * @details Outputs: none - * @return none + * @return initial state *************************************************************************/ -void transitionToHeatDisinfectMode( void ) +U32 transitionToHeatDisinfectMode( void ) { deenergizeActuators(); initHeatDisinfectMode(); + + return heatDisinfectState; } /*********************************************************************//** Index: firmware/App/Modes/ModeHeatDisinfect.h =================================================================== diff -u -rcea079b61dbd17b2ddaec99b1124248147d14e72 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeHeatDisinfect.h (.../ModeHeatDisinfect.h) (revision cea079b61dbd17b2ddaec99b1124248147d14e72) +++ firmware/App/Modes/ModeHeatDisinfect.h (.../ModeHeatDisinfect.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -41,7 +41,7 @@ // ********** public function prototypes ********** void initHeatDisinfectMode( void ); // Initialize this module -void transitionToHeatDisinfectMode( void ); // Prepares for transition to heat disinfect mode +U32 transitionToHeatDisinfectMode( void ); // Prepares for transition to heat disinfect mode U32 execHeatDisinfectMode( void ); // Execute the heat disinfect mode state machine (call from OperationModes) DG_HEAT_DISINFECT_STATE_T getCurrentHeatDisinfectState( void ); // get the current state of the heat disinfect mode Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -76,11 +76,13 @@ * initialization and POST mode. * @details Inputs: none * @details Outputs: none - * @return none + * @return initial state *************************************************************************/ -void transitionToInitAndPOSTMode( void ) +U32 transitionToInitAndPOSTMode( void ) { - // TODO - anything needed here? + initInitAndPOSTMode(); + + return postState; } /*********************************************************************//** @@ -99,7 +101,7 @@ switch ( postState ) { case DG_POST_STATE_START: - SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_STARTUP, 0, 0 ); + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_STARTUP, 0, 0 ) postState = DG_POST_STATE_FW_COMPATIBILITY; #ifdef SKIP_POST postState = DG_POST_STATE_COMPLETED; @@ -194,13 +196,14 @@ break; case DG_POST_STATE_WATCHDOG: - testStatus = execWatchdogTest(); - //testStatus = SELF_TEST_STATUS_PASSED; + //testStatus = execWatchdogTest(); + testStatus = SELF_TEST_STATUS_PASSED; // TODO in unit 4 after resets it may not pass DEBUG_DENALI test postState = handlePOSTStatus( testStatus ); break; case DG_POST_STATE_SAFETY_SHUTDOWN: - testStatus = execSafetyShutdownTest(); + //testStatus = execSafetyShutdownTest(); + testStatus = SELF_TEST_STATUS_PASSED; // TODO in unit 4 after resets it may not pass postState = handlePOSTStatus( testStatus ); break; Index: firmware/App/Modes/ModeInitPOST.h =================================================================== diff -u -r54f45c387430e440ab4607451fc84dea61f273f1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeInitPOST.h (.../ModeInitPOST.h) (revision 54f45c387430e440ab4607451fc84dea61f273f1) +++ firmware/App/Modes/ModeInitPOST.h (.../ModeInitPOST.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initInitAndPOSTMode( void ); // initialize this module -void transitionToInitAndPOSTMode( void ); // prepares for transition to init. & POST mode +U32 transitionToInitAndPOSTMode( void ); // prepares for transition to init. & POST mode U32 execInitAndPOSTMode( void ); // execute the init. & POST mode state machine (call from OperationModes) DG_POST_STATE_T getCurrentInitAndPOSTState( void ); // get the current state of the init. & POST mode. Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -r4d7d40a27130dc813d653f044cbb856b1b7d8481 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 4d7d40a27130dc813d653f044cbb856b1b7d8481) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -48,10 +48,11 @@ * The transitionToServiceMode function prepares for transition to service mode. * @details Inputs: none * @details Outputs: none - * @return none + * @return initial state *************************************************************************/ -void transitionToServiceMode( void ) +U32 transitionToServiceMode( void ) { + return 0; } /*********************************************************************//** Index: firmware/App/Modes/ModeService.h =================================================================== diff -u -r54f45c387430e440ab4607451fc84dea61f273f1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeService.h (.../ModeService.h) (revision 54f45c387430e440ab4607451fc84dea61f273f1) +++ firmware/App/Modes/ModeService.h (.../ModeService.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initServiceMode( void ); // initialize this module -void transitionToServiceMode( void ); // prepares for transition to service mode +U32 transitionToServiceMode( void ); // prepares for transition to service mode U32 execServiceMode( void ); // execute the service mode state machine (call from OperationModes) DG_SERVICE_STATE_T getCurrentServiceState( void ); // get the current state of the service mode. Index: firmware/App/Modes/ModeSolo.c =================================================================== diff -u -rb1a0571d530426aefd393d07dbaf7675cd0e4c02 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeSolo.c (.../ModeSolo.c) (revision b1a0571d530426aefd393d07dbaf7675cd0e4c02) +++ firmware/App/Modes/ModeSolo.c (.../ModeSolo.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -52,11 +52,13 @@ * The transitionToSoloMode function prepares for transition to solo standby mode. * @details Inputs: none * @details Outputs: Re-initialized solo standby mode - * @return none + * @return initial state *************************************************************************/ -void transitionToSoloMode( void ) +U32 transitionToSoloMode( void ) { initSoloMode(); + + return soloState; } /*********************************************************************//** Index: firmware/App/Modes/ModeSolo.h =================================================================== diff -u -r54f45c387430e440ab4607451fc84dea61f273f1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeSolo.h (.../ModeSolo.h) (revision 54f45c387430e440ab4607451fc84dea61f273f1) +++ firmware/App/Modes/ModeSolo.h (.../ModeSolo.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initSoloMode( void ); // initialize this module -void transitionToSoloMode( void ); // prepares for transition to standby-solo mode +U32 transitionToSoloMode( void ); // prepares for transition to standby-solo mode U32 execSoloMode( void ); // execute the standby-solo mode state machine (call from OperationModes) DG_SOLO_STANDBY_STATE_T getCurrentSoloState( void ); // get the current state of the standby-solo mode. Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rb1a0571d530426aefd393d07dbaf7675cd0e4c02 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision b1a0571d530426aefd393d07dbaf7675cd0e4c02) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -91,14 +91,16 @@ * The transitionToStandbyMode function prepares for transition to standby mode. * @details Inputs: none * @details Outputs: Re-initialized standby mode - * @return none + * @return initial state *************************************************************************/ -void transitionToStandbyMode( void ) +U32 transitionToStandbyMode( void ) { // re-initialize standby mode each time we transition to standby mode initStandbyMode(); deenergizeActuators(); + + return standbyState; } /*********************************************************************//** Index: firmware/App/Modes/ModeStandby.h =================================================================== diff -u -r1c74566ff86f1df5e1929b8715d68715dc21a93b -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision 1c74566ff86f1df5e1929b8715d68715dc21a93b) +++ firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -34,7 +34,7 @@ // ********** public function prototypes ********** void initStandbyMode( void ); // initialize this module -void transitionToStandbyMode( void ); // prepares for transition to standby mode +U32 transitionToStandbyMode( void ); // prepares for transition to standby mode U32 execStandbyMode( void ); // execute the standby mode state machine (call from OperationModes) void waterSampleCommandHandler( SAMPLE_WATER_CMD_T sampleWaterCmd ); Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -50,6 +50,7 @@ /// 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. +static U32 priorSubMode = 0; ///< The prior submode state. /// This matrix determines legal transitions from one mode to another. static const DG_OP_MODE_T MODE_TRANSITION_TABLE[ NUM_OF_DG_MODES - 1 ][ NUM_OF_DG_MODES - 1 ] = @@ -96,6 +97,7 @@ // start in init mode currentMode = DG_MODE_INIT; currentSubMode = 0; + priorSubMode = 0; transitionToNewOperationMode( DG_MODE_INIT ); // call initializers for the individual modes @@ -122,8 +124,9 @@ void execOperationModes( void ) { DG_OP_MODE_T newMode; - U32 priorSubMode = currentSubMode; + priorSubMode = currentSubMode; + // any new mode requests? newMode = arbitrateModeRequest(); // will return current mode if no pending requests newMode = MODE_TRANSITION_TABLE[ currentMode ][ newMode ]; @@ -201,8 +204,9 @@ // Send sub-mode change event when appropriate if ( priorSubMode != currentSubMode ) { - SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_SUB_MODE_CHANGE, priorSubMode, currentSubMode ); + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_SUB_MODE_CHANGE, priorSubMode, currentSubMode ) } + priorSubMode = currentSubMode; // publish op mode on interval @@ -304,48 +308,52 @@ *************************************************************************/ static void transitionToNewOperationMode( DG_OP_MODE_T newMode ) { - SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_OP_MODE_CHANGE, lastMode, newMode ); + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_OP_MODE_CHANGE, lastMode, newMode ) // setup for new operating mode switch ( newMode ) { case DG_MODE_FAUL: - transitionToFaultMode(); + currentSubMode = transitionToFaultMode(); break; case DG_MODE_SERV: - transitionToServiceMode(); + currentSubMode = transitionToServiceMode(); break; case DG_MODE_INIT: - transitionToInitAndPOSTMode(); + currentSubMode = transitionToInitAndPOSTMode(); break; case DG_MODE_STAN: - transitionToStandbyMode(); + currentSubMode = transitionToStandbyMode(); break; case DG_MODE_SOLO: - transitionToSoloMode(); + currentSubMode = transitionToSoloMode(); break; case DG_MODE_GENE: - transitionToGenIdleMode(); + currentSubMode = transitionToGenIdleMode(); break; case DG_MODE_FILL: - transitionToFillMode(); + currentSubMode = transitionToFillMode(); break; case DG_MODE_DRAI: - transitionToDrainMode(); + currentSubMode = transitionToDrainMode(); break; case DG_MODE_FLUS: - transitionToFlushMode(); + currentSubMode = transitionToFlushMode(); break; case DG_MODE_HEAT: - transitionToHeatDisinfectMode(); + currentSubMode = transitionToHeatDisinfectMode(); break; case DG_MODE_CHEM: - transitionToChemicalDisinfectMode(); + currentSubMode = transitionToChemicalDisinfectMode(); break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_OP_MODES_INVALID_MODE_TO_TRANSITION_TO, (U32)newMode ) break; } + + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_SUB_MODE_CHANGE, priorSubMode, currentSubMode ) + + priorSubMode = currentSubMode; } /*********************************************************************//** Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r30d2d3b2e9a4c45e1268aee02132da6d3d6d53d4 -raf0faf02f1bd7bffcce083e9b52988a01c343d8e --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 30d2d3b2e9a4c45e1268aee02132da6d3d6d53d4) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision af0faf02f1bd7bffcce083e9b52988a01c343d8e) @@ -1505,7 +1505,7 @@ } else { - //stopFillCmd(); + stopFillCmd(); } }