/** * @file State_Standby.cpp * @brief Implementation of the StandbyState class. * @author Emmanuel Hernandez Cruz * @date 2025-09-05 * * This file contains the implementation for the StandbyState, which defines * the behavior of the equipment when it is in an idle or standby mode. */ #include "ModbusPoints/Modbus_Point.h" #include "ModbusPoints/Modbus_FloatDecorator.h" #include "Equipment/Equipment.h" #include "Strategies/Strategy_Ramp.h" #include "Strategies/Strategy_Random.h" #include "Strategies/Strategy_Saw.h" #include "Strategies/Strategy_SingleValue.h" #include "Strategies/Strategy_Square.h" #include "Strategies/Strategy_PID.h" #include "States/State_Standby.h" #include "States/State_Running.h" #include "States/State_Fail.h" #include "States/State.h" #include #include #if defined(USE_MODBUS_IP) #include #else #include #endif /** * @brief Constructs a new StandbyState object. * * In this state, the equipment is idle. This constructor initializes strategies * to bring the system to a safe, idle condition. It sets a stable value for * the SAT reading and creates ramp strategies to bring the CW valve and all * EC fan speeds down to zero. */ template<> StandbyState::StandbyState() { // You can add initialization code here if needed } /** * @brief Executes the standby state's logic for one update cycle. * * This method applies the strategies defined for the standby state (e.g., * ramping values to zero). * * @warning This method currently does not check for a command to transition to the * Running state. This logic needs to be added to allow the unit to start. * @return A pointer to a new State if a transition should occur, otherwise nullptr. */ template<> State* StandbyState::update(Equipment* equipment) { // STATE control, add conditions if change to a different state is needed Serial.println("Standby update function"); // Apply any strategies defined for the standby state _applyStrategies(equipment); return nullptr; } /** * @brief Logic to execute once when entering the standby state. * This method performs cleanup by setting all alarm points and all EC fan * run status points to 0. * @param equipment Pointer to the Equipment instance. */ template<> void StandbyState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state Serial.println("Enter Standby State..."); } /** * @brief Logic to execute once when exiting the standby state. * @param equipment Pointer to the Equipment instance. */ template<> void StandbyState::exitState(Equipment* equipment) { // Cleanup logic to run when the equipment leaves this state Serial.println("Exit Standby State..."); }