Skip to content

Commit

Permalink
…etc…
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 18, 2024
1 parent f8f590f commit 570ec1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/gcode/feature/pause/G60.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ void GcodeSuite::G60() {
const bool seenQ = parser.seenval('Q');
const uint8_t slot = seenQ ? parser.value_byte() : parser.byteval('S');

if (seenQ) return G61(slot);

if (slot >= SAVED_POSITIONS) {
SERIAL_ERROR_MSG(STR_INVALID_POS_SLOT STRINGIFY(SAVED_POSITIONS));
return;
}

if (seenQ) return G61(slot);

stored_position[slot] = current_position;
SBI(saved_slots[slot >> 3], slot & 0x07);

Expand Down
13 changes: 8 additions & 5 deletions Marlin/src/gcode/feature/pause/G61.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void GcodeSuite::G61(int8_t slot/*=-1*/) {
if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr);

// No XYZ...E parameters, move to stored position

float epos = stored_position[slot].e;
if (!parser.seen_axis()) {
DEBUG_ECHOLNPGM(STR_RESTORING_POS " (all axes)");
Expand All @@ -86,28 +87,30 @@ void GcodeSuite::G61(int8_t slot/*=-1*/) {
return;
}

// Any axes specified,
// With XYZ...E return specified axes + optional offset

DEBUG_ECHOPGM(STR_RESTORING_POS " S", slot);

if (parser.seen(STR_AXES_MAIN)) {
DEBUG_ECHOPGM(STR_RESTORING_POS " S", slot);
destination = current_position;
LOOP_NUM_AXES(i) {
if (parser.seen(AXIS_CHAR(i))) {
destination[i] = stored_position[slot][i] + parser.value_axis_units((AxisEnum)i);
DEBUG_ECHO(C(' '), C(AXIS_CHAR(i)), p_float_t(destination[i], 2));
}
}
DEBUG_EOL();
// Move to the saved position
prepare_line_to_destination();
}

#if HAS_EXTRUDERS
if (parser.seen('E')) {
epos += parser.value_axis_units(E_AXIS);
DEBUG_ECHOLNPGM(STR_RESTORING_POS " S", slot, " E", current_position.e, "=>", epos);
DEBUG_ECHOPGM(" E", epos);
SYNC_E(epos);
}
#endif

DEBUG_EOL();
}

#endif // SAVED_POSITIONS

0 comments on commit 570ec1f

Please sign in to comment.