diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-09-15 11:36:03 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-09-15 11:36:03 +0300 |
commit | 6941819ed6cbce7a26e877fc118f0f8d40472901 (patch) | |
tree | a43b22cec434e62d30ae6aab3115f2f306944338 /src/Endstops/Endstop.h | |
parent | 2b0ee17e0b5f32a936b2c6f3dafc37685673adbc (diff) |
Refactoring
Refactored endstop source files in preparation for supporting remote endstops on Duet 3
Diffstat (limited to 'src/Endstops/Endstop.h')
-rw-r--r-- | src/Endstops/Endstop.h | 74 |
1 files changed, 1 insertions, 73 deletions
diff --git a/src/Endstops/Endstop.h b/src/Endstops/Endstop.h index 173bbcab..8e631790 100644 --- a/src/Endstops/Endstop.h +++ b/src/Endstops/Endstop.h @@ -57,7 +57,7 @@ class Endstop : public EndstopOrZProbe public: virtual EndStopInputType GetEndstopType() const = 0; virtual void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) = 0; - virtual void AppendPinNames(const StringRef& str) { } + virtual void AppendDetails(const StringRef& str) = 0; unsigned int GetAxis() const { return axis; } bool GetAtHighEnd() const { return atHighEnd; } @@ -72,76 +72,4 @@ private: bool atHighEnd; // whether this endstop is at the max (true) or the min (false) }; -// Switch-type endstop -class SwitchEndstop final : public Endstop -{ -public: - void* operator new(size_t sz) { return Allocate<SwitchEndstop>(); } - void operator delete(void* p) { Release<SwitchEndstop>(p); } - ~SwitchEndstop() override; - - SwitchEndstop(uint8_t axis, EndStopPosition pos); - - bool Configure(GCodeBuffer& gb, const StringRef& reply, EndStopInputType inputType); - bool Configure(const char *pinNames, const StringRef& reply, EndStopInputType inputType); - void Reconfigure(EndStopPosition pos, EndStopInputType inputType); - - EndStopInputType GetEndstopType() const override; - EndStopHit Stopped() const override; - void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override; - EndstopHitDetails CheckTriggered(bool goingSlow) override; - bool Acknowledge(EndstopHitDetails what) override; - void AppendPinNames(const StringRef& str) override; - -private: - typedef uint16_t PortsBitmap; - - IoPort ports[MaxDriversPerAxis]; - size_t numPortsUsed; - PortsBitmap portsLeftToTrigger; - size_t numPortsLeftToTrigger; - bool stopAll; -}; - -// Motor stall detection endstop -class StallDetectionEndstop final : public Endstop -{ -public: - void* operator new(size_t sz) { return Allocate<StallDetectionEndstop>(); } - void operator delete(void* p) { Release<StallDetectionEndstop>(p); } - - StallDetectionEndstop(uint8_t axis, EndStopPosition pos, bool p_individualMotors); - - EndStopInputType GetEndstopType() const override { return (individualMotors) ? EndStopInputType::motorStallIndividual : EndStopInputType::motorStallAny; } - EndStopHit Stopped() const override; - void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override; - EndstopHitDetails CheckTriggered(bool goingSlow) override; - bool Acknowledge(EndstopHitDetails what) override; - -private: - DriversBitmap driversMonitored; - unsigned int numDriversLeft; - bool individualMotors; - bool stopAll; -}; - -class ZProbeEndstop final : public Endstop -{ -public: - void* operator new(size_t sz) { return Allocate<ZProbeEndstop>(); } - void operator delete(void* p) { Release<ZProbeEndstop>(p); } - - ZProbeEndstop(uint8_t axis, EndStopPosition pos); - - EndStopInputType GetEndstopType() const override { return EndStopInputType::zProbeAsEndstop; } - EndStopHit Stopped() const override; - void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override; - EndstopHitDetails CheckTriggered(bool goingSlow) override; - bool Acknowledge(EndstopHitDetails what) override; - -private: - size_t zProbeNumber; // which Z probe to use, always 0 for now - bool stopAll; -}; - #endif /* SRC_ENDSTOPS_ENDSTOP_H_ */ |