From 99b6a132bcf5ccf54215ef6962eea3e199ea4c0d Mon Sep 17 00:00:00 2001 From: chgi Date: Thu, 30 Jan 2020 18:18:45 +0900 Subject: [PATCH] Fix G60/G61 slots > 8 and compile error (#16715) --- Marlin/src/gcode/feature/pause/G60.cpp | 2 +- Marlin/src/gcode/feature/pause/G61.cpp | 4 ++-- Marlin/src/module/motion.cpp | 2 +- Marlin/src/module/motion.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/gcode/feature/pause/G60.cpp b/Marlin/src/gcode/feature/pause/G60.cpp index 94b73cd7d9..a0d099ad69 100644 --- a/Marlin/src/gcode/feature/pause/G60.cpp +++ b/Marlin/src/gcode/feature/pause/G60.cpp @@ -45,7 +45,7 @@ void GcodeSuite::G60() { } stored_position[slot] = current_position; - SBI(saved_slots, slot); + SBI(saved_slots[slot >> 3], slot & 0b00000111); #if ENABLED(SAVED_POSITIONS_DEBUG) const xyze_pos_t &pos = stored_position[slot]; diff --git a/Marlin/src/gcode/feature/pause/G61.cpp b/Marlin/src/gcode/feature/pause/G61.cpp index 5d854dfab4..d531c15c80 100644 --- a/Marlin/src/gcode/feature/pause/G61.cpp +++ b/Marlin/src/gcode/feature/pause/G61.cpp @@ -25,7 +25,7 @@ #if SAVED_POSITIONS #include "../../../core/language.h" -#include "../../module/planner.h" +#include "../../../module/planner.h" #include "../../gcode.h" #include "../../../module/motion.h" @@ -48,7 +48,7 @@ void GcodeSuite::G61(void) { #endif // No saved position? No axes being restored? - if (!TEST(saved_slots, slot) || !parser.seen("XYZ")) return; + if (!TEST(saved_slots[slot >> 3], slot & 0b00000111) || !parser.seen("XYZ")) return; // Apply any given feedrate over 0.0 const float fr = parser.linearval('F'); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 6dbf940add..50092406c5 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -111,7 +111,7 @@ xyze_pos_t destination; // {0} // G60/G61 Position Save and Return #if SAVED_POSITIONS - uint8_t saved_slots; + uint8_t saved_slots[(SAVED_POSITIONS + 7) >> 3]; xyz_pos_t stored_position[SAVED_POSITIONS]; #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index a30573e797..eafa5ca849 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -67,7 +67,7 @@ extern xyze_pos_t current_position, // High-level current tool position // G60/G61 Position Save and Return #if SAVED_POSITIONS - extern uint8_t saved_slots; + extern uint8_t saved_slots[(SAVED_POSITIONS + 7) >> 3]; extern xyz_pos_t stored_position[SAVED_POSITIONS]; #endif