diff options
Diffstat (limited to 'src/Heating/Heater.h')
-rw-r--r-- | src/Heating/Heater.h | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/Heating/Heater.h b/src/Heating/Heater.h index 1d358bbe..f8bbb33d 100644 --- a/src/Heating/Heater.h +++ b/src/Heating/Heater.h @@ -25,58 +25,58 @@ enum class HeaterStatus { off = 0, standby = 1, active = 2, fault = 3, tuning = class Heater { public: - Heater(unsigned int num); - virtual ~Heater(); + Heater(unsigned int num) noexcept; + virtual ~Heater() noexcept; // Configuration methods virtual GCodeResult ConfigurePortAndSensor(const char *portName, PwmFrequency freq, unsigned int sensorNumber, const StringRef& reply) = 0; virtual GCodeResult SetPwmFrequency(PwmFrequency freq, const StringRef& reply) = 0; - virtual GCodeResult ReportDetails(const StringRef& reply) const = 0; - - virtual float GetTemperature() const = 0; // Get the current temperature - virtual float GetAveragePWM() const = 0; // Return the running average PWM to the heater. Answer is a fraction in [0, 1]. - virtual GCodeResult ResetFault(const StringRef& reply) = 0; // Reset a fault condition - only call this if you know what you are doing - virtual void SwitchOff() = 0; - virtual void Spin() = 0; - virtual void StartAutoTune(float targetTemp, float maxPwm, const StringRef& reply) = 0; // Start an auto tune cycle for this PID + virtual GCodeResult ReportDetails(const StringRef& reply) const noexcept = 0; + + virtual float GetTemperature() const noexcept = 0; // Get the current temperature + virtual float GetAveragePWM() const noexcept = 0; // Return the running average PWM to the heater. Answer is a fraction in [0, 1]. + virtual GCodeResult ResetFault(const StringRef& reply) noexcept = 0; // Reset a fault condition - only call this if you know what you are doing + virtual void SwitchOff() noexcept = 0; + virtual void Spin() noexcept = 0; + virtual void StartAutoTune(float targetTemp, float maxPwm, const StringRef& reply) noexcept = 0; // Start an auto tune cycle for this PID virtual void GetAutoTuneStatus(const StringRef& reply) const = 0; // Get the auto tune status or last result - virtual void Suspend(bool sus) = 0; // Suspend the heater to conserve power or while doing Z probing - virtual float GetAccumulator() const = 0; // Get the inertial term accumulator + virtual void Suspend(bool sus) noexcept = 0; // Suspend the heater to conserve power or while doing Z probing + virtual float GetAccumulator() const noexcept = 0; // Get the inertial term accumulator #if SUPPORT_CAN_EXPANSION - virtual void UpdateRemoteStatus(CanAddress src, const CanHeaterReport& report) = 0; + virtual void UpdateRemoteStatus(CanAddress src, const CanHeaterReport& report) noexcept = 0; #endif - HeaterStatus GetStatus() const; // Get the status of the heater - unsigned int GetHeaterNumber() const { return heaterNumber; } - const char *GetSensorName() const; // Get the name of the sensor for this heater, or nullptr if it hasn't been named - void SetActiveTemperature(float t); - float GetActiveTemperature() const { return activeTemperature; } - void SetStandbyTemperature(float t); - float GetStandbyTemperature() const { return standbyTemperature; } - GCodeResult Activate(const StringRef& reply); // Switch from idle to active - void Standby(); // Switch from active to idle - - void GetFaultDetectionParameters(float& pMaxTempExcursion, float& pMaxFaultTime) const + HeaterStatus GetStatus() const noexcept; // Get the status of the heater + unsigned int GetHeaterNumber() const noexcept { return heaterNumber; } + const char *GetSensorName() const noexcept; // Get the name of the sensor for this heater, or nullptr if it hasn't been named + void SetActiveTemperature(float t) noexcept; + float GetActiveTemperature() const noexcept { return activeTemperature; } + void SetStandbyTemperature(float t) noexcept; + float GetStandbyTemperature() const noexcept { return standbyTemperature; } + GCodeResult Activate(const StringRef& reply) noexcept; // Switch from idle to active + void Standby() noexcept; // Switch from active to idle + + void GetFaultDetectionParameters(float& pMaxTempExcursion, float& pMaxFaultTime) const noexcept { pMaxTempExcursion = maxTempExcursion; pMaxFaultTime = maxHeatingFaultTime; } - GCodeResult SetFaultDetectionParameters(float pMaxTempExcursion, float pMaxFaultTime, const StringRef& reply); + GCodeResult SetFaultDetectionParameters(float pMaxTempExcursion, float pMaxFaultTime, const StringRef& reply) noexcept; - float GetHighestTemperatureLimit() const; // Get the highest temperature limit - float GetLowestTemperatureLimit() const; // Get the lowest temperature limit - void SetHeaterProtection(HeaterProtection *h); + float GetHighestTemperatureLimit() const noexcept; // Get the highest temperature limit + float GetLowestTemperatureLimit() const noexcept; // Get the lowest temperature limit + void SetHeaterProtection(HeaterProtection *h) noexcept; - const FopDt& GetModel() const { return model; } // Get the process model - GCodeResult SetModel(float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted, const StringRef& reply); // Set the process model - void SetModelDefaults(); + const FopDt& GetModel() const noexcept { return model; } // Get the process model + GCodeResult SetModel(float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted, const StringRef& reply) noexcept; // Set the process model + void SetModelDefaults() noexcept; - bool IsHeaterEnabled() const // Is this heater enabled? + bool IsHeaterEnabled() const noexcept // Is this heater enabled? { return model.IsEnabled(); } - void SetM301PidParameters(const M301PidParameters& params) + void SetM301PidParameters(const M301PidParameters& params) noexcept { model.SetM301PidParameters(params); } - bool CheckGood() const; + bool CheckGood() const noexcept; protected: enum class HeaterMode : uint8_t @@ -98,23 +98,23 @@ protected: lastTuningMode = tuning3 }; - virtual void ResetHeater() = 0; - virtual HeaterMode GetMode() const = 0; - virtual GCodeResult SwitchOn(const StringRef& reply) = 0; - virtual GCodeResult UpdateModel(const StringRef& reply) = 0; - virtual GCodeResult UpdateFaultDetectionParameters(const StringRef& reply) = 0; + virtual void ResetHeater() noexcept = 0; + virtual HeaterMode GetMode() const noexcept = 0; + virtual GCodeResult SwitchOn(const StringRef& reply) noexcept = 0; + virtual GCodeResult UpdateModel(const StringRef& reply) noexcept = 0; + virtual GCodeResult UpdateFaultDetectionParameters(const StringRef& reply) noexcept = 0; - int GetSensorNumber() const { return sensorNumber; } - void SetSensorNumber(int sn) { sensorNumber = sn; } - float GetMaxTemperatureExcursion() const { return maxTempExcursion; } - float GetMaxHeatingFaultTime() const { return maxHeatingFaultTime; } - float GetTargetTemperature() const { return (active) ? activeTemperature : standbyTemperature; } - HeaterProtection *GetHeaterProtections() const { return heaterProtection; } + int GetSensorNumber() const noexcept { return sensorNumber; } + void SetSensorNumber(int sn) noexcept { sensorNumber = sn; } + float GetMaxTemperatureExcursion() const noexcept { return maxTempExcursion; } + float GetMaxHeatingFaultTime() const noexcept { return maxHeatingFaultTime; } + float GetTargetTemperature() const noexcept { return (active) ? activeTemperature : standbyTemperature; } + HeaterProtection *GetHeaterProtections() const noexcept { return heaterProtection; } FopDt model; private: - bool CheckProtection() const; // Check heater protection elements and return true if everything is good + bool CheckProtection() const noexcept; // Check heater protection elements and return true if everything is good unsigned int heaterNumber; int sensorNumber; // the sensor number used by this heater |