Index: firmware/App/Controllers/BoostPump.c =================================================================== diff -u -r311c75cc5ac41b4b9ca4983df84e43af910f9be4 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Controllers/BoostPump.c (.../BoostPump.c) (revision 311c75cc5ac41b4b9ca4983df84e43af910f9be4) +++ firmware/App/Controllers/BoostPump.c (.../BoostPump.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -17,13 +17,14 @@ //#include + #include "BoostPump.h" #include "Flow.h" #include "FluidPump.h" +#include "FPOperationModes.h" //#include "NVDataMgmt.h" #include "Messaging.h" #include "MessageSupport.h" -#include "OperationModes.h" #include "PersistentAlarm.h" #include "PIControllers.h" #include "Pressure.h" Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r81aa682aa24931c7f44aea82ec72fb3dfabc7890 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 81aa682aa24931c7f44aea82ec72fb3dfabc7890) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -18,12 +18,12 @@ #include // Used for mathematical operations #include "FpgaFP.h" +#include "FPOperationModes.h" #include "Heaters.h" #include "Level.h" #include "MessageSupport.h" #include "Messaging.h" //#include "NVDataMgmt.h" -#include "OperationModes.h" #include "PersistentAlarm.h" #include "PIControllers.h" #include "SafetyShutdown.h" Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r311c75cc5ac41b4b9ca4983df84e43af910f9be4 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 311c75cc5ac41b4b9ca4983df84e43af910f9be4) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -17,11 +17,12 @@ //#include + #include "Flow.h" +#include "FPOperationModes.h" //#include "NVDataMgmt.h" #include "Messaging.h" #include "MessageSupport.h" -#include "OperationModes.h" #include "PersistentAlarm.h" #include "PIControllers.h" #include "Pressure.h" Index: firmware/App/Drivers/ConductivitySensor.c =================================================================== diff -u -r410afd26b3ae5e372310c696c82f58c59235e10d -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Drivers/ConductivitySensor.c (.../ConductivitySensor.c) (revision 410afd26b3ae5e372310c696c82f58c59235e10d) +++ firmware/App/Drivers/ConductivitySensor.c (.../ConductivitySensor.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,14 +15,14 @@ * ***************************************************************************/ +#include #include // Used for calculating the polynomial calibration equation. #include // For memcpy #include "ConductivitySensor.h" #include "FpgaFP.h" #include "MessageSupport.h" #include "Messaging.h" -#include "OperationModes.h" #include "PersistentAlarm.h" #include "Utilities.h" Index: firmware/App/Drivers/PressureSensor.c =================================================================== diff -u -r311c75cc5ac41b4b9ca4983df84e43af910f9be4 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision 311c75cc5ac41b4b9ca4983df84e43af910f9be4) +++ firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -33,10 +33,9 @@ #define COUNTS_TO_MILLI_BAR 100 ///< Counts to milli-bar conversion. #define BAR_TO_MMHG ( 750.062F ) ///< Conversion factor for converting bar to mmHg. #define PRES_SENSORS_READ_ERR_MAX_CNT 0xFF ///< Pressure sensor read and error max count value +#define PRES_MIN_PSI -14.5038F ///< Minimum value for PSI conversion +#define HIGH_PRES_MAX_PSI 145.038F ///< Maximum range of pressure sensors (in PSI) -#define PRES_MIN_PSI 0.0F ///< Minimum range of pressure sensors (in PSI) -#define PRES_MAX_PSI 145.038F ///< Maximum range of pressure sensors (in PSI) - // ********** private data ********** static OVERRIDE_F32_T currentPressureReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< Current pressure sensor pressure readings (overrideable). @@ -98,15 +97,15 @@ void readPressureSensors( void ) { // Update and convert raw pressures to mmHg - currentPressureReadings[ M1_PRES ].data = convertPressureReading( getFPGAM1RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ M3_PRES ].data = convertPressureReading( getFPGAM3RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ P8_PRES ].data = convertPressureReading( getFPGAP8RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ P13_PRES ].data = convertPressureReading( getFPGAP13RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ P17_PRES ].data = convertPressureReading( getFPGAP17RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ X1_PRES ].data = convertPressureReading( getFPGAX1RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ X2_PRES ].data = convertPressureReading( getFPGAX2RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ X3_PRES ].data = convertPressureReading( getFPGAX3RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); - currentPressureReadings[ X4_PRES ].data = convertPressureReading( getFPGAX4RawPressure(), PRES_MIN_PSI, PRES_MAX_PSI ); + currentPressureReadings[ M1_PRES ].data = convertPressureReading( getFPGAM1RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ M3_PRES ].data = convertPressureReading( getFPGAM3RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ P8_PRES ].data = convertPressureReading( getFPGAP8RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ P13_PRES ].data = convertPressureReading( getFPGAP13RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ P17_PRES ].data = convertPressureReading( getFPGAP17RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ X1_PRES ].data = convertPressureReading( getFPGAX1RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ X2_PRES ].data = convertPressureReading( getFPGAX2RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ X3_PRES ].data = convertPressureReading( getFPGAX3RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ X4_PRES ].data = convertPressureReading( getFPGAX4RawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); // Update and convert raw pressure sensor temperatures to deg C currentPresTempReadings[ M1_PRES ].data = convertPressureTempReading2DegC( getFPGAM1RawTemperature() ); Index: firmware/App/Drivers/TemperatureSensor.c =================================================================== diff -u -r81aa682aa24931c7f44aea82ec72fb3dfabc7890 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Drivers/TemperatureSensor.c (.../TemperatureSensor.c) (revision 81aa682aa24931c7f44aea82ec72fb3dfabc7890) +++ firmware/App/Drivers/TemperatureSensor.c (.../TemperatureSensor.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,6 +15,7 @@ * ***************************************************************************/ +#include #include // For temperature calculation #include // For memset() @@ -23,7 +24,6 @@ #include "MessageSupport.h" #include "Messaging.h" //#include "NVDataMgmt.h" -#include "OperationModes.h" #include "PersistentAlarm.h" #include "Temperature.h" #include "Timers.h" Index: firmware/App/Modes/FPModeFault.c =================================================================== diff -u --- firmware/App/Modes/FPModeFault.c (revision 0) +++ firmware/App/Modes/FPModeFault.c (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,88 @@ +/************************************************************************** +* +* 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 FPModeFault.c +* +* @author (last) Michael Garthwaite +* @date (last) 28-Feb-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 28-Feb-2025 +* +***************************************************************************/ + +#include "FPModeStandby.h" +#include "FPOperationModes.h" +#include "BoostPump.h" +#include "ModePreGenPermeateDefeatured.h" +#include "ModePreGenPermeate.h" +#include "PersistentAlarm.h" +#include "ROPump.h" +#include "SystemCommFP.h" +#include "TaskGeneral.h" +#include "Valves.h" + +/** + * @addtogroup FPFaultMode + * @{ + */ + +// ********** private data ********** + +/*********************************************************************//** + * @brief + * The initFaultMode function initializes the fault mode unit. + * @details \b Inputs: none + * @details \b Outputs:unit variables initialized. + * @return none + *************************************************************************/ +void initFaultMode( void ) +{ + +} + +/*********************************************************************//** + * @brief + * The transitionToFaultMode function prepares for transition to fault mode. + * while transition, deenergize all actuators. + * @details \b Inputs: none + * @details \b Outputs: Re-initialized Init and POST mode + * @return initial state + *************************************************************************/ +U32 transitionToFaultMode( void ) +{ + setValveState( M4_VALV,VALVE_STATE_CLOSED ); + setValveState( P6_VALV,VALVE_STATE_CLOSED ); + setValveState( P11_VALV,VALVE_STATE_CLOSED ); + setValveState( P33_VALV, VALVE_STATE_CLOSED ); + setValveState( P34_VALV,VALVE_STATE_CLOSED ); + setValveState( P37_VALV, VALVE_STATE_CLOSED ); + setValveState( P39_VALV,VALVE_STATE_CLOSED ); + + if (TRUE == isBoostPumpInstalled()) + { + signalBoostPumpHardStop(); + } + + signalROPumpHardStop(); + return 0; +} + +/*********************************************************************//** + * @brief + * The execFaultMode function executes the fault mode state machine. + * @details \b Inputs: none + * @details \b Outputs: Fault mode state machine executed + * @return current state + *************************************************************************/ +U32 execFaultMode( void ) +{ + return 0; +} + +/**@}*/ + Index: firmware/App/Modes/FPModeFault.h =================================================================== diff -u --- firmware/App/Modes/FPModeFault.h (revision 0) +++ firmware/App/Modes/FPModeFault.h (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,40 @@ +/************************************************************************** +* +* 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 FPModeFault.c +* +* @author (last) Michael Garthwaite +* @date (last) 28-Feb-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 28-Feb-2025 +* +***************************************************************************/ + +#ifndef __MODE_FAULT_H__ +#define __MODE_FAULT_H__ + +#include "FPCommon.h" +#include "FPDefs.h" + +/** + * @defgroup FPFaultMode FPFaultMode + * @brief FaultMode unit. + * + * @addtogroup FPFaultMode + * @{ + */ + +// ********** public function prototypes ********** + +void initFaultMode( void ); // Initialize this unit +U32 transitionToFaultMode( void ); // Prepares for transition to fault mode +U32 execFaultMode( void ); // Execute the fault mode state machine (call from OperationModes) + +/**@}*/ + +#endif Index: firmware/App/Modes/FPModeInitPOST.c =================================================================== diff -u --- firmware/App/Modes/FPModeInitPOST.c (revision 0) +++ firmware/App/Modes/FPModeInitPOST.c (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,66 @@ +/************************************************************************** +* +* 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 FPModeInitPOST.c +* +* @author (last) Michael Garthwaite +* @date (last) 28-Feb-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 28-Feb-2025 +* +***************************************************************************/ + +#include "FPModeInitPOST.h" +#include "FPOperationModes.h" + +/** + * @addtogroup FPInitAndPOSTMode + * @{ + */ + +// ********** private definitions ********** + +/*********************************************************************//** + * @brief + * The initInitAndPOSTMode function initializes the Init and POST mode unit. + * @details \b Inputs: none + * @details \b Outputs:unit variables initialized. + * @return none + *************************************************************************/ +void initInitAndPOSTMode( void ) +{ + +} + +/*********************************************************************//** + * @brief + * The transitionToInitAndPOSTMode function prepares for transition to init and POST mode. + * while transition, deenergize all actuators. + * @details \b Inputs: none + * @details \b Outputs: Re-initialized Init and POST mode + * @return initial state + *************************************************************************/ +U32 transitionToInitAndPOSTMode( void ) +{ + return 0; +} + + +/*********************************************************************//** + * @brief + * The execInitAndPOSTMode function executes the standby mode state machine. + * @details \b Inputs: none + * @details \b Outputs: Init and POST mode state machine executed + * @return current state + *************************************************************************/ +U32 execInitAndPOSTMode( void ) +{ + requestNewOperationMode( FP_MODE_STAN ); + + return 0; +} Index: firmware/App/Modes/FPModeInitPOST.h =================================================================== diff -u --- firmware/App/Modes/FPModeInitPOST.h (revision 0) +++ firmware/App/Modes/FPModeInitPOST.h (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,44 @@ +/************************************************************************** +* +* 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 FPModeInitPOST.h +* +* @author (last) Michael Garthwaite +* @date (last) 28-Feb-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 28-Feb-2025 +* +***************************************************************************/ + +#ifndef __MODE_INIT_POST_H__ +#define __MODE_INIT_POST_H__ + +#include "FPCommon.h" +#include "FPDefs.h" + +/** + * @defgroup FPInitAndPOSTMode FPInitAndPOSTMode + * @brief Initialization and POST mode unit. Manages initialization and POST + * mode functions via a state machine. + * + * @addtogroup FPInitAndPOSTMode + * @{ + */ + +// ********** public function prototypes ********** + +void initInitAndPOSTMode( void ); // Initialize this unit +U32 transitionToInitAndPOSTMode( void ); // Prepares for transition to init. & POST mode +U32 execInitAndPOSTMode( void ); // Execute the init. & POST mode state machine (call from OperationModes) + +BOOL isPOSTCompleted( void ); // Determine whether POST has completed yet +BOOL isPOSTPassed( void ); // Determine whether POST has passed + +/**@}*/ + +#endif Index: firmware/App/Modes/FPModeStandby.c =================================================================== diff -u --- firmware/App/Modes/FPModeStandby.c (revision 0) +++ firmware/App/Modes/FPModeStandby.c (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,149 @@ +/************************************************************************** +* +* 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 FPModeStandby.c +* +* @author (last) Michael Garthwaite +* @date (last) 28-Feb-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 28-Feb-2025 +* +***************************************************************************/ + + +#include "BoostPump.h" +#include "FPModeStandby.h" +#include "FPOperationModes.h" +#include "ModePreGenPermeateDefeatured.h" +#include "ModePreGenPermeate.h" +#include "PersistentAlarm.h" +#include "ROPump.h" +#include "SystemCommFP.h" +#include "TaskGeneral.h" +#include "Valves.h" + +/** + * @addtogroup FPStandbyMode + * @{ + */ + +// ********** private definitions ********** + +// ********** private data ********** + +static FP_STANDBY_MODE_STATE_T standbyState; ///< Currently active standby state. + +// ********** private function prototypes ********** + +static FP_STANDBY_MODE_STATE_T handleStandbyIdleState( void ); + +/*********************************************************************//** + * @brief + * The initStandbyMode function initializes the standby mode unit. + * @details \b Inputs: none + * @details \b Outputs:unit variables initialized. + * @return none + *************************************************************************/ +void initStandbyMode( void ) +{ + standbyState = FP_STANDBY_MODE_STATE_IDLE; +} + +/*********************************************************************//** + * @brief + * The transitionToStandbyMode function prepares for transition to standby mode. + * while transition, deenergize all actuators. + * @details \b Inputs: none + * @details \b Outputs: Re-initialized standby mode + * @return initial state + *************************************************************************/ +U32 transitionToStandbyMode( void ) +{ + initStandbyMode(); + + setValveState( M4_VALV,VALVE_STATE_CLOSED ); + setValveState( M7_VALV, VALVE_STATE_CLOSED ); + setValveState( P6_VALV,VALVE_STATE_CLOSED ); + setValveState( P11_VALV,VALVE_STATE_CLOSED ); + setValveState( P33_VALV, VALVE_STATE_CLOSED ); + setValveState( P34_VALV,VALVE_STATE_CLOSED ); + setValveState( P37_VALV, VALVE_STATE_CLOSED ); + setValveState( P39_VALV,VALVE_STATE_CLOSED ); + setValveState( P20_VALV, VALVE_STATE_CLOSED ); + setValveState( P43_VALV, VALVE_STATE_CLOSED ); + + signalROPumpHardStop(); + + if ( TRUE == isBoostPumpInstalled() ) + { + signalBoostPumpHardStop(); + } + + return standbyState; +} + +/*********************************************************************//** + * @brief + * The execStandbyMode function executes the standby mode state machine. + * @details \b Inputs: none + * @details \b Outputs: Standby mode state machine executed + * @details \b Alarm: ALARM_ID_FP_SOFTWARE_FAULT if standbyState is invalid. + * @return current state + *************************************************************************/ +U32 execStandbyMode( void ) +{ + // execute current Standby state + switch ( standbyState ) + { + case FP_STANDBY_MODE_STATE_IDLE: + standbyState = handleStandbyIdleState(); + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_FP_SOFTWARE_FAULT, SW_FAULT_ID_MODE_STANDBY_INVALID_STATE, standbyState ) + standbyState = FP_STANDBY_MODE_STATE_IDLE; + break; + } + + return standbyState; +} + +/*********************************************************************//** + * @brief + * The handleStandbyIdleState function executes the idle state of the + * standby mode state machine. + * @details \b Inputs: + * @details \b Outputs: + * @details \b Message \Sent: + * @return the next state + *************************************************************************/ +static FP_STANDBY_MODE_STATE_T handleStandbyIdleState( void ) +{ + FP_STANDBY_MODE_STATE_T state = FP_STANDBY_MODE_STATE_IDLE; + + return state; +} + +/*********************************************************************//** + * @brief + * The getCurrentStandbyState function returns the current state of standby mode. + * @details \b Inputs: standbyState + * @details \b Outputs: none + * @return the current state of standby mode. + *************************************************************************/ +FP_STANDBY_MODE_STATE_T getCurrentStandbyState( void ) +{ + return standbyState; +} + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/**@}*/ Index: firmware/App/Modes/FPModeStandby.h =================================================================== diff -u --- firmware/App/Modes/FPModeStandby.h (revision 0) +++ firmware/App/Modes/FPModeStandby.h (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,47 @@ +/************************************************************************** +* +* 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 FPModeStandby.h +* +* @author (last) Michael Garthwaite +* @date (last) 28-Feb-2025 +* +* @author (original) Michael Garthwaite +* @date (original) 28-Feb-2025 +* +***************************************************************************/ + +#ifndef __MODE_STANDBY_H__ +#define __MODE_STANDBY_H__ + +#include "FPCommon.h" +#include "FPDefs.h" + +/** + * @defgroup FPStandbyMode FPStandbyMode + * @brief Standby mode unit. Manages the Standby mode functions via a state + * machine. + * + * @addtogroup FPStandbyMode + * @{ + */ + +// ********** public definitions ********** + +// ********** public function prototypes ********** + +void initStandbyMode( void ); // Initialize this unit +U32 transitionToStandbyMode( void ); // Prepares for transition to standby mode +U32 execStandbyMode( void ); // Execute the standby mode state machine (call from OperationModes) + +FP_STANDBY_MODE_STATE_T getCurrentStandbyState( void ); // get the current state of the standby mode. + +BOOL testFPstartGenPermeateOverride( MESSAGE_T *message ); // Overide start gen permeate mode + +/**@}*/ + +#endif Index: firmware/App/Modes/FPOperationModes.c =================================================================== diff -u --- firmware/App/Modes/FPOperationModes.c (revision 0) +++ firmware/App/Modes/FPOperationModes.c (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,475 @@ +/************************************************************************** +* +* 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 FPOperationModes.c +* +* @author (last) Sean +* @date (last) 15-Nov-2024 +* +* @author (original) Sean +* @date (original) 15-Nov-2024 +* +***************************************************************************/ + +#include "FPModeFault.h" +#include "FPModeInitPOST.h" +#include "FPModeStandby.h" +#include "FPOperationModes.h" +#include "Messaging.h" +#include "ModeGenPermeateDefeatured.h" +#include "ModePreGenPermeateDefeatured.h" +#include "ModeGenPermeate.h" +#include "ModePreGenPermeate.h" +#include "TaskGeneral.h" + +/** + * @addtogroup FPOperationModes + * @{ + */ + +// ********** private definitions ********** + +#define BROADCAST_TD_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< FP operation mode broadcast interval (in task interval/sec). +#define DATA_PUBLISH_COUNTER_START_COUNT 11 ///< Data publish counter start count. + +// ********** private data ********** + +static volatile BOOL modeRequest[ NUM_OF_FP_MODES - 1 ]; ///< Pending operation mode change requests. +static FP_OP_MODE_T lastMode; ///< Last operation mode prior to current mode. +static FP_OP_MODE_T currentMode; ///< Current operation mode. +static U32 currentSubMode; ///< The currently active state of the active mode. +static U32 broadcastModeIntervalCtr; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. +static U32 currentSubState; ///< current sub state. +static U32 current4thLevelState; ///< current 4th level state. +static BOOL isDeviceDefeatured; ///< bool to determine defeatured status +static BOOL isBoostInstalled; ///< bool to determine boost pump status + +/// Interval (in task intervals) at which to publish operation mode data to CAN bus. +static OVERRIDE_U32_T opModePublishInterval = { BROADCAST_TD_OP_MODE_INTERVAL, BROADCAST_TD_OP_MODE_INTERVAL, BROADCAST_TD_OP_MODE_INTERVAL, 0 }; + +/// This matrix determines legal transitions from one mode to another +static const FP_OP_MODE_T MODE_TRANSITION_TABLE[ NUM_OF_FP_MODES - 1 ][ NUM_OF_FP_MODES - 1 ] = { +// From to-> FAULT SERVICE INIT STANBY PGEN GENW DPGW DEGW +/* FAUL */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, +/* SERV */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, +/* INIT */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_INIT, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, +/* STAN */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_PGEN, FP_MODE_GENP, FP_MODE_DPGW, FP_MODE_DEGW }, +/* PGEN */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_PGEN, FP_MODE_GENP, FP_MODE_NLEG, FP_MODE_NLEG }, +/* GENW */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_GENP, FP_MODE_NLEG, FP_MODE_NLEG }, +/* DPGW */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_DPGW, FP_MODE_DEGW }, +/* DEGW */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_DEGW } }; + +// ********** private function prototypes ********** + +static FP_OP_MODE_T arbitrateModeRequest( void ); +static void transitionToNewOperationMode( FP_OP_MODE_T newMode ); +static void broadcastOperationMode( void ); + +/*********************************************************************//** + * @brief + * The initOperationModes function initializes the Operation Modes unit. + * @details \b Inputs: none + * @details \b Outputs: Operation Modes unit initialized. + * @return none + *************************************************************************/ +void initOperationModes( void ) +{ + U32 i; + + // Initialize mode requests to none pending + for ( i = 0; i < ( NUM_OF_FP_MODES - 1 ); i++ ) + { + modeRequest[ i ] = FALSE; + } + + // Start in init mode + lastMode = FP_MODE_INIT; + currentMode = FP_MODE_INIT; + currentSubMode = 0; + currentSubState = NO_SUB_STATE; + current4thLevelState = NO_SUB_STATE; + broadcastModeIntervalCtr = DATA_PUBLISH_COUNTER_START_COUNT; + isDeviceDefeatured = FALSE; + isBoostInstalled = FALSE; + + transitionToNewOperationMode( FP_MODE_INIT ); + + // Call initializers for the individual modes + initFaultMode(); +// initServiceMode(); + initInitAndPOSTMode(); + initStandbyMode(); + initPreGenPMode(); + initGenPermeateMode(); +} + +/*********************************************************************//** + * @brief + * The execOperationModes function executes the Operation Modes state machine. + * @details \b Alarm: ALARM_ID_FP_SOFTWARE_FAULT if current mode is invalid. + * @details \b Inputs: none + * @details \b Outputs: currentMode is set by state machine. + * @return none + *************************************************************************/ +void execOperationModes( void ) +{ + FP_OP_MODE_T newMode; + U32 priorSubMode = currentSubMode; + U32 priorSubState = currentSubState; + U32 prior4thLevelState = current4thLevelState; + + // Any new mode requests? + newMode = arbitrateModeRequest(); // Will return current mode if no pending requests + newMode = MODE_TRANSITION_TABLE[ currentMode ][ newMode ]; + + // Is requested new mode valid and legal at this time? + if ( ( newMode >= FP_MODE_NLEG ) && ( isTestingActivated() != TRUE ) ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_OP_MODES_ILLEGAL_MODE_TRANSITION_REQUESTED, newMode ) + newMode = currentMode; + } + + // Has mode changed? + if ( currentMode != newMode ) + { + lastMode = currentMode; + // Handle transition to new mode + transitionToNewOperationMode( newMode ); + currentMode = newMode; +// sendOperationStatusEvent(); + } + + // Mode specific processing to be done continuously + switch ( currentMode ) + { + case FP_MODE_FAUL: + currentSubMode = execFaultMode(); + break; + + case FP_MODE_SERV: +// currentSubMode = execServiceMode(); + break; + + case FP_MODE_INIT: + currentSubMode = execInitAndPOSTMode(); + break; + + case FP_MODE_STAN: + currentSubMode = execStandbyMode(); + break; + + case FP_MODE_PGEN: + currentSubMode = execPreGenPMode(); + break; + + case FP_MODE_GENP: + currentSubMode = execGenPermeateMode(); + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_FP_SOFTWARE_FAULT, SW_FAULT_ID_OP_MODES_INVALID_MODE_STATE, currentMode ) + currentMode = FP_MODE_FAUL; + currentSubMode = 0; + break; + } // End switch + +#ifndef _VECTORCAST_ + // Send operation status event when appropriate + if ( ( priorSubMode != currentSubMode ) || ( priorSubState != currentSubState ) || ( prior4thLevelState != current4thLevelState ) ) +#endif + { +// sendOperationStatusEvent(); + SEND_EVENT_WITH_2_U32_DATA( FP_EVENT_SUB_MODE_CHANGE, priorSubMode, currentSubMode ) + } + + // Broadcast current operation mode on interval + broadcastOperationMode(); +} + +/*********************************************************************//** + * @brief + * The requestNewOperationMode function requests transition to a new + * operation mode. The request will be arbitrated when the state machine + * is next executed. + * @details \b Alarm: ALARM_ID_FP_SOFTWARE_FAULT if given new mode is invalid. + * @details \b Inputs: none + * @details \b Outputs: modeRequest[] + * @return none + *************************************************************************/ +void requestNewOperationMode( FP_OP_MODE_T newMode ) +{ + // Validate requested mode + if ( newMode < FP_MODE_NLEG ) + { + // Make request + modeRequest[ newMode ] = TRUE; + } + else + { // Invalid mode requested + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_FP_SOFTWARE_FAULT, SW_FAULT_ID_OP_MODES_INVALID_MODE_REQUESTED, newMode ) + } +} + +/*********************************************************************//** + * @brief + * The getCurrentOperationMode function gets the current operation mode. + * @details \b Inputs: currentMode + * @details \b Outputs: none + * @return the current operation mode + *************************************************************************/ +FP_OP_MODE_T getCurrentOperationMode( void ) +{ + return currentMode; +} + +/*********************************************************************//** + * @brief + * The getPreviousOperationMode function gets the previous operation mode. + * @details \b Inputs: lastMode + * @details \b Outputs: none + * @return the previous operation mode + *************************************************************************/ +FP_OP_MODE_T getPreviousOperationMode( void ) +{ + return lastMode; +} + +/*********************************************************************//** + * @brief + * The getCurrentSubMode function gets the current operation sub-mode. + * @details \b Inputs: currentSubMode + * @details \b Outputs: none + * @return the current operation sub-mode + *************************************************************************/ +U32 getCurrentSubMode( void ) +{ + return currentSubMode; +} + +/*********************************************************************//** + * @brief + * The arbitrateModeRequest function arbitrates any pending mode transition + * requests. + * @note Thread protection prevents new mode requests from being made while + * arbitration is in progress. + * @details \b Inputs: modeRequest[] + * @details \b Outputs: modeRequest[] is reset + * @return the next operation mode (current mode if no requests pending) + *************************************************************************/ +static FP_OP_MODE_T arbitrateModeRequest( void ) +{ + FP_OP_MODE_T reqMode = currentMode; + U32 i; + + // Block additional requests until after mode arbitration + _disable_IRQ(); + + // Select highest priority mode request -or- current mode if no requests pending + for ( i = 0; i < FP_MODE_NLEG; i++ ) + { + if ( modeRequest[ i ] != FALSE ) + { + reqMode = (FP_OP_MODE_T)i; + break; + } + } + + // Clear all requests now that an arbitration winner is selected + for ( i = 0; i < FP_MODE_NLEG; i++ ) + { + modeRequest[ i ] = FALSE; + } + + // Un-block requests + _enable_IRQ(); + + return reqMode; +} + +/*********************************************************************//** + * @brief + * The transitionToNewOperationMode function calls the transition to function + * for a new operation mode that we are transitioning to. + * @details \b Alarm: ALARM_ID_FP_SOFTWARE_FAULT if given new mode is invalid. + * @details \b Inputs: none + * @details \b Outputs: transition function called for new mode + * @return none + *************************************************************************/ +static void transitionToNewOperationMode( FP_OP_MODE_T newMode ) +{ + // Setup for new operating mode + switch ( newMode ) + { + case FP_MODE_FAUL: + currentSubMode = transitionToFaultMode(); + break; + + case FP_MODE_SERV: +// currentSubMode = transitionToServiceMode(); + break; + + case FP_MODE_INIT: + currentSubMode = transitionToInitAndPOSTMode(); + break; + + case FP_MODE_STAN: + currentSubMode = transitionToStandbyMode(); + break; + + case FP_MODE_PGEN: + currentSubMode = transitionToPreGenPMode(); + break; + + case FP_MODE_GENP: + currentSubMode = transitionToGenPermeateMode(); + break; + + case FP_MODE_DPGW: + //currentSubMode = transitionToPreGenWMode(); + break; + + case FP_MODE_DEGW: + //currentSubMode = transitionToGenWaterMode(); + break; + + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_FP_SOFTWARE_FAULT, SW_FAULT_ID_OP_MODES_INVALID_MODE_TO_TRANSITION_TO, newMode ) + break; + } +} + +/*********************************************************************//** + * @brief + * The broadcastOperationMode function sends the current operation mode at + * the prescribed interval. + * @details \b Inputs: broadcastModeIntervalCtr + * @details \b Outputs: FP operation mode broadcast message sent. + * @return none + *************************************************************************/ +static void broadcastOperationMode( void ) +{ + if ( ++broadcastModeIntervalCtr >= getU32OverrideValue( &opModePublishInterval ) ) + { + OP_MODE_PAYLOAD_T data; + + broadcastModeIntervalCtr = 0; + data.opMode = (U32)currentMode; + data.subMode = currentSubMode; + broadcastData( MSG_ID_FP_OP_MODE_DATA, COMM_BUFFER_OUT_CAN_FP_BROADCAST, (U08*)&data, sizeof( OP_MODE_PAYLOAD_T ) ); + } +} + +/*********************************************************************//** + * @brief + * The setCurrentSubState function sets the current subState. + * @details \b Inputs: none + * @details \b Outputs: currentSubState + * @param subState the enumerated sub state. + * @return none + *************************************************************************/ +void setCurrentSubState( U32 subState ) +{ + currentSubState = subState; +} + +/*********************************************************************//** + * @brief + * The setCurrent4thLevelState function sets the current 4th level state. + * @details \b Inputs: none + * @details \b Outputs: current4thLevelState + * @param subState the enumerated sub state. + * @return none + *************************************************************************/ +void setCurrent4thLevelState( U32 state ) +{ + current4thLevelState = state; +} + +/*********************************************************************//** + * @brief + * The isFPDefeatured function returns if the Leahi device is defeatured. + * @details \b Inputs: none + * @details \b Outputs: none + * @return the current state of standby mode. + *************************************************************************/ +BOOL isFPDefeatured( void ) +{ + // TODO - pull status from NV mem. + return isDeviceDefeatured; +} + +/*********************************************************************//** + * @brief + * The isBoostPumpInstalled function returns if the Leahi device + * has a boost pump installed. + * @details \b Inputs: none + * @details \b Outputs: none + * @return the current state of standby mode. + *************************************************************************/ +BOOL isBoostPumpInstalled( void ) +{ + // TODO - pull status from NV mem. + return isBoostInstalled; +} + + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testSetOperationMode function will transition to a given operation + * mode if the transition is legal. + * @details \b Inputs: none + * @details \b Outputs: modeRequest[] + * @param message message from Dialin which includes the op mode to + * transition to. + * @return TRUE if request successful, FALSE if not + *************************************************************************/ +BOOL testSetOperationMode( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify message payload length is valid + if ( sizeof( U32 ) == message->hdr.payloadLen ) + { + U32 newMode; + + memcpy( &newMode, message->payload, sizeof( U32 ) ); + if ( (FP_OP_MODE_T)newMode < NUM_OF_FP_MODES ) + { + FP_OP_MODE_T reqMode = (FP_OP_MODE_T)newMode; + + requestNewOperationMode( reqMode ); + result = TRUE; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSetOpModePublishIntervalOverride function sets the override of the + * operation mode publication interval. + * @details \b Inputs: none + * @details \b Outputs: opModePublishInterval + * @param message override message from Dialin which includes the interval + * (in ms) to set the op mode publish to. + * @return TRUE if override set successful, FALSE if not + *************************************************************************/ +BOOL testSetOpModePublishIntervalOverride( MESSAGE_T *message ) +{ + BOOL result = u32BroadcastIntervalOverride( message, &opModePublishInterval, TASK_GENERAL_INTERVAL ); + + return result; +} + +/**@}*/ Index: firmware/App/Modes/FPOperationModes.h =================================================================== diff -u --- firmware/App/Modes/FPOperationModes.h (revision 0) +++ firmware/App/Modes/FPOperationModes.h (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -0,0 +1,62 @@ +/************************************************************************** +* +* 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 FPOperationModes.h +* +* @author (last) Sean +* @date (last) 15-Nov-2024 +* +* @author (original) Sean +* @date (original) 15-Nov-2024 +* +***************************************************************************/ + +#ifndef __OP_MODES_H__ +#define __OP_MODES_H__ + +#include "FPCommon.h" +#include "FPDefs.h" + +/** + * @defgroup FPOperationModes FPOperationModes + * @brief Operation Modes unit. + * + * @addtogroup FPOperationModes + * @{ + */ + +// ********** public definitions ********** + +#define NO_SUB_STATE 0xFF ///< value for when submode does not have specific substates and is not applicable. + +/// Payload record structure for op mode broadcast message +typedef struct +{ + U32 opMode; ///< Current operating mode + U32 subMode; ///< Current sub-mode of current operating mode +} OP_MODE_PAYLOAD_T; + +// ********** public function prototypes ********** + +void initOperationModes( void ); // Initialize this unit +void execOperationModes( void ); + +void requestNewOperationMode( FP_OP_MODE_T newMode ); // Request a transition to a new operation mode +FP_OP_MODE_T getCurrentOperationMode( void ); // Get the current operation mode +FP_OP_MODE_T getPreviousOperationMode( void ); // Get the previous operation mode +U32 getCurrentSubMode( void ); // Get the current sub-mode +BOOL isFPDefeatured( void ); // is the Leahi device is defeatured ( TBD pulled from NV mem ) +BOOL isBoostPumpInstalled( void ); // is this leahi device installed with a boost pump ( TBD pulled from NV mem ) + +void setCurrentSubState( U32 subState ); // Set the current substate. +void setCurrent4thLevelState( U32 state ); // Set the current 4th level state. +BOOL testSetOperationMode( MESSAGE_T *message ); // Set operation mode override +BOOL testSetOpModePublishIntervalOverride( MESSAGE_T *message ); // Set operation mode publish interval override + +/**@}*/ + +#endif Index: firmware/App/Modes/FlushConcentrate.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Modes/FlushConcentrate.c (.../FlushConcentrate.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Modes/FlushConcentrate.c (.../FlushConcentrate.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,15 +15,16 @@ * ***************************************************************************/ + #include #include "Conductivity.h" #include "BoostPump.h" #include "FlowSensor.h" #include "FlushConcentrate.h" +#include "FPOperationModes.h" #include "MessageSupport.h" #include "Messaging.h" -#include "OperationModes.h" #include "Pressure.h" #include "ROPump.h" #include "TaskGeneral.h" Index: firmware/App/Modes/FlushFilter.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Modes/FlushFilter.c (.../FlushFilter.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Modes/FlushFilter.c (.../FlushFilter.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -18,9 +18,9 @@ #include #include "FlushFilter.h" +#include "FPOperationModes.h" #include "MessageSupport.h" #include "Messaging.h" -#include "OperationModes.h" #include "Pressure.h" #include "TaskGeneral.h" #include "Timers.h" Index: firmware/App/Modes/FlushPermeate.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Modes/FlushPermeate.c (.../FlushPermeate.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Modes/FlushPermeate.c (.../FlushPermeate.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,14 +15,15 @@ * ***************************************************************************/ + #include -#include "Conductivity.h" #include "BoostPump.h" +#include "Conductivity.h" #include "FlushPermeate.h" +#include "FPOperationModes.h" #include "MessageSupport.h" #include "Messaging.h" -#include "OperationModes.h" #include "Pressure.h" #include "ROPump.h" #include "TaskGeneral.h" Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/ModeFault.c'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/ModeFault.h'. Fisheye: No comparison available. Pass `N' to diff? Index: firmware/App/Modes/ModeGenPermeate.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Modes/ModeGenPermeate.c (.../ModeGenPermeate.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Modes/ModeGenPermeate.c (.../ModeGenPermeate.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -17,13 +17,13 @@ #include "BoostPump.h" #include "DDInterface.h" +#include "FPModeStandby.h" +#include "FPOperationModes.h" #include "Level.h" #include "MessageSupport.h" #include "Messaging.h" #include "ModeGenPermeate.h" #include "ModePreGenPermeate.h" -#include "ModeStandby.h" -#include "OperationModes.h" #include "ROPump.h" #include "TaskGeneral.h" #include "Timers.h" Index: firmware/App/Modes/ModeGenPermeateDefeatured.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Modes/ModeGenPermeateDefeatured.c (.../ModeGenPermeateDefeatured.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Modes/ModeGenPermeateDefeatured.c (.../ModeGenPermeateDefeatured.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,12 +15,12 @@ * ***************************************************************************/ +#include "FPModeStandby.h" +#include "FPOperationModes.h" #include "Messaging.h" #include "MessageSupport.h" #include "ModeGenPermeateDefeatured.h" #include "ModePreGenPermeateDefeatured.h" -#include "ModeStandby.h" -#include "OperationModes.h" #include "TaskGeneral.h" #include "Timers.h" #include "Valves.h" Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/ModeInitPOST.c'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/ModeInitPOST.h'. Fisheye: No comparison available. Pass `N' to diff? Index: firmware/App/Modes/ModePreGenPermeate.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Modes/ModePreGenPermeate.c (.../ModePreGenPermeate.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Modes/ModePreGenPermeate.c (.../ModePreGenPermeate.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,17 +15,18 @@ * ***************************************************************************/ + #include "BoostPump.h" #include "DDInterface.h" #include "FlushFilter.h" #include "FlushPermeate.h" #include "FlushConcentrate.h" +#include "FPModeStandby.h" +#include "FPOperationModes.h" #include "MessageSupport.h" #include "Messaging.h" #include "ModeGenPermeate.h" #include "ModePreGenPermeate.h" -#include "ModeStandby.h" -#include "OperationModes.h" #include "ROPump.h" #include "TaskGeneral.h" #include "Timers.h" Index: firmware/App/Modes/ModePreGenPermeateDefeatured.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Modes/ModePreGenPermeateDefeatured.c (.../ModePreGenPermeateDefeatured.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Modes/ModePreGenPermeateDefeatured.c (.../ModePreGenPermeateDefeatured.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,12 +15,12 @@ * ***************************************************************************/ +#include "FPModeStandby.h" +#include "FPOperationModes.h" #include "Messaging.h" #include "MessageSupport.h" #include "ModeGenPermeateDefeatured.h" #include "ModePreGenPermeateDefeatured.h" -#include "ModeStandby.h" -#include "OperationModes.h" #include "TaskGeneral.h" #include "Timers.h" #include "Valves.h" Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/ModeStandby.c'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/ModeStandby.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/OperationModes.c'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 refers to a dead (removed) revision in file `firmware/App/Modes/OperationModes.h'. Fisheye: No comparison available. Pass `N' to diff? Index: firmware/App/Monitors/Conductivity.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Monitors/Conductivity.c (.../Conductivity.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Monitors/Conductivity.c (.../Conductivity.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -20,13 +20,9 @@ #include "Conductivity.h" #include "ConductivitySensor.h" +#include "FPOperationModes.h" #include "MessageSupport.h" #include "Messaging.h" -#include "ModeGenPermeate.h" -#include "ModeGenPermeateDefeatured.h" -#include "ModePreGenPermeate.h" -#include "ModePreGenPermeateDefeatured.h" -#include "OperationModes.h" #include "TaskPriority.h" #include "Utilities.h" Index: firmware/App/Monitors/Flow.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Monitors/Flow.c (.../Flow.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Monitors/Flow.c (.../Flow.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,14 +15,11 @@ * ***************************************************************************/ + #include "AlarmMgmtFP.h" #include "Flow.h" +#include "FPOperationModes.h" #include "Messaging.h" -#include "ModeGenPermeate.h" -#include "ModeGenPermeateDefeatured.h" -#include "ModePreGenPermeate.h" -#include "ModePreGenPermeateDefeatured.h" -#include "OperationModes.h" #include "PersistentAlarm.h" #include "TaskPriority.h" Index: firmware/App/Monitors/Pressure.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,13 +15,10 @@ * ***************************************************************************/ + #include "AlarmMgmtFP.h" #include "Messaging.h" -#include "ModeGenPermeate.h" -#include "ModeGenPermeateDefeatured.h" -#include "ModePreGenPermeate.h" -#include "ModePreGenPermeateDefeatured.h" -#include "OperationModes.h" +#include "FPOperationModes.h" #include "Pressure.h" #include "PersistentAlarm.h" #include "TaskPriority.h" @@ -320,7 +317,6 @@ publishPressuresData(); } - /*********************************************************************//** * @brief * The filterPressureSensorReadings function filters the pressures for Index: firmware/App/Monitors/WaterQualityMonitor.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Monitors/WaterQualityMonitor.c (.../WaterQualityMonitor.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Monitors/WaterQualityMonitor.c (.../WaterQualityMonitor.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,10 +15,11 @@ * ***************************************************************************/ + #include "Conductivity.h" #include "Flow.h" -#include "ModeStandby.h" -#include "OperationModes.h" +#include "FPModeStandby.h" +#include "FPOperationModes.h" #include "PersistentAlarm.h" #include "Pressure.h" #include "SystemCommFP.h" Index: firmware/App/Services/AlarmMgmtFP.c =================================================================== diff -u -r311c75cc5ac41b4b9ca4983df84e43af910f9be4 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Services/AlarmMgmtFP.c (.../AlarmMgmtFP.c) (revision 311c75cc5ac41b4b9ca4983df84e43af910f9be4) +++ firmware/App/Services/AlarmMgmtFP.c (.../AlarmMgmtFP.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -18,7 +18,7 @@ #include "AlarmMgmtFP.h" #include "Messaging.h" -#include "OperationModes.h" +#include #include "PersistentAlarm.h" #include "SafetyShutdown.h" #include "SystemCommFP.h" Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,17 +15,16 @@ * ***************************************************************************/ - #include "BoostPump.h" #include "DDInterface.h" +#include "FPModeStandby.h" +#include "FPOperationModes.h" #include "Messaging.h" #include "MessagePayloads.h" #include "ModeGenPermeate.h" #include "ModeGenPermeateDefeatured.h" #include "ModePreGenPermeate.h" #include "ModePreGenPermeateDefeatured.h" -#include "ModeStandby.h" -#include "OperationModes.h" #include "PersistentAlarm.h" #include "ROPump.h" #include "SystemCommFP.h" @@ -184,7 +183,7 @@ if ( ( FP_MODE_STAN == roMode ) && ( TRUE == start ) ) { setDDPermeateFlowRate( roRate ); - if ( TRUE == isDefeatured() ) + if ( TRUE == isFPDefeatured() ) { result = requestPreGenDefStart(); } @@ -237,7 +236,7 @@ if ( TRUE == start ) { setDDPermeateFlowRate( roRate ); - if ( TRUE == isDefeatured() ) + if ( TRUE == isFPDefeatured() ) { result = requestGenWaterDefStart(); } Index: firmware/App/Services/FpgaFP.c =================================================================== diff -u -r41c4d109b7bc172d93ae1f4e4b20acaf96547807 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Services/FpgaFP.c (.../FpgaFP.c) (revision 41c4d109b7bc172d93ae1f4e4b20acaf96547807) +++ firmware/App/Services/FpgaFP.c (.../FpgaFP.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -15,11 +15,12 @@ * ***************************************************************************/ -#include + #include "string.h" // for memset(), memcpy() #include "Compatible.h" -#include "OperationModes.h" +#include "FpgaFP.h" +#include "FPOperationModes.h" #include "Timers.h" #include "Utilities.h" Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -1,5 +1,6 @@ + #include // for memcpy() #include "BoostPump.h" @@ -9,11 +10,11 @@ #include "Flow.h" #include "FluidPump.h" #include "FpgaFP.h" +#include "FPOperationModes.h" #include "Level.h" #include "Messaging.h" #include "ModeGenPermeate.h" #include "ModePreGenPermeate.h" -#include "OperationModes.h" #include "PAL.h" #include "Pressure.h" #include "ROPump.h" Index: firmware/App/Services/SystemCommFP.c =================================================================== diff -u -r410afd26b3ae5e372310c696c82f58c59235e10d -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Services/SystemCommFP.c (.../SystemCommFP.c) (revision 410afd26b3ae5e372310c696c82f58c59235e10d) +++ firmware/App/Services/SystemCommFP.c (.../SystemCommFP.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -1,15 +1,16 @@ + #include // For memcpy() #include "can.h" #include "sci.h" #include "sys_dma.h" #include "Comm.h" +#include "FPOperationModes.h" #include "Interrupts.h" #include "Messaging.h" -#include "OperationModes.h" #include "SystemCommFP.h" #include "Timers.h" #include "Utilities.h" Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -r410afd26b3ae5e372310c696c82f58c59235e10d -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 410afd26b3ae5e372310c696c82f58c59235e10d) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -1,7 +1,8 @@ + #include "AlarmMgmtFP.h" +#include "FPOperationModes.h" #include "Messaging.h" -#include "OperationModes.h" #include "ROPump.h" #include "SystemCommFP.h" #include "TaskGeneral.h" Index: firmware/source/sys_main.c =================================================================== diff -u -r337136fc77fe5628fa727aac6252a06238561a10 -r94d93795b2a516b3bdd7fc7030eb5eac933bfcd0 --- firmware/source/sys_main.c (.../sys_main.c) (revision 337136fc77fe5628fa727aac6252a06238561a10) +++ firmware/source/sys_main.c (.../sys_main.c) (revision 94d93795b2a516b3bdd7fc7030eb5eac933bfcd0) @@ -48,6 +48,10 @@ /* Include Files */ +#include +#include +#include +#include #include "sys_common.h" /* USER CODE BEGIN (1) */ @@ -75,15 +79,11 @@ #include "InternalADC.h" #include "Interrupts.h" #include "Level.h" -#include "ModeFault.h" -#include "ModeInitPOST.h" #include "ModeGenPermeateDefeatured.h" #include "ModePreGenPermeateDefeatured.h" #include "ModeGenPermeate.h" #include "ModePreGenPermeate.h" -#include "ModeStandby.h" #include "MsgQueues.h" -#include "OperationModes.h" #include "Pressure.h" #include "ROPump.h" #include "SafetyShutdown.h"