diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-09-18 19:08:17 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-09-18 19:08:17 +0300 |
commit | 3456330605d42f352774f4e71a78ace3a93c62b5 (patch) | |
tree | 73bfd44424f1e9d999c408a99d2c4e57a5edf064 /src/Endstops/RemoteZProbe.cpp | |
parent | 09d143bec34cca11d21f5f6fe7e731e64bef181b (diff) |
Bug fix to M558 when an invalid remote port name is provided
Diffstat (limited to 'src/Endstops/RemoteZProbe.cpp')
-rw-r--r-- | src/Endstops/RemoteZProbe.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Endstops/RemoteZProbe.cpp b/src/Endstops/RemoteZProbe.cpp index d6575884..21ecf08e 100644 --- a/src/Endstops/RemoteZProbe.cpp +++ b/src/Endstops/RemoteZProbe.cpp @@ -76,8 +76,14 @@ GCodeResult RemoteZProbe::Create(const StringRef& pinNames, const StringRef& rep return GCodeResult::error; } - handle.Set(RemoteInputHandle::typeZprobe, number, 0); - return CanInterface::CreateHandle(boardAddress, handle, pinNames.c_str(), 0, ActiveProbeReportInterval, state, reply); + RemoteInputHandle h; + h.Set(RemoteInputHandle::typeZprobe, number, 0); + const GCodeResult rc = CanInterface::CreateHandle(boardAddress, h, pinNames.c_str(), 0, ActiveProbeReportInterval, state, reply); + if (rc < GCodeResult::error) // don't set the handle unless it is valid, or we will get an error when this probe is deleted + { + handle = h; + } + return rc; } // Configure an existing remote Z probe |