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-10-22 23:35:16 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-10-22 23:35:16 +0300
commit8a9e12718b8161283dba0d54907e5586b560993b (patch)
tree552c1be769028da59b9007af67e9ee8b9f15f5ef /src/Endstops
parent89e64be0cb6b8fb9f39a5fac0c47fc8d91ce137d (diff)
Reduce acceleration when homing using stall detection
Diffstat (limited to 'src/Endstops')
-rw-r--r--src/Endstops/Endstop.h1
-rw-r--r--src/Endstops/EndstopsManager.cpp12
-rw-r--r--src/Endstops/EndstopsManager.h2
-rw-r--r--src/Endstops/StallDetectionEndstop.h2
4 files changed, 13 insertions, 4 deletions
diff --git a/src/Endstops/Endstop.h b/src/Endstops/Endstop.h
index cbdcf15e..fbed7ed1 100644
--- a/src/Endstops/Endstop.h
+++ b/src/Endstops/Endstop.h
@@ -94,6 +94,7 @@ public:
virtual EndStopType GetEndstopType() const noexcept = 0;
virtual bool Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) noexcept = 0;
virtual void AppendDetails(const StringRef& str) noexcept = 0;
+ virtual bool ShouldReduceAcceleration() const noexcept { return false; }
#if SUPPORT_CAN_EXPANSION
// Process a remote endstop input change that relates to this endstop
diff --git a/src/Endstops/EndstopsManager.cpp b/src/Endstops/EndstopsManager.cpp
index 3039fe4a..30000887 100644
--- a/src/Endstops/EndstopsManager.cpp
+++ b/src/Endstops/EndstopsManager.cpp
@@ -179,18 +179,24 @@ void EndstopsManager::AddToActive(EndstopOrZProbe& e) noexcept
}
// Set up the active endstop list according to the axes commanded to move in a G0/G1 S1/S3 command. Return true if successful.
-bool EndstopsManager::EnableAxisEndstops(AxesBitmap axes, bool forHoming) noexcept
+bool EndstopsManager::EnableAxisEndstops(AxesBitmap axes, bool forHoming, bool& reduceAcceleration) noexcept
{
activeEndstops = nullptr;
+ reduceAcceleration = false;
isHomingMove = forHoming && axes.IsNonEmpty();
const Kinematics& kin = reprap.GetMove().GetKinematics();
while (axes.IsNonEmpty())
{
const unsigned int axis = axes.LowestSetBit();
axes.ClearBit(axis);
- if (axisEndstops[axis] != nullptr && axisEndstops[axis]->Prime(kin, reprap.GetPlatform().GetAxisDriversConfig(axis)))
+ Endstop * const es = axisEndstops[axis];
+ if (es != nullptr && es->Prime(kin, reprap.GetPlatform().GetAxisDriversConfig(axis)))
{
- AddToActive(*axisEndstops[axis]);
+ AddToActive(*es);
+ if (es->ShouldReduceAcceleration())
+ {
+ reduceAcceleration = true;
+ }
}
else
{
diff --git a/src/Endstops/EndstopsManager.h b/src/Endstops/EndstopsManager.h
index bdfa199d..398c93ee 100644
--- a/src/Endstops/EndstopsManager.h
+++ b/src/Endstops/EndstopsManager.h
@@ -30,7 +30,7 @@ public:
void Init() noexcept;
// Set up the active endstop list according to the axes commanded to move in a G0/G1 S1/S3 command returning true if successful
- bool EnableAxisEndstops(AxesBitmap axes, bool forHoming) noexcept __attribute__ ((warn_unused_result));
+ bool EnableAxisEndstops(AxesBitmap axes, bool forHoming, bool& reduceAcceleration) noexcept __attribute__ ((warn_unused_result));
// Set up the active endstops for Z probing returning true if successful
bool EnableZProbe(size_t probeNumber, bool probingAway = false) noexcept __attribute__ ((warn_unused_result));
diff --git a/src/Endstops/StallDetectionEndstop.h b/src/Endstops/StallDetectionEndstop.h
index 4bcacf6b..eb0edd3d 100644
--- a/src/Endstops/StallDetectionEndstop.h
+++ b/src/Endstops/StallDetectionEndstop.h
@@ -28,6 +28,8 @@ public:
EndstopHitDetails CheckTriggered() noexcept override;
bool Acknowledge(EndstopHitDetails what) noexcept override;
void AppendDetails(const StringRef& str) noexcept override;
+ bool ShouldReduceAcceleration() const noexcept override { return true; }
+
void SetDrivers(DriversBitmap extruderDrivers) noexcept; // for setting which local extruder drives are active extruder endstops
private: