diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-11-01 21:15:37 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-11-01 21:15:37 +0300 |
commit | 63d824642598cbd0f48beb410c137aa38769fb23 (patch) | |
tree | 5210b0eed72008551837bc57ca4b9c0a4e86c093 /src/Endstops/EndstopsManager.cpp | |
parent | e9e554aad66542a896ed316f05cc271461a2d4de (diff) |
Restrict Z probe types 1,2,3,5 to probe #0
Diffstat (limited to 'src/Endstops/EndstopsManager.cpp')
-rw-r--r-- | src/Endstops/EndstopsManager.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/Endstops/EndstopsManager.cpp b/src/Endstops/EndstopsManager.cpp index 467a9fc2..1f51bcc1 100644 --- a/src/Endstops/EndstopsManager.cpp +++ b/src/Endstops/EndstopsManager.cpp @@ -611,10 +611,9 @@ GCodeResult EndstopsManager::HandleM558(GCodeBuffer& gb, const StringRef &reply) // If it is a motor stall endstop, there should not be a port specified, but we can ignore the port if it is present uint32_t probeType = (uint32_t)ZProbeType::none; bool seenType = false; - gb.TryGetUIValue('P', probeType, seenType); + gb.TryGetLimitedUIValue('P', probeType, seenType, (uint32_t)ZProbeType::numTypes); if ( seenType - && ( probeType >= (uint32_t)ZProbeType::numTypes - || probeType == (uint32_t)ZProbeType::e1Switch_obsolete + && ( probeType == (uint32_t)ZProbeType::e1Switch_obsolete || probeType == (uint32_t)ZProbeType::endstopSwitch_obsolete || probeType == (uint32_t)ZProbeType::zSwitch_obsolete ) @@ -682,6 +681,16 @@ GCodeResult EndstopsManager::HandleM558(GCodeBuffer& gb, const StringRef &reply) } else #endif + if ( probeNumber != 0 + && ( probeType == (unsigned int)ZProbeType::analog || probeType == (unsigned int)ZProbeType::alternateAnalog + || probeType == (unsigned int)ZProbeType::dumbModulated || probeType == (unsigned int)ZProbeType::digital + ) + ) + { + reply.copy("Types 1,2,3 and 5 are available for Z probe 0 only"); + return GCodeResult::error; + } + else { newProbe = new LocalZProbe(probeNumber); } |