Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-02-16 17:10:43 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-02-16 17:10:43 +0300
commit315f4f47613fe09e613b6c639a7ddc37af3516d2 (patch)
tree45133ce063bf3bb2c40f522471f0074038168149 /src/Heating/LocalHeater.h
parent9885ed7cc55cb19fde1be14c8adfd11dfa7f86cf (diff)
Replaced HeaterProtection instances by HeaterMonitors
Diffstat (limited to 'src/Heating/LocalHeater.h')
-rw-r--r--src/Heating/LocalHeater.h37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/Heating/LocalHeater.h b/src/Heating/LocalHeater.h
index 3ad48f5a..c4e283ef 100644
--- a/src/Heating/LocalHeater.h
+++ b/src/Heating/LocalHeater.h
@@ -18,7 +18,7 @@
#include "Hardware/IoPorts.h"
#include "GCodes/GCodeResult.h"
-class HeaterProtection;
+class HeaterMonitor;
class LocalHeater : public Heater
{
@@ -38,7 +38,7 @@ public:
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
- void StartAutoTune(float targetTemp, float maxPwm, const StringRef& reply) noexcept override; // Start an auto tune cycle for this PID
+ GCodeResult StartAutoTune(float targetTemp, float maxPwm, const StringRef& reply) noexcept override; // Start an auto tune cycle for this PID
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
@@ -52,10 +52,11 @@ protected:
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 { return GCodeResult::ok; }
+ GCodeResult UpdateHeaterMonitors(const StringRef& reply) noexcept override { return GCodeResult::ok; }
private:
void SetHeater(float power) const noexcept; // Power is a fraction in [0,1]
- TemperatureError ReadTemperature() noexcept; // Read and store the temperature of this heater
+ TemperatureError ReadTemperature() noexcept; // Read and store the temperature of this heater
void DoTuningStep() noexcept; // Called on each temperature sample when auto tuning
static bool ReadingsStable(size_t numReadings, float maxDiff) noexcept
pre(numReadings >= 2; numReadings <= MaxTuningTempReadings);
@@ -65,27 +66,27 @@ private:
void DisplayBuffer(const char *intro) noexcept; // Debug helper
float GetExpectedHeatingRate() const noexcept; // Get the minimum heating rate we expect
- PwmPort port; // The port that drives the heater
- float temperature; // The current temperature
- float previousTemperatures[NumPreviousTemperatures]; // The temperatures of the previous NumDerivativeSamples measurements, used for calculating the derivative
- size_t previousTemperatureIndex; // Which slot in previousTemperature we fill in next
- float iAccumulator; // The integral LocalHeater component
- float lastPwm; // The last PWM value we output, before scaling by kS
- float averagePWM; // The running average of the PWM, after scaling.
- uint32_t timeSetHeating; // When we turned on the heater
- uint32_t lastSampleTime; // Time when the temperature was last sampled by Spin()
+ PwmPort port; // The port that drives the heater
+ float temperature; // The current temperature
+ float previousTemperatures[NumPreviousTemperatures]; // The temperatures of the previous NumDerivativeSamples measurements, used for calculating the derivative
+ size_t previousTemperatureIndex; // Which slot in previousTemperature we fill in next
+ float iAccumulator; // The integral LocalHeater component
+ float lastPwm; // The last PWM value we output, before scaling by kS
+ float averagePWM; // The running average of the PWM, after scaling.
+ uint32_t timeSetHeating; // When we turned on the heater
+ uint32_t lastSampleTime; // Time when the temperature was last sampled by Spin()
- uint16_t heatingFaultCount; // Count of questionable heating behaviours
+ uint16_t heatingFaultCount; // Count of questionable heating behaviours
- uint8_t previousTemperaturesGood; // Bitmap indicating which previous temperature were good readings
- HeaterMode mode; // Current state of the heater
- bool tuned; // True if tuning was successful
- uint8_t badTemperatureCount; // Count of sequential dud readings
+ uint8_t previousTemperaturesGood; // Bitmap indicating which previous temperature were good readings
+ HeaterMode mode; // Current state of the heater
+ bool tuned; // True if tuning was successful
+ uint8_t badTemperatureCount; // Count of sequential dud readings
static_assert(sizeof(previousTemperaturesGood) * 8 >= NumPreviousTemperatures, "too few bits in previousTemperaturesGood");
// Variables used during heater tuning
- static const size_t MaxTuningTempReadings = 128; // The maximum number of readings we keep. Must be an even number.
+ static const size_t MaxTuningTempReadings = 128; // The maximum number of readings we keep. Must be an even number.
static float *tuningTempReadings; // the readings from the heater being tuned
static float tuningStartTemp; // the temperature when we turned on the heater