-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Marlin 3D Printer Firmware | ||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | ||
* | ||
* Based on Sprinter and grbl. | ||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "../../../inc/MarlinConfig.h" | ||
|
||
#if SAVED_POSITIONS | ||
|
||
#include "../../../core/language.h" | ||
#include "../../gcode.h" | ||
#include "../../../module/motion.h" | ||
|
||
#define DEBUG_OUT ENABLED(SAVED_POSITIONS_DEBUG) | ||
#include "../../../core/debug_out.h" | ||
|
||
/** | ||
* G60: Save current position | ||
* | ||
* S<slot> - Memory slot # (0-based) to save into (default 0) | ||
*/ | ||
void GcodeSuite::G60() { | ||
const uint8_t slot = parser.byteval('S'); | ||
|
||
if (slot >= SAVED_POSITIONS) { | ||
SERIAL_ERROR_MSG(MSG_INVALID_POS_SLOT STRINGIFY(SAVED_POSITIONS)); | ||
return; | ||
} | ||
|
||
stored_position[slot] = current_position; | ||
SBI(saved_slots, slot); | ||
|
||
#if ENABLED(SAVED_POSITIONS_DEBUG) | ||
const xyze_pos_t &pos = stored_position[slot]; | ||
DEBUG_ECHOPAIR_F(MSG_SAVED_POS " S", slot); | ||
DEBUG_ECHOPAIR_F(" : X", pos.x); | ||
DEBUG_ECHOPAIR_F_P(SP_Y_STR, pos.y); | ||
DEBUG_ECHOLNPAIR_F_P(SP_Z_STR, pos.z); | ||
#endif | ||
} | ||
|
||
#endif // SAVED_POSITIONS |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* Marlin 3D Printer Firmware | ||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | ||
* | ||
* Based on Sprinter and grbl. | ||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "../../../inc/MarlinConfig.h" | ||
|
||
#if SAVED_POSITIONS | ||
|
||
#include "../../../core/language.h" | ||
#include "../../module/planner.h" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
#include "../../gcode.h" | ||
#include "../../../module/motion.h" | ||
|
||
/** | ||
* G61: Return to saved position | ||
* | ||
* F<rate> - Feedrate (optional) for the move back. | ||
* S<slot> - Slot # (0-based) to restore from (default 0). | ||
* X Y Z - Axes to restore. At least one is required. | ||
*/ | ||
void GcodeSuite::G61(void) { | ||
|
||
const uint8_t slot = parser.byteval('S'); | ||
|
||
#if SAVED_POSITIONS < 256 | ||
if (slot >= SAVED_POSITIONS) { | ||
SERIAL_ERROR_MSG(MSG_INVALID_POS_SLOT STRINGIFY(SAVED_POSITIONS)); | ||
return; | ||
} | ||
#endif | ||
|
||
// No saved position? No axes being restored? | ||
if (!TEST(saved_slots, slot) || !parser.seen("XYZ")) return; | ||
|
||
// Apply any given feedrate over 0.0 | ||
const float fr = parser.linearval('F'); | ||
if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr); | ||
|
||
SERIAL_ECHOPAIR(MSG_RESTORING_POS " S", int(slot)); | ||
LOOP_XYZ(i) { | ||
destination[i] = parser.seen(axis_codes[i]) | ||
? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i) | ||
: current_position[i]; | ||
SERIAL_CHAR(' ', axis_codes[i]); | ||
SERIAL_ECHO_F(destination[i]); | ||
} | ||
SERIAL_EOL(); | ||
|
||
// Move to the saved position | ||
prepare_move_to_destination(); | ||
} | ||
|
||
#endif // SAVED_POSITIONS |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,19 +314,27 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { | |
#endif | ||
|
||
#if ENABLED(CNC_COORDINATE_SYSTEMS) | ||
case 53: G53(); break; | ||
case 54: G54(); break; | ||
case 55: G55(); break; | ||
case 56: G56(); break; | ||
case 57: G57(); break; | ||
case 58: G58(); break; | ||
case 59: G59(); break; | ||
case 53: G53(); break; // G53: (prefix) Apply native workspace | ||
case 54: G54(); break; // G54: Switch to Workspace 1 | ||
case 55: G55(); break; // G55: Switch to Workspace 2 | ||
case 56: G56(); break; // G56: Switch to Workspace 3 | ||
case 57: G57(); break; // G57: Switch to Workspace 4 | ||
case 58: G58(); break; // G58: Switch to Workspace 5 | ||
case 59: G59(); break; // G59.0 - G59.3: Switch to Workspace 6-9 | ||
#endif | ||
|
||
#if SAVED_POSITIONS | ||
case 60: G60(); break; // G60: save current position | ||
case 61: G61(); break; // G61: Apply/restore saved coordinates. | ||
#endif | ||
|
||
#if ENABLED(PROBE_TEMP_COMPENSATION) | ||
case 76: G76(); break; // G76: Calibrate first layer compensation values | ||
#endif | ||
|
||
case 60: G60(); break; // G60: save current position | ||
This comment has been minimized.
Sorry, something went wrong.
anlupat
|
||
case 61: G61(); break; // G61: Apply/restore saved coordinates. | ||
|
||
#if ENABLED(GCODE_MOTION_MODES) | ||
case 80: G80(); break; // G80: Reset the current motion mode | ||
#endif | ||
|
At row 28: planner.h position is incorrect here.
Correct would be:
#include "../../../module/planner.h"