diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-01-23 19:50:25 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-01-23 19:50:25 +0300 |
commit | fec7a47b928ab9bcd0c11ec4f9b6926f2e732401 (patch) | |
tree | c389c54be0945af80c18b9e85633940b0902ed3f /src/Heating/RemoteHeater.h | |
parent | 679be2794bddb1a8e044dbc3eab882ef159bf8e1 (diff) |
Partially implemented remote heater tuning
Diffstat (limited to 'src/Heating/RemoteHeater.h')
-rw-r--r-- | src/Heating/RemoteHeater.h | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/Heating/RemoteHeater.h b/src/Heating/RemoteHeater.h index 907908e7..d39558d6 100644 --- a/src/Heating/RemoteHeater.h +++ b/src/Heating/RemoteHeater.h @@ -22,34 +22,47 @@ public: GCodeResult SetPwmFrequency(PwmFrequency freq, const StringRef& reply) override; GCodeResult ReportDetails(const StringRef& reply) const noexcept override; - void Spin() noexcept override; // Called in a tight loop to keep things running - void SwitchOff() noexcept override; // Not even standby - all heater power off - GCodeResult ResetFault(const StringRef& reply) noexcept override; // Reset a fault condition - only call this if you know what you are doing - float GetTemperature() const noexcept override; // Get the current temperature - float GetAveragePWM() const noexcept override; // Return the running average PWM to the heater. Answer is a fraction in [0, 1]. - float GetAccumulator() const noexcept override; // Return the integral accumulator - GCodeResult StartAutoTune(GCodeBuffer& gb, const StringRef& reply, FansBitmap fans) THROWS(GCodeException) override; // Start an auto tune cycle for this heater + void Spin() noexcept override; // Called in a tight loop to keep things running + void SwitchOff() noexcept override; // Not even standby - all heater power off + GCodeResult ResetFault(const StringRef& reply) noexcept override; // Reset a fault condition - only call this if you know what you are doing + float GetTemperature() const noexcept override; // Get the latest temperature + float GetAveragePWM() const noexcept override; // Return the running average PWM to the heater. Answer is a fraction in [0, 1]. + float GetAccumulator() const noexcept override; // Return the integral accumulator void GetAutoTuneStatus(const StringRef& reply) const noexcept override; // Get the auto tune status or last result - void Suspend(bool sus) noexcept override; // Suspend the heater to conserve power or while doing Z probing + void Suspend(bool sus) noexcept override; // Suspend the heater to conserve power or while doing Z probing void PrintCoolingFanPwmChanged(float pwmChange) noexcept override; void UpdateRemoteStatus(CanAddress src, const CanHeaterReport& report) noexcept override; protected: void ResetHeater() noexcept override; HeaterMode GetMode() const noexcept override; - GCodeResult SwitchOn(const StringRef& reply) noexcept override; // Turn the heater on and set the mode - GCodeResult UpdateModel(const StringRef& reply) noexcept override; // Called when the heater model has been changed + GCodeResult SwitchOn(const StringRef& reply) noexcept override; // Turn the heater on and set the mode + GCodeResult UpdateModel(const StringRef& reply) noexcept override; // Called when the heater model has been changed GCodeResult UpdateFaultDetectionParameters(const StringRef& reply) noexcept override; GCodeResult UpdateHeaterMonitors(const StringRef& reply) noexcept override; + GCodeResult StartAutoTune(const StringRef& reply, FansBitmap fans, float targetTemp, float pwm, bool seenA, float ambientTemp) noexcept override; // Start an auto tune cycle for this heater private: + enum class TuningState : uint8_t + { + notTuning = 0, + stabilising, + heatingUp, + cyclingFanOff, + cyclingFanOn + }; + + GCodeResult SendTuningCommand(const StringRef& reply, bool on) noexcept; + static constexpr uint32_t RemoteStatusTimeout = 2000; CanAddress boardAddress; HeaterMode lastMode; uint8_t averagePwm; + TuningState tuningState; float lastTemperature; uint32_t whenLastStatusReceived; + uint32_t timeSetHeating; // When we turned on the heater at the start of auto tuning }; #endif |