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>2019-09-15 11:36:03 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-09-15 11:36:03 +0300
commit6941819ed6cbce7a26e877fc118f0f8d40472901 (patch)
treea43b22cec434e62d30ae6aab3115f2f306944338 /src/Endstops/EndstopsManager.cpp
parent2b0ee17e0b5f32a936b2c6f3dafc37685673adbc (diff)
Refactoring
Refactored endstop source files in preparation for supporting remote endstops on Duet 3
Diffstat (limited to 'src/Endstops/EndstopsManager.cpp')
-rw-r--r--src/Endstops/EndstopsManager.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/Endstops/EndstopsManager.cpp b/src/Endstops/EndstopsManager.cpp
index f479bf81..7452c544 100644
--- a/src/Endstops/EndstopsManager.cpp
+++ b/src/Endstops/EndstopsManager.cpp
@@ -6,10 +6,16 @@
*/
#include "EndstopsManager.h"
+
#include "Endstop.h"
+#include "LocalSwitchEndstop.h"
+#include "StallDetectionEndstop.h"
+#include "ZProbeEndstop.h"
+
#include "ZProbe.h"
#include "LocalZProbe.h"
#include "RemoteZProbe.h"
+
#include "RepRap.h"
#include "GCodes/GCodeBuffer/GCodeBuffer.h"
#include "GCodes/GCodes.h"
@@ -38,7 +44,7 @@ void EndstopsManager::Init()
String<1> dummy;
for (size_t axis = 0; axis < ARRAY_SIZE(DefaultEndstopPinNames); ++axis)
{
- SwitchEndstop * const sw = new SwitchEndstop(axis, EndStopPosition::lowEndStop);
+ LocalSwitchEndstop * const sw = new LocalSwitchEndstop(axis, EndStopPosition::lowEndStop);
sw->Configure(DefaultEndstopPinNames[axis], dummy.GetRef(), EndStopInputType::activeHigh);
axisEndstops[axis] = sw;
}
@@ -188,27 +194,17 @@ GCodeResult EndstopsManager::HandleM574(GCodeBuffer& gb, const StringRef& reply)
char sep = ':';
for (size_t axis = 0; axis < reprap.GetGCodes().GetTotalAxes(); ++axis)
{
- const char c = reprap.GetGCodes().GetAxisLetters()[axis];
+ reply.catf("%c %c: ", sep, reprap.GetGCodes().GetAxisLetters()[axis]);
+ sep = ',';
if (axisEndstops[axis] == nullptr)
{
- reply.catf("%c %c: none", sep, c);
+ reply.cat("none");
}
else
{
- EndStopInputType inputType = axisEndstops[axis]->GetEndstopType();
- reply.catf("%c %c: %s %s",
- sep, c,
- (axisEndstops[axis]->GetAtHighEnd()) ? "high end" : "low end",
- (inputType == EndStopInputType::activeHigh) ? "active high switch"
- : (inputType == EndStopInputType::activeLow) ? "active low switch"
- : (inputType == EndStopInputType::zProbeAsEndstop) ? "Z probe"
- : (inputType == EndStopInputType::motorStallAny) ? "motor stall (any motor)"
- : (inputType == EndStopInputType::motorStallIndividual) ? "motor stall (individual motors)"
- : "unknown type"
- );
- axisEndstops[axis]->AppendPinNames(reply);
+ reply.cat((axisEndstops[axis]->GetAtHighEnd()) ? "high end " : "low end ");
+ axisEndstops[axis]->AppendDetails(reply);
}
- sep = ',';
}
return GCodeResult::ok;
}
@@ -239,7 +235,7 @@ GCodeResult EndstopsManager::HandleM574(GCodeBuffer& gb, const StringRef& reply)
delete axisEndstops[lastAxisSeen];
axisEndstops[lastAxisSeen] = nullptr;
- SwitchEndstop * const sw = new SwitchEndstop(lastAxisSeen, lastPosSeen);
+ LocalSwitchEndstop * const sw = new LocalSwitchEndstop(lastAxisSeen, lastPosSeen);
const bool ok = sw->Configure(gb, reply, inputType);
axisEndstops[lastAxisSeen] = sw;
if (!ok)
@@ -295,7 +291,7 @@ GCodeResult EndstopsManager::HandleM574(GCodeBuffer& gb, const StringRef& reply)
}
else
{
- ((SwitchEndstop *)axisEndstops[axis])->Reconfigure(pos, inputType);
+ ((LocalSwitchEndstop *)axisEndstops[axis])->Reconfigure(pos, inputType);
}
break;