From 62d6768a2bc686bf7c374d3815e81396312380e0 Mon Sep 17 00:00:00 2001 From: David Crocker Date: Sat, 21 Dec 2019 17:04:37 +0000 Subject: Various Added check on data length in W5500 network interface from v2.05 After freeing up a tool, get current position to account for changed tool offset Allow M115, M122 and M997 commands to reference CAN addres 126 --- src/CAN/CanInterface.cpp | 4 ++-- src/GCodes/GCodes4.cpp | 3 ++- src/Networking/W5500Ethernet/W5500Socket.cpp | 4 ++-- src/Version.h | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index 932ccdfe..6342b6b0 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -800,7 +800,7 @@ GCodeResult CanInterface::SetRemoteDriverStallParameters(const CanDriversList& d static GCodeResult GetRemoteInfo(uint8_t infoType, uint32_t boardAddress, uint8_t param, GCodeBuffer& gb, const StringRef& reply, uint8_t *extra = nullptr) { - if (boardAddress > CanId::MaxNormalAddress) + if (boardAddress > CanId::MaxCanAddress) { reply.copy("Invalid board address"); return GCodeResult::error; @@ -860,7 +860,7 @@ GCodeResult CanInterface::GetRemoteFirmwareDetails(uint32_t boardAddress, GCodeB // Tell an expansion board to update GCodeResult CanInterface::UpdateRemoteFirmware(uint32_t boardAddress, GCodeBuffer& gb, const StringRef& reply) { - if (boardAddress > CanId::MaxNormalAddress) + if (boardAddress > CanId::MaxCanAddress) { reply.copy("Invalid board address"); return GCodeResult::error; diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp index 1e16be06..85062b96 100644 --- a/src/GCodes/GCodes4.cpp +++ b/src/GCodes/GCodes4.cpp @@ -245,6 +245,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) if (oldTool != nullptr) { reprap.StandbyTool(oldTool->Number(), simulationMode != 0); + UpdateCurrentUserPosition(); // the tool offset may have changed, so get the current position } gb.AdvanceState(); if (reprap.GetTool(gb.MachineState().newToolNumber) != nullptr && AllAxesAreHomed() && (gb.MachineState().toolChangeParam & TPreBit) != 0) @@ -261,7 +262,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) if (LockMovementAndWaitForStandstill(gb)) // wait for tpre.g to finish executing { reprap.SelectTool(gb.MachineState().newToolNumber, simulationMode != 0); - UpdateCurrentUserPosition(); // get the actual position of the new tool + UpdateCurrentUserPosition(); // get the actual position of the new tool gb.AdvanceState(); if (AllAxesAreHomed()) diff --git a/src/Networking/W5500Ethernet/W5500Socket.cpp b/src/Networking/W5500Ethernet/W5500Socket.cpp index 0f73b0ef..e5bc15c3 100644 --- a/src/Networking/W5500Ethernet/W5500Socket.cpp +++ b/src/Networking/W5500Ethernet/W5500Socket.cpp @@ -247,11 +247,11 @@ void W5500Socket::Poll() noexcept } } -// Try to receive more incoming data from the socket. The mutex is alrady owned. +// Try to receive more incoming data from the socket. The mutex is already owned. void W5500Socket::ReceiveData() noexcept { const uint16_t len = getSn_RX_RSR(socketNum); - if (len != 0) + if (len != 0 && len <= NetworkBuffer::bufferSize) { // debugPrintf("%u available\n", len); NetworkBuffer * const lastBuffer = NetworkBuffer::FindLast(receivedData); diff --git a/src/Version.h b/src/Version.h index 28c913a9..6a827890 100644 --- a/src/Version.h +++ b/src/Version.h @@ -10,7 +10,7 @@ #ifndef VERSION -# define MAIN_VERSION "3.0RC1" +# define MAIN_VERSION "3.0RC1+1" # ifdef USE_CAN0 # define VERSION_SUFFIX " (CAN0)" # else @@ -20,7 +20,7 @@ #endif #ifndef DATE -# define DATE "2019-12-16b8" +# define DATE "2019-12-21b1" #endif #define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman, printm3d" -- cgit v1.2.3