diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-07-20 15:21:23 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-07-20 15:21:23 +0300 |
commit | 1ae9684d6cec3cf3896de3321dc5f87ad157fb01 (patch) | |
tree | dd89538df6ab497eecbcb59b880a319cdbba22ac /src | |
parent | a38c0b00790b890c0acf9e85c78a4522a14dda54 (diff) | |
parent | b2b00b36ffe92a4e74b9fc4d302ee63da94b3c92 (diff) |
Merge branch '3.4-dev' into 3.4-input-shaping
Diffstat (limited to 'src')
-rw-r--r-- | src/Heating/Heat.cpp | 16 | ||||
-rw-r--r-- | src/Heating/Heat.h | 3 | ||||
-rw-r--r-- | src/Heating/Heater.h | 1 | ||||
-rw-r--r-- | src/Heating/LocalHeater.h | 1 | ||||
-rw-r--r-- | src/Heating/RemoteHeater.h | 1 | ||||
-rw-r--r-- | src/Platform/RepRap.cpp | 2 |
6 files changed, 22 insertions, 2 deletions
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp index 24dacd12..fe5c1ef4 100644 --- a/src/Heating/Heat.cpp +++ b/src/Heating/Heat.cpp @@ -658,6 +658,22 @@ void Heat::SwitchOffAll(bool includingChamberAndBed) noexcept } } +// Turn off all local heaters. Safe to call from an ISR. Called only from the tick ISR. +void Heat::SwitchOffAllLocalFromISR() noexcept +{ + for (Heater* h : heaters) + { + if (h != nullptr +#if SUPPORT_CAN_EXPANSION + && h->IsLocal() +#endif + ) + { + h->SwitchOff(); + } + } +} + void Heat::Standby(int heater, const Tool *tool) noexcept { const auto h = FindHeater(heater); diff --git a/src/Heating/Heat.h b/src/Heating/Heat.h index 6bb51e21..2b13ca3a 100644 --- a/src/Heating/Heat.h +++ b/src/Heating/Heat.h @@ -73,7 +73,8 @@ public: bool AllHeatersAtSetTemperatures(bool includingBed, float tolerance) const noexcept; // Is everything at temperature within tolerance? - void SwitchOffAll(bool includingChamberAndBed) noexcept; // Turn all heaters off + void SwitchOffAll(bool includingChamberAndBed) noexcept; // Turn all heaters off. Not safe to call from an ISR. + void SwitchOffAllLocalFromISR() noexcept; // Turn off all local heaters. Safe to call from an ISR. void SuspendHeaters(bool sus) noexcept; // Suspend the heaters to conserve power or while probing GCodeResult ResetFault(int heater, const StringRef& reply) noexcept; // Reset a heater fault for a specific heater or all heaters diff --git a/src/Heating/Heater.h b/src/Heating/Heater.h index c5b088b7..fea96985 100644 --- a/src/Heating/Heater.h +++ b/src/Heating/Heater.h @@ -50,6 +50,7 @@ public: virtual void FeedForwardAdjustment(float fanPwmChange, float extrusionChange) noexcept = 0; #if SUPPORT_CAN_EXPANSION + virtual bool IsLocal() const noexcept = 0; virtual void UpdateRemoteStatus(CanAddress src, const CanHeaterReport& report) noexcept = 0; virtual void UpdateHeaterTuning(CanAddress src, const CanMessageHeaterTuningReport& msg) noexcept = 0; #endif diff --git a/src/Heating/LocalHeater.h b/src/Heating/LocalHeater.h index db6db03d..c107c2d3 100644 --- a/src/Heating/LocalHeater.h +++ b/src/Heating/LocalHeater.h @@ -41,6 +41,7 @@ public: void FeedForwardAdjustment(float fanPwmChange, float extrusionChange) noexcept override; #if SUPPORT_CAN_EXPANSION + bool IsLocal() const noexcept override { return true; } void UpdateRemoteStatus(CanAddress src, const CanHeaterReport& report) noexcept override { } void UpdateHeaterTuning(CanAddress src, const CanMessageHeaterTuningReport& msg) noexcept override { } #endif diff --git a/src/Heating/RemoteHeater.h b/src/Heating/RemoteHeater.h index 0391426b..67bd8eb3 100644 --- a/src/Heating/RemoteHeater.h +++ b/src/Heating/RemoteHeater.h @@ -30,6 +30,7 @@ public: float GetAccumulator() const noexcept override; // Return the integral accumulator void Suspend(bool sus) noexcept override; // Suspend the heater to conserve power or while doing Z probing void FeedForwardAdjustment(float fanPwmChange, float extrusionChange) noexcept override; + bool IsLocal() const noexcept override { return false; } void UpdateRemoteStatus(CanAddress src, const CanHeaterReport& report) noexcept override; void UpdateHeaterTuning(CanAddress src, const CanMessageHeaterTuningReport& msg) noexcept override; diff --git a/src/Platform/RepRap.cpp b/src/Platform/RepRap.cpp index b22f035d..b7205959 100644 --- a/src/Platform/RepRap.cpp +++ b/src/Platform/RepRap.cpp @@ -1293,7 +1293,7 @@ void RepRap::Tick() noexcept if (heatTaskStuck || ticksInSpinState >= MaxTicksInSpinState) // if we stall for 20 seconds, save diagnostic data and reset { stopped = true; - heat->SwitchOffAll(true); + heat->SwitchOffAllLocalFromISR(); // can't call SwitchOffAll because remote heaters can't be turned off from inside a ISR platform->EmergencyDisableDrivers(); // We now save the stack when we get stuck in a spin loop |