Fix G60/G61 slots > 8 and compile error (#16715)

This commit is contained in:
chgi 2020-01-30 18:18:45 +09:00 committed by GitHub
parent e6a675e6ec
commit 99b6a132bc
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -45,7 +45,7 @@ void GcodeSuite::G60() {
} }
stored_position[slot] = current_position; stored_position[slot] = current_position;
SBI(saved_slots, slot); SBI(saved_slots[slot >> 3], slot & 0b00000111);
#if ENABLED(SAVED_POSITIONS_DEBUG) #if ENABLED(SAVED_POSITIONS_DEBUG)
const xyze_pos_t &pos = stored_position[slot]; const xyze_pos_t &pos = stored_position[slot];

View file

@ -25,7 +25,7 @@
#if SAVED_POSITIONS #if SAVED_POSITIONS
#include "../../../core/language.h" #include "../../../core/language.h"
#include "../../module/planner.h" #include "../../../module/planner.h"
#include "../../gcode.h" #include "../../gcode.h"
#include "../../../module/motion.h" #include "../../../module/motion.h"
@ -48,7 +48,7 @@ void GcodeSuite::G61(void) {
#endif #endif
// No saved position? No axes being restored? // 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 // Apply any given feedrate over 0.0
const float fr = parser.linearval('F'); const float fr = parser.linearval('F');

View file

@ -111,7 +111,7 @@ xyze_pos_t destination; // {0}
// G60/G61 Position Save and Return // G60/G61 Position Save and Return
#if SAVED_POSITIONS #if SAVED_POSITIONS
uint8_t saved_slots; uint8_t saved_slots[(SAVED_POSITIONS + 7) >> 3];
xyz_pos_t stored_position[SAVED_POSITIONS]; xyz_pos_t stored_position[SAVED_POSITIONS];
#endif #endif

View file

@ -67,7 +67,7 @@ extern xyze_pos_t current_position, // High-level current tool position
// G60/G61 Position Save and Return // G60/G61 Position Save and Return
#if SAVED_POSITIONS #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]; extern xyz_pos_t stored_position[SAVED_POSITIONS];
#endif #endif