Skip to content

Commit

Permalink
Fix G60/G61 slots > 8 and compile error (MarlinFirmware#16715)
Browse files Browse the repository at this point in the history
  • Loading branch information
chgi authored and GeminiServer committed Jan 31, 2020
1 parent b865aec commit 0b211d7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/pause/G60.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/feature/pause/G61.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0b211d7

Please sign in to comment.