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-12-14 18:15:32 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-12-14 18:15:32 +0300
commit6bb82cf378ae3cada270c4d1933876e6544b3d66 (patch)
tree1f6fd0908c648349710112a1597498bbed660560 /src/Endstops/Endstop.h
parentc91cddf8642f196be5625b3db2e9eb4e15ff3ac2 (diff)
Reworked stall detection endstops and implemented them for TMC2209
Diffstat (limited to 'src/Endstops/Endstop.h')
-rw-r--r--src/Endstops/Endstop.h55
1 files changed, 44 insertions, 11 deletions
diff --git a/src/Endstops/Endstop.h b/src/Endstops/Endstop.h
index 8fa272a0..73f51872 100644
--- a/src/Endstops/Endstop.h
+++ b/src/Endstops/Endstop.h
@@ -14,6 +14,10 @@
#include <Hardware/IoPorts.h>
#include <General/FreelistManager.h>
+#if SUPPORT_TMC22xx && HAS_STALL_DETECT
+# include <Movement/StepperDrivers/TMC22xx.h>
+#endif
+
class AxisDriversConfig;
class CanMessageBuffer;
@@ -32,29 +36,58 @@ public:
EndstopOrZProbe *GetNext() const noexcept { return next; }
void SetNext(EndstopOrZProbe *e) noexcept { next = e; }
- static void UpdateStalledDrivers(DriversBitmap drivers, bool isStalled) noexcept;
+#if HAS_STALL_DETECT && (SUPPORT_TMC2660 || SUPPORT_TMC51xx)
+ static void SetDriversStalled(DriversBitmap drivers) noexcept;
+ static void SetDriversNotStalled(DriversBitmap drivers) noexcept;
+#endif
protected:
- static DriversBitmap GetStalledDrivers() noexcept { return stalledDrivers; }
+
+#if HAS_STALL_DETECT
+ static DriversBitmap GetStalledDrivers(DriversBitmap driversOfInterest) noexcept;
+#endif
private:
EndstopOrZProbe *next; // next endstop in linked list
+#if HAS_STALL_DETECT && (SUPPORT_TMC2660 || SUPPORT_TMC51xx)
static DriversBitmap stalledDrivers; // used to track which drivers are reported as stalled, for stall detect endstops and stall detect Z probes
+#endif
};
-inline void EndstopOrZProbe::UpdateStalledDrivers(DriversBitmap drivers, bool isStalled) noexcept
+#if HAS_STALL_DETECT
+
+# if SUPPORT_TMC2660 || SUPPORT_TMC51xx
+
+// This is called by the TMC driver to tell us which drivers are stalled or not stalled
+inline void EndstopOrZProbe::SetDriversStalled(DriversBitmap drivers) noexcept
+{
+ stalledDrivers |= drivers;
+}
+
+// This is called by the TMC driver to tell us which drivers are stalled or not stalled
+inline void EndstopOrZProbe::SetDriversNotStalled(DriversBitmap drivers) noexcept
+{
+ stalledDrivers &= ~drivers;
+}
+
+// Return which drivers out of the set of interest are stalled
+inline DriversBitmap EndstopOrZProbe::GetStalledDrivers(DriversBitmap driversOfInterest) noexcept
+{
+ return stalledDrivers & driversOfInterest;
+}
+
+# elif SUPPORT_TMC22xx
+
+// Return which drivers out of the set of interest are stalled
+inline DriversBitmap EndstopOrZProbe::GetStalledDrivers(DriversBitmap driversOfInterest) noexcept
{
- if (isStalled)
- {
- stalledDrivers |= drivers;
- }
- else
- {
- stalledDrivers &= ~drivers;
- }
+ return SmartDrivers::GetStalledDrivers(driversOfInterest);
}
+# endif
+#endif
+
class Endstop : public EndstopOrZProbe
{
public: