diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-11-09 13:42:50 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-11-09 13:42:50 +0300 |
commit | 73ca782a035b42516227ba3137bada1531fd9614 (patch) | |
tree | 6c01fe65d728567d9bff281cd4ebd663ea77e1b4 | |
parent | d96a02b9d9f720ed83b992b498a3a1f1cd8d8d24 (diff) |
Fixed array overflow
-rw-r--r-- | src/Movement/RawMove.cpp | 4 | ||||
-rw-r--r-- | src/Movement/RawMove.h | 2 | ||||
-rw-r--r-- | src/Movement/StepTimer.cpp | 1 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/Movement/RawMove.cpp b/src/Movement/RawMove.cpp index 5b45bf25..5a3ed0ca 100644 --- a/src/Movement/RawMove.cpp +++ b/src/Movement/RawMove.cpp @@ -40,13 +40,13 @@ void RawMove::SetDefaults(size_t firstDriveToZero) noexcept #if SUPPORT_ASYNC_MOVES AxesBitmap MovementState::axesAndExtrudersMoved; // axes and extruders that are owned by any movement system -float MovementState::lastKnownMachinePositions[MaxAxes]; // the last stored machine position of the axes +float MovementState::lastKnownMachinePositions[MaxAxesPlusExtruders]; // the last stored machine position of the axes /*static*/ void MovementState::GlobalInit(size_t numVisibleAxes) noexcept { axesAndExtrudersMoved.Clear(); reprap.GetMove().GetKinematics().GetAssumedInitialPosition(numVisibleAxes, lastKnownMachinePositions); - for (size_t i = numVisibleAxes; i < MaxAxes; ++i) + for (size_t i = numVisibleAxes; i < MaxAxesPlusExtruders; ++i) { lastKnownMachinePositions[i] = 0.0; } diff --git a/src/Movement/RawMove.h b/src/Movement/RawMove.h index 29e99ff3..444b9c3f 100644 --- a/src/Movement/RawMove.h +++ b/src/Movement/RawMove.h @@ -195,7 +195,7 @@ private: ParameterLettersBitmap ownedAxisLetters; // cache of letters denoting user axes for which the corresponding machine axes for the current tool are definitely owned static AxesBitmap axesAndExtrudersMoved; // axes and extruders that are owned by any movement system - static float lastKnownMachinePositions[MaxAxes]; // the last stored machine position of the axes + static float lastKnownMachinePositions[MaxAxesPlusExtruders]; // the last stored machine position of the axes #endif }; diff --git a/src/Movement/StepTimer.cpp b/src/Movement/StepTimer.cpp index e14a8859..39548a3b 100644 --- a/src/Movement/StepTimer.cpp +++ b/src/Movement/StepTimer.cpp @@ -495,6 +495,7 @@ void StepTimer::CancelCallbackFromIsr() noexcept if (*ppst == this) { *ppst = this->next; // unlink this from the pending list + this->next = nullptr; break; } } |