diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-08-22 11:24:23 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-08-22 11:24:23 +0300 |
commit | 4a94d6063fabc4f0f6e3466555041b3da1390499 (patch) | |
tree | 5d2866ec7414f6e4e6b66a8e9b98fec8f1358352 | |
parent | 65510a271617119f47395e28b8ba42740776e66e (diff) |
Added check on brake port board number
-rw-r--r-- | src/CAN/CanInterface.cpp | 11 | ||||
-rw-r--r-- | src/Hardware/IoPorts.cpp | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index 410f6580..b82de902 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -931,6 +931,17 @@ pre(driver.IsRemote()) } case 7: + if (gb.Seen('C')) + { + // If a port name if provided, it must match the board ID + String<StringLength20> portName; + gb.GetQuotedString(portName.GetRef(), false); + if (isdigit(portName[0]) && IoPort::RemoveBoardAddress(portName.GetRef()) != driver.boardAddress) + { + reply.copy("Brake port must be on same board as driver"); + return GCodeResult::error; + } + } { CanMessageGenericConstructor cons(M569Point7Params); cons.PopulateFromCommand(gb); diff --git a/src/Hardware/IoPorts.cpp b/src/Hardware/IoPorts.cpp index 67d015da..07484371 100644 --- a/src/Hardware/IoPorts.cpp +++ b/src/Hardware/IoPorts.cpp @@ -78,7 +78,7 @@ bool IoPort::AssignPort(GCodeBuffer& gb, const StringRef& reply, PinUsedBy neede const CanAddress boardAddress = RemoveBoardAddress(pn.GetRef()); if (boardAddress != CanInterface::GetCanAddress()) { - reply.lcat("Remote ports are not supported by this command"); + reply.lcat("Port must be on main board"); #else if (!RemoveBoardAddress(pn.GetRef())) { |