diff options
author | dc42 <dcrocker@eschertech.com> | 2021-09-30 16:58:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-30 16:58:36 +0300 |
commit | 8af30dc8661796a9800f1f4ad848a3a0624e08c4 (patch) | |
tree | 55a052d53730948b1a25351156bfe9c72c232018 /src/GCodes | |
parent | 6bc1aa4314457a3dc5a91321b31c02b9414843c3 (diff) | |
parent | e2d8287f8cb64634f55379baaa46bee3177f220f (diff) |
Merge pull request #531 from tobbelobb/3.4-dev
Implements M569.3 and M569.4 commands for Hangprinter
Diffstat (limited to 'src/GCodes')
-rw-r--r-- | src/GCodes/GCodes3.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/GCodes/GCodes3.cpp b/src/GCodes/GCodes3.cpp index ba7843f6..5b273193 100644 --- a/src/GCodes/GCodes3.cpp +++ b/src/GCodes/GCodes3.cpp @@ -1339,14 +1339,35 @@ GCodeResult GCodes::ReceiveI2c(GCodeBuffer& gb, const StringRef &reply) GCodeResult GCodes::ConfigureDriver(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException) { gb.MustSee('P'); - const DriverId id = gb.GetDriverId(); + size_t drivesCount = numVisibleAxes; + DriverId driverIds[drivesCount]; + gb.GetDriverIdArray(driverIds, drivesCount); + #if SUPPORT_CAN_EXPANSION - if (id.boardAddress != CanInterface::GetCanAddress()) + bool const isEncoderReading = (gb.GetCommandFraction() == 3); + for (size_t i = 0; i < drivesCount; ++i) { - return CanInterface::ConfigureRemoteDriver(id, gb, reply); + DriverId const id = driverIds[i]; + if (id.IsRemote()) + { + if (i == 0 && isEncoderReading) + { + reply.copy("["); + } + GCodeResult const res = CanInterface::ConfigureRemoteDriver(id, gb, reply); + if (i == drivesCount - 1 || res != GCodeResult::ok) + { + if (isEncoderReading && res == GCodeResult::ok) + { + reply.cat(" ],\n"); + } + return res; + } + } } #endif + const DriverId id = gb.GetDriverId(); const uint8_t drive = id.localDriver; if (drive >= platform.GetNumActualDirectDrivers()) { |