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-05-16 21:50:14 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-05-16 21:50:14 +0300
commitff3c26d73664c2ab11c0ab14ec28539eebd75cd4 (patch)
tree1947e496785c3d79e690031eb54f1e32b3d28ec2 /src/Endstops/ZProbe.cpp
parenteec350695520a49e443689b2dd776ffad81e3167 (diff)
Bug fixes
Z probe types 6 and 7 didn't work. They are now invalid modes, so is mode 4. Initialisation of driver bitmaps for individuaol motor moves was incomplete.
Diffstat (limited to 'src/Endstops/ZProbe.cpp')
-rw-r--r--src/Endstops/ZProbe.cpp55
1 files changed, 33 insertions, 22 deletions
diff --git a/src/Endstops/ZProbe.cpp b/src/Endstops/ZProbe.cpp
index 27cb9fbe..bd341d04 100644
--- a/src/Endstops/ZProbe.cpp
+++ b/src/Endstops/ZProbe.cpp
@@ -86,7 +86,6 @@ int ZProbe::GetReading() const
{
case ZProbeType::analog: // Simple or intelligent IR sensor
case ZProbeType::alternateAnalog: // Alternate sensor
- case ZProbeType::endstopSwitch: // Switch connected to an endstop input
case ZProbeType::digital: // Switch connected to Z probe input
zProbeVal = (int) ((p.GetZProbeOnFilter().GetSum() + p.GetZProbeOffFilter().GetSum()) / (8 * Z_PROBE_AVERAGE_READINGS));
break;
@@ -188,7 +187,6 @@ uint16_t ZProbe::GetRawReading() const
case ZProbeType::alternateAnalog:
return min<uint16_t>(inputPort.ReadAnalog(), 4000);
- case ZProbeType::endstopSwitch:
case ZProbeType::digital:
case ZProbeType::unfilteredDigital:
case ZProbeType::blTouch:
@@ -294,11 +292,17 @@ GCodeResult ZProbe::HandleM558(GCodeBuffer& gb, const StringRef &reply, unsigned
{
seen = true;
const uint32_t requestedType = gb.GetUIValue();
- if (requestedType >= (uint32_t)ZProbeType::numTypes)
+ if ( requestedType >= (uint32_t)ZProbeType::numTypes
+ || requestedType == (uint32_t)ZProbeType::endstopSwitch_obsolete
+ || requestedType == (uint32_t)ZProbeType::e1Switch_obsolete
+ || requestedType == (uint32_t)ZProbeType::zSwitch_obsolete
+ )
{
reply.copy("Invalid Z probe type");
+ type = ZProbeType::none;
return GCodeResult::error;
}
+
type = (ZProbeType)requestedType;
if (!gb.DoDwellTime(100)) // delay a little to allow the averaging filters to accumulate data from the new source
{
@@ -306,36 +310,43 @@ GCodeResult ZProbe::HandleM558(GCodeBuffer& gb, const StringRef &reply, unsigned
}
}
+ // Determine the required pin access
+ PinAccess access[2];
+ switch (type)
+ {
+ case ZProbeType::analog:
+ case ZProbeType::dumbModulated:
+ access[0] = PinAccess::readAnalog;
+ access[1] = PinAccess::write1;
+ break;
+
+ case ZProbeType::alternateAnalog:
+ access[0] = PinAccess::readAnalog;
+ access[1] = PinAccess::write0;
+ break;
+
+ default:
+ access[0] = PinAccess::readWithPullup;
+ access[1] = PinAccess::write0;
+ break;
+ }
+
// Do the input channel next so that 'seen' will be true only if the type and/or the channel has been specified
if (gb.Seen('C')) // input channel
{
seen = true;
IoPort* const ports[] = { &inputPort, &modulationPort };
- PinAccess access[2];
- switch (type)
- {
- case ZProbeType::analog:
- case ZProbeType::dumbModulated:
- access[0] = PinAccess::readAnalog;
- access[1] = PinAccess::write1;
- break;
-
- case ZProbeType::alternateAnalog:
- access[0] = PinAccess::readAnalog;
- access[1] = PinAccess::write0;
- break;
-
- default:
- access[0] = PinAccess::readWithPullup;
- access[1] = PinAccess::write0;
- break;
- }
if (!IoPort::AssignPorts(gb, reply, PinUsedBy::zprobe, 2, ports, access))
{
return GCodeResult::error;
}
}
+ else if (seen) // if we had a P parameter then the type may have changed
+ {
+ (void)inputPort.SetMode(access[0]);
+ (void)modulationPort.SetMode(access[1]);
+ }
gb.TryGetFValue('H', diveHeight, seen); // dive height
if (gb.Seen('F')) // feed rate i.e. probing speed