diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-02-11 00:05:03 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-02-11 00:05:03 +0300 |
commit | d27f0a701c84fe1fcf4dc99c067b1fc38cd90f91 (patch) | |
tree | 4279d002965c2ada28a7fa1286cb4918b4b0c7a8 /src/CAN | |
parent | 1150faf0d9adcbcb1c2e5e9211686cf108119a8b (diff) |
Implemented remote stall configuration
Also removed MaxNormalAddress, use maxCanAddress everywhere instead
Diffstat (limited to 'src/CAN')
-rw-r--r-- | src/CAN/CanInterface.cpp | 10 | ||||
-rw-r--r-- | src/CAN/CanInterface.h | 3 | ||||
-rw-r--r-- | src/CAN/CanMotion.cpp | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index 24d8b6d1..9ad20b35 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -843,7 +843,7 @@ pre(driver.IsRemote()) } // Handle M915 for a collection of remote drivers -GCodeResult CanInterface::SetRemoteDriverStallParameters(const CanDriversList& drivers, GCodeBuffer& gb, const StringRef& reply) +GCodeResult CanInterface::GetSetRemoteDriverStallParameters(const CanDriversList& drivers, GCodeBuffer& gb, const StringRef& reply, OutputBuffer *& buf) { size_t start = 0; for (;;) @@ -858,7 +858,15 @@ GCodeResult CanInterface::SetRemoteDriverStallParameters(const CanDriversList& d CanMessageGenericConstructor cons(M915Params); cons.AddUParam('d', driverBits.GetRaw()); cons.PopulateFromCommand(gb); + if (buf != nullptr) + { + reply.Clear(); + } const GCodeResult rslt = cons.SendAndGetResponse(CanMessageType::m915, boardAddress, reply); + if (buf != nullptr) + { + buf->lcat(reply.c_str()); + } if (rslt != GCodeResult::ok) { return rslt; diff --git a/src/CAN/CanInterface.h b/src/CAN/CanInterface.h index 4250d7e7..f73e3c4c 100644 --- a/src/CAN/CanInterface.h +++ b/src/CAN/CanInterface.h @@ -52,6 +52,7 @@ public: void Clear() noexcept { numEntries = 0; } void AddEntry(DriverId id) noexcept; size_t GetNumEntries() const noexcept { return numEntries; } + bool IsEmpty() const noexcept { return numEntries == 0; } CanAddress GetNextBoardDriverBitmap(size_t& startFrom, CanDriversBitmap& driversBitmap) const noexcept; private: @@ -88,7 +89,7 @@ namespace CanInterface bool SetRemoteDriverMicrostepping(const CanDriversData& data, const StringRef& reply) noexcept; bool SetRemotePressureAdvance(const CanDriversData& data, const StringRef& reply) noexcept; GCodeResult ConfigureRemoteDriver(DriverId driver, GCodeBuffer& gb, const StringRef& reply) THROWS_GCODE_EXCEPTION; - GCodeResult SetRemoteDriverStallParameters(const CanDriversList& drivers, GCodeBuffer& gb, const StringRef& reply) THROWS_GCODE_EXCEPTION; + GCodeResult GetSetRemoteDriverStallParameters(const CanDriversList& drivers, GCodeBuffer& gb, const StringRef& reply, OutputBuffer *& buf) THROWS_GCODE_EXCEPTION; void WakeCanSender() noexcept; // Remote handle functions diff --git a/src/CAN/CanMotion.cpp b/src/CAN/CanMotion.cpp index 521eb8eb..72283ca5 100644 --- a/src/CAN/CanMotion.cpp +++ b/src/CAN/CanMotion.cpp @@ -22,7 +22,7 @@ static size_t driversToStopIndexBeingFilled = 0; static size_t indexOfNextDriverToStop = 0; static volatile bool stopAllFlag = false; static bool doingStopAll = false; -static LargeBitmap<CanId::MaxNormalAddress + 1> boardsActiveInLastMove; +static LargeBitmap<CanId::MaxCanAddress + 1> boardsActiveInLastMove; void CanMotion::Init() noexcept { |