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>2021-07-20 15:20:42 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-07-20 15:20:42 +0300
commitb2b00b36ffe92a4e74b9fc4d302ee63da94b3c92 (patch)
tree5157c62789f5f71fd6ce0d8f61c1afbb7a85e20f /src/Heating
parentf6b97a8facd3663964654fa0ac938c45748ebc09 (diff)
Fixed assertion error when tick ISR tries to turn off all heaters
Diffstat (limited to 'src/Heating')
-rw-r--r--src/Heating/Heat.cpp16
-rw-r--r--src/Heating/Heat.h3
-rw-r--r--src/Heating/Heater.h1
-rw-r--r--src/Heating/LocalHeater.h1
-rw-r--r--src/Heating/RemoteHeater.h1
5 files changed, 21 insertions, 1 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;