From 79772219aeb0531cccfa7eb73cea246ceb6dbb6f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 4 Nov 2017 21:01:41 -0500 Subject: [PATCH 1/6] Fix Fan Multiplexer init --- Marlin/src/Marlin.cpp | 4 +++ Marlin/src/feature/fanmux.cpp | 55 ++++++++++++++++++++++++++++++ Marlin/src/feature/fanmux.h | 33 ++++++++++++++++++ Marlin/src/gcode/calibrate/G33.cpp | 5 ++- Marlin/src/module/motion.cpp | 4 --- Marlin/src/module/tool_change.cpp | 28 +++------------ 6 files changed, 100 insertions(+), 29 deletions(-) create mode 100644 Marlin/src/feature/fanmux.cpp create mode 100644 Marlin/src/feature/fanmux.h diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 47fa92db4..e09bd9d5e 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -138,6 +138,10 @@ #include "feature/caselight.h" #endif +#if HAS_FANMUX + #include "feature/fanmux.h" +#endif + #if (ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) #include "module/tool_change.h" #endif diff --git a/Marlin/src/feature/fanmux.cpp b/Marlin/src/feature/fanmux.cpp new file mode 100644 index 000000000..3457fe49b --- /dev/null +++ b/Marlin/src/feature/fanmux.cpp @@ -0,0 +1,55 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 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 . + * + */ + +/** + * feature/pause.cpp - Pause feature support functions + * This may be combined with related G-codes if features are consolidated. + */ + +#include "../inc/MarlinConfig.h" + +#if HAS_FANMUX + +#include "fanmux.h" + +void fanmux_switch(const uint8_t e) { + WRITE(FANMUX0_PIN, TEST(e, 0) ? HIGH : LOW); + #if PIN_EXISTS(FANMUX1) + WRITE(FANMUX1_PIN, TEST(e, 1) ? HIGH : LOW); + #if PIN_EXISTS(FANMUX2) + WRITE(FANMUX2, TEST(e, 2) ? HIGH : LOW); + #endif + #endif +} + +void fanmux_init(void) { + SET_OUTPUT(FANMUX0_PIN); + #if PIN_EXISTS(FANMUX1) + SET_OUTPUT(FANMUX1_PIN); + #if PIN_EXISTS(FANMUX2) + SET_OUTPUT(FANMUX2_PIN); + #endif + #endif + fanmux_switch(0); +} + +#endif // HAS_FANMUX diff --git a/Marlin/src/feature/fanmux.h b/Marlin/src/feature/fanmux.h new file mode 100644 index 000000000..252487614 --- /dev/null +++ b/Marlin/src/feature/fanmux.h @@ -0,0 +1,33 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 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 . + * + */ + +/** + * feature/fanmux.h - Cooling Fan Multiplexer support functions + */ + +#ifndef _FANMUX_H_ +#define _FANMUX_H_ + +extern void fanmux_switch(const uint8_t e); +extern void fanmux_init(void); + +#endif // _FANMUX_H_ diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 9deab6998..037e133d9 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -30,9 +30,12 @@ #include "../../module/motion.h" #include "../../module/stepper.h" #include "../../module/endstops.h" -#include "../../module/tool_change.h" #include "../../lcd/ultralcd.h" +#if HOTENDS > 1 + #include "../../module/tool_change.h" +#endif + #if HAS_LEVELING #include "../../feature/bedlevel/bedlevel.h" #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index b49486bf7..03aecfe7b 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -39,10 +39,6 @@ #include "../lcd/ultralcd.h" #endif -// #if ENABLED(DUAL_X_CARRIAGE) -// #include "tool_change.h" -// #endif - #if HAS_BED_PROBE #include "probe.h" #endif diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 8d12a82b9..0bcedc80c 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -50,6 +50,10 @@ #include "../feature/bedlevel/bedlevel.h" #endif +#if HAS_FANMUX + #include "../feature/fanmux.h" +#endif + #if ENABLED(SWITCHING_EXTRUDER) #if EXTRUDERS > 3 @@ -109,30 +113,6 @@ #endif // PARKING_EXTRUDER -#if HAS_FANMUX - - void fanmux_switch(const uint8_t e) { - WRITE(FANMUX0_PIN, TEST(e, 0) ? HIGH : LOW); - #if PIN_EXISTS(FANMUX1) - WRITE(FANMUX1_PIN, TEST(e, 1) ? HIGH : LOW); - #if PIN_EXISTS(FANMUX2) - WRITE(FANMUX2, TEST(e, 2) ? HIGH : LOW); - #endif - #endif - } - - FORCE_INLINE void fanmux_init(void){ - SET_OUTPUT(FANMUX0_PIN); - #if PIN_EXISTS(FANMUX1) - SET_OUTPUT(FANMUX1_PIN); - #if PIN_EXISTS(FANMUX2) - SET_OUTPUT(FANMUX2_PIN); - #endif - #endif - fanmux_switch(0); - } - -#endif // HAS_FANMUX inline void invalid_extruder_error(const uint8_t e) { SERIAL_ECHO_START(); From d6aa127c76bda395d773f45bde57ffd849899cd7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 4 Nov 2017 15:26:29 -0500 Subject: [PATCH 2/6] Remove I2CPEM workspace offset --- Marlin/src/feature/I2CPositionEncoder.h | 17 ++--------------- Marlin/src/gcode/geometry/G92.cpp | 5 ----- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/Marlin/src/feature/I2CPositionEncoder.h b/Marlin/src/feature/I2CPositionEncoder.h index 436b0ea2a..745486a1f 100644 --- a/Marlin/src/feature/I2CPositionEncoder.h +++ b/Marlin/src/feature/I2CPositionEncoder.h @@ -124,10 +124,7 @@ class I2CPositionEncoder { invert = false, ec = true; - float axisOffset = 0; - - int32_t axisOffsetTicks = 0, - zeroOffset = 0, + int32_t zeroOffset = 0, lastPosition = 0, position; @@ -165,7 +162,7 @@ class I2CPositionEncoder { } FORCE_INLINE float get_position_mm() { return mm_from_count(get_position()); } - FORCE_INLINE int32_t get_position() { return get_raw_count() - zeroOffset - axisOffsetTicks; } + FORCE_INLINE int32_t get_position() { return get_raw_count() - zeroOffset; } int32_t get_axis_error_steps(const bool report); float get_axis_error_mm(const bool report); @@ -216,16 +213,6 @@ class I2CPositionEncoder { FORCE_INLINE int get_stepper_ticks() { return stepperTicks; } FORCE_INLINE void set_stepper_ticks(const int ticks) { stepperTicks = ticks; } - - FORCE_INLINE float get_axis_offset() { return axisOffset; } - FORCE_INLINE void set_axis_offset(const float newOffset) { - axisOffset = newOffset; - axisOffsetTicks = int32_t(axisOffset * get_encoder_ticks_mm()); - } - - FORCE_INLINE void set_current_position(const float newPositionMm) { - set_axis_offset(get_position_mm() - newPositionMm + axisOffset); - } }; class I2CPositionEncodersMgr { diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index ae2d92962..65d860dca 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -55,11 +55,6 @@ void GcodeSuite::G92() { #if HAS_POSITION_SHIFT position_shift[i] += v - p; // Offset the coordinate space update_software_endstops((AxisEnum)i); - - #if ENABLED(I2C_POSITION_ENCODERS) - I2CPEM.encoders[I2CPEM.idx_from_axis((AxisEnum)i)].set_axis_offset(position_shift[i]); - #endif - #endif } #endif From c07bbd4154e31736d28dce1d09ba43c1cd17ce54 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 4 Nov 2017 15:34:24 -0500 Subject: [PATCH 3/6] Prettify some EEPROM code --- Marlin/src/module/configuration_store.cpp | 67 +++++++++++++++++++++-- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 2c2079224..2a7ea5397 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -292,7 +292,7 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(ver); // invalidate data first EEPROM_SKIP(working_crc); // Skip the checksum slot - working_crc = 0; // clear before first "real data" + working_crc = 0; // Init to 0. Accumulated by EEPROM_READ const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ; EEPROM_WRITE(esteppers); @@ -699,6 +699,10 @@ void MarlinSettings::postprocess() { uint8_t esteppers; EEPROM_READ(esteppers); + // + // Planner Motion + // + // Get only the number of E stepper parameters previously stored // Any steppers added later are set to their defaults const float def1[] = DEFAULT_AXIS_STEPS_PER_UNIT, def2[] = DEFAULT_MAX_FEEDRATE; @@ -722,6 +726,10 @@ void MarlinSettings::postprocess() { EEPROM_READ(planner.min_segment_time_us); EEPROM_READ(planner.max_jerk); + // + // Home Offset (M206) + // + #if !HAS_HOME_OFFSET float home_offset[XYZ]; #endif @@ -733,6 +741,10 @@ void MarlinSettings::postprocess() { home_offset[Z_AXIS] -= DELTA_HEIGHT; #endif + // + // Hotend Offsets, if any + // + #if HOTENDS > 1 // Skip hotend 0 which must be 0 for (uint8_t e = 1; e < HOTENDS; e++) @@ -816,6 +828,10 @@ void MarlinSettings::postprocess() { for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy); } + // + // Unified Bed Leveling active state + // + #if ENABLED(AUTO_BED_LEVELING_UBL) EEPROM_READ(planner.leveling_active); EEPROM_READ(ubl.storage_slot); @@ -825,6 +841,10 @@ void MarlinSettings::postprocess() { EEPROM_READ(dummyui8); #endif // AUTO_BED_LEVELING_UBL + // + // DELTA Geometry or Dual Endstops offsets + // + #if ENABLED(DELTA) EEPROM_READ(delta_endstop_adj); // 3 floats EEPROM_READ(delta_radius); // 1 float @@ -861,19 +881,27 @@ void MarlinSettings::postprocess() { #endif + // + // LCD Preheat settings + // + #if DISABLED(ULTIPANEL) int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; #endif - EEPROM_READ(lcd_preheat_hotend_temp); - EEPROM_READ(lcd_preheat_bed_temp); - EEPROM_READ(lcd_preheat_fan_speed); + EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats + EEPROM_READ(lcd_preheat_bed_temp); // 2 floats + EEPROM_READ(lcd_preheat_fan_speed); // 2 floats //EEPROM_ASSERT( // WITHIN(lcd_preheat_fan_speed, 0, 255), // "lcd_preheat_fan_speed out of range" //); + // + // Hotend PID + // + #if ENABLED(PIDTEMP) for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) { EEPROM_READ(dummy); // Kp @@ -897,11 +925,19 @@ void MarlinSettings::postprocess() { for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc #endif // !PIDTEMP + // + // PID Extrusion Scaling + // + #if DISABLED(PID_EXTRUSION_SCALING) int lpq_len; #endif EEPROM_READ(lpq_len); + // + // Heated Bed PID + // + #if ENABLED(PIDTEMPBED) EEPROM_READ(dummy); // bedKp if (dummy != DUMMY_PID_VALUE) { @@ -913,11 +949,19 @@ void MarlinSettings::postprocess() { for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd #endif + // + // LCD Contrast + // + #if !HAS_LCD_CONTRAST uint16_t lcd_contrast; #endif EEPROM_READ(lcd_contrast); + // + // Firmware Retraction + // + #if ENABLED(FWRETRACT) EEPROM_READ(fwretract.autoretract_enabled); EEPROM_READ(fwretract.retract_length); @@ -933,13 +977,20 @@ void MarlinSettings::postprocess() { for (uint8_t q=8; q--;) EEPROM_READ(dummy); #endif - EEPROM_READ(parser.volumetric_enabled); + // + // Volumetric & Filament Size + // + EEPROM_READ(parser.volumetric_enabled); for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) { EEPROM_READ(dummy); if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy; } + // + // TMC2130 Stepper Current + // + uint16_t val; #if ENABLED(HAVE_TMC2130) EEPROM_READ(val); @@ -987,7 +1038,7 @@ void MarlinSettings::postprocess() { stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER); #endif #else - for (uint8_t q = 0; q < 11; q++) EEPROM_READ(val); + for (uint8_t q = 11; q--;) EEPROM_READ(val); #endif // @@ -1002,6 +1053,10 @@ void MarlinSettings::postprocess() { EEPROM_READ(dummy); #endif + // + // Motor Current PWM + // + #if HAS_MOTOR_CURRENT_PWM for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]); #else From a22434508f98eead87560536aaec331cd8293a5a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 4 Nov 2017 18:19:14 -0500 Subject: [PATCH 4/6] Match tweaks to G33 from 1.1 --- Marlin/src/gcode/calibrate/G33.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 037e133d9..3cf09fea5 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -163,11 +163,13 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, if (!_0p_calibration) { if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center - #if ENABLED(PROBE_MANUALLY) - z_at_pt[CEN] += lcd_probe_pt(0, 0); - #else - z_at_pt[CEN] += probe_pt(dx, dy, stow_after_each, 1, false); - #endif + z_at_pt[CEN] += + #if ENABLED(PROBE_MANUALLY) + lcd_probe_pt(0, 0) + #else + probe_pt(dx, dy, stow_after_each, 1, false) + #endif + ; } if (_7p_calibration) { // probe extra center points @@ -176,11 +178,13 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, I_LOOP_CAL_PT(axis, start, steps) { const float a = RADIANS(210 + (360 / NPP) * (axis - 1)), r = delta_calibration_radius * 0.1; - #if ENABLED(PROBE_MANUALLY) - z_at_pt[CEN] += lcd_probe_pt(cos(a) * r, sin(a) * r); - #else - z_at_pt[CEN] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1); - #endif + z_at_pt[CEN] += + #if ENABLED(PROBE_MANUALLY) + lcd_probe_pt(cos(a) * r, sin(a) * r) + #else + probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1) + #endif + ; } z_at_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points); } From 1b42fba39b07d3b632e6313bc39dd8d7ac2ecea6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 4 Nov 2017 15:25:12 -0500 Subject: [PATCH 5/6] Add CNC_COORDINATE_SYSTEMS to configs --- Marlin/Configuration_adv.h | 8 ++++++++ Marlin/src/config/default/Configuration_adv.h | 8 ++++++++ .../config/examples/AlephObjects/TAZ4/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Anet/A6/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Anet/A8/Configuration_adv.h | 8 ++++++++ .../src/config/examples/Azteeg/X5GT/Configuration_adv.h | 8 ++++++++ .../src/config/examples/BQ/Hephestos/Configuration_adv.h | 8 ++++++++ .../config/examples/BQ/Hephestos_2/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Cartesio/Configuration_adv.h | 8 ++++++++ .../config/examples/Creality/CR-10/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Felix/Configuration_adv.h | 8 ++++++++ .../examples/FolgerTech/i3-2020/Configuration_adv.h | 8 ++++++++ .../config/examples/Infitary/i3-M508/Configuration_adv.h | 8 ++++++++ .../src/config/examples/Malyan/M150/Configuration_adv.h | 8 ++++++++ .../examples/Micromake/C1/enhanced/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/RigidBot/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/SCARA/Configuration_adv.h | 8 ++++++++ .../src/config/examples/Sanguinololu/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/TinyBoy2/Configuration_adv.h | 8 ++++++++ .../examples/UltiMachine/Archim2/Configuration_adv.h | 8 ++++++++ .../config/examples/Velleman/K8200/Configuration_adv.h | 8 ++++++++ .../config/examples/Velleman/K8400/Configuration_adv.h | 8 ++++++++ .../delta/FLSUN/auto_calibrate/Configuration_adv.h | 8 ++++++++ .../examples/delta/FLSUN/kossel_mini/Configuration_adv.h | 8 ++++++++ .../src/config/examples/delta/generic/Configuration_adv.h | 8 ++++++++ .../config/examples/delta/kossel_mini/Configuration_adv.h | 8 ++++++++ .../config/examples/delta/kossel_pro/Configuration_adv.h | 8 ++++++++ .../config/examples/delta/kossel_xl/Configuration_adv.h | 8 ++++++++ .../config/examples/gCreate/gMax1.5+/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/makibox/Configuration_adv.h | 8 ++++++++ .../src/config/examples/tvrrug/Round2/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/wt150/Configuration_adv.h | 8 ++++++++ 34 files changed, 272 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 0e6e916ac..00c2eaaac 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1257,6 +1257,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index cd2dc5635..15610cfd5 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -1280,6 +1280,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index eb37deb4d..faa60216a 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index 86850d67b..d2891c72d 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index 8a417c8a7..53efe7e7a 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h index de471f415..47310c809 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h @@ -1257,6 +1257,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index dc573d61e..2e0699afb 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 494842455..a1e0e6759 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -1276,6 +1276,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index dc573d61e..2e0699afb 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 2306a6209..c4bae3bfc 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index f8b771601..4c1ddb0f1 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index 74e781a4e..3a1a4a4ca 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 58501d267..5bea2c337 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -1280,6 +1280,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index d45472113..063f3556b 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 423629698..a9d2a46e1 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -1273,6 +1273,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index 0b1a8673b..008cd96e5 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -1283,6 +1283,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index 1de6157b0..406ac160a 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -1301,6 +1301,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index 32ada2d01..ad299e3cc 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index aca789cd1..0d8d73286 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 52b25333c..31c307d2b 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -1268,6 +1268,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index 0c68fc8fe..ef85e7721 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index df2389d7e..a78322f1d 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -1257,6 +1257,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index 4c2c53ee7..7be4e1060 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -1287,6 +1287,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index f785ccb82..4b1c3ee7f 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -1280,6 +1280,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index e4b363c69..4711cd4f8 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -1281,6 +1281,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index d3a6140ab..20ad42f11 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1281,6 +1281,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index d3a6140ab..20ad42f11 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -1281,6 +1281,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index d3a6140ab..20ad42f11 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -1281,6 +1281,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index 1821f3d5b..7854cf1bf 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -1286,6 +1286,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index dd312b7c7..af4b04f70 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -1281,6 +1281,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 6c9e0b9d3..730321399 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index 6f4717938..820fd604f 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index 700d973b8..0f3fc5f29 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -1279,6 +1279,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index d106758ec..931e1a2cb 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -1280,6 +1280,14 @@ //#define SPEED_POWER_MAX 100 // 0-100% #endif +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ From 1b40e9c46475a9f9c712eba5588c72256f7dd584 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 4 Nov 2017 16:36:41 -0500 Subject: [PATCH 6/6] Implement CNC_COORDINATE_SYSTEMS --- .travis.yml | 15 ++-- Marlin/src/gcode/gcode.cpp | 45 ++++++----- Marlin/src/gcode/gcode.h | 19 +++++ Marlin/src/gcode/geometry/G53-G59.cpp | 93 +++++++++++++++++++++++ Marlin/src/gcode/geometry/G92.cpp | 32 +++++++- Marlin/src/gcode/parser.cpp | 20 +++++ Marlin/src/gcode/parser.h | 5 ++ Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/inc/SanityCheck.h | 4 + Marlin/src/module/configuration_store.cpp | 40 +++++++++- 10 files changed, 242 insertions(+), 33 deletions(-) create mode 100644 Marlin/src/gcode/geometry/G53-G59.cpp diff --git a/.travis.yml b/.travis.yml index ea6aad9e6..b587df246 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,18 +59,14 @@ script: - opt_set TEMP_SENSOR_0 -2 - opt_set TEMP_SENSOR_1 1 - opt_set TEMP_SENSOR_BED 1 - - opt_enable PIDTEMPBED Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES + - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_LED - - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} - - # - # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, and DEBUG_LEVELING_FEATURE - # - - opt_enable AUTO_BED_LEVELING_LINEAR BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE + - opt_enable AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE - opt_enable_adv FWRETRACT MAX7219_DEBUG - opt_set ABL_GRID_POINTS_X 16 - opt_set ABL_GRID_POINTS_Y 16 + - opt_set_adv FANMUX0_PIN 53 - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # # Test a probeless build of AUTO_BED_LEVELING_UBL @@ -80,10 +76,9 @@ script: - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # - # ...and with a probe + # And with a probe... # - - opt_enable BLTOUCH - - opt_enable_adv BABYSTEP_ZPROBE_OFFSET + - opt_enable FIX_MOUNTED_PROBE - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # # Test a Sled Z Probe diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 57dee6015..75dc8f4b4 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -56,6 +56,11 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES; GcodeSuite::WorkspacePlane GcodeSuite::workspace_plane = PLANE_XY; #endif +#if ENABLED(CNC_COORDINATE_SYSTEMS) + int8_t GcodeSuite::active_coordinate_system = -1; // machine space + float GcodeSuite::coordinate_system[MAX_COORDINATE_SYSTEMS][XYZ]; +#endif + /** * Set target_extruder from the T parameter or the active_extruder * @@ -125,26 +130,11 @@ void GcodeSuite::dwell(millis_t time) { #endif /** - * Process a single command and dispatch it to its handler - * This is called from the main loop() + * Process the parsed command and dispatch it to its handler */ -void GcodeSuite::process_next_command() { - char * const current_command = command_queue[cmd_queue_index_r]; - - if (DEBUGGING(ECHO)) { - SERIAL_ECHO_START(); - SERIAL_ECHOLN(current_command); - #if ENABLED(M100_FREE_MEMORY_WATCHER) - SERIAL_ECHOPAIR("slot:", cmd_queue_index_r); - M100_dump_routine(" Command Queue:", (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue))); - #endif - } - +void GcodeSuite::process_parsed_command() { KEEPALIVE_STATE(IN_HANDLER); - // Parse the next command in the queue - parser.parse(current_command); - // Handle a known G, M, or T switch (parser.command_letter) { case 'G': switch (parser.codenum) { @@ -711,6 +701,27 @@ void GcodeSuite::process_next_command() { ok_to_send(); } +/** + * Process a single command and dispatch it to its handler + * This is called from the main loop() + */ +void GcodeSuite::process_next_command() { + char * const current_command = command_queue[cmd_queue_index_r]; + + if (DEBUGGING(ECHO)) { + SERIAL_ECHO_START(); + SERIAL_ECHOLN(current_command); + #if ENABLED(M100_FREE_MEMORY_WATCHER) + SERIAL_ECHOPAIR("slot:", cmd_queue_index_r); + M100_dump_routine(" Command Queue:", (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue))); + #endif + } + + // Parse the next command in the queue + parser.parse(current_command); + process_parsed_command(); +} + #if ENABLED(HOST_KEEPALIVE_FEATURE) /** diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 90d4c7f6e..c87a8edda 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -266,11 +266,19 @@ public: static WorkspacePlane workspace_plane; #endif + #if ENABLED(CNC_COORDINATE_SYSTEMS) + #define MAX_COORDINATE_SYSTEMS 9 + static int8_t active_coordinate_system; + static float coordinate_system[MAX_COORDINATE_SYSTEMS][XYZ]; + static bool select_coordinate_system(const int8_t _new); + #endif + static millis_t previous_cmd_ms; FORCE_INLINE static void refresh_cmd_timeout() { previous_cmd_ms = millis(); } static bool get_target_extruder_from_command(); static void get_destination_from_command(); + static void process_parsed_command(); static void process_next_command(); static FORCE_INLINE void home_all_axes() { G28(true); } @@ -383,6 +391,17 @@ private: static void G42(); #endif + #if ENABLED(CNC_COORDINATE_SYSTEMS) + bool select_coordinate_system(const int8_t _new); + static void G53(); + static void G54(); + static void G55(); + static void G56(); + static void G57(); + static void G58(); + static void G59(); + #endif + static void G92(); #if HAS_RESUME_CONTINUE diff --git a/Marlin/src/gcode/geometry/G53-G59.cpp b/Marlin/src/gcode/geometry/G53-G59.cpp new file mode 100644 index 000000000..149c50250 --- /dev/null +++ b/Marlin/src/gcode/geometry/G53-G59.cpp @@ -0,0 +1,93 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 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 . + * + */ + +#include "../gcode.h" +#include "../../module/motion.h" +//#include "../../module/stepper.h" + +#if ENABLED(CNC_COORDINATE_SYSTEMS) + + /** + * Select a coordinate system and update the current position. + * System index -1 is used to specify machine-native. + */ + bool GCodeSuite::select_coordinate_system(const int8_t _new) { + if (active_coordinate_system == _new) return false; + stepper.synchronize(); + float old_offset[XYZ] = { 0 }, new_offset[XYZ] = { 0 }; + if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1)) + COPY(old_offset, coordinate_system[active_coordinate_system]); + if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1)) + COPY(new_offset, coordinate_system[_new]); + active_coordinate_system = _new; + bool didXYZ = false; + LOOP_XYZ(i) { + const float diff = new_offset[i] - old_offset[i]; + if (diff) { + position_shift[i] += diff; + update_software_endstops((AxisEnum)i); + didXYZ = true; + } + } + if (didXYZ) SYNC_PLAN_POSITION_KINEMATIC(); + return true; + } + + /** + * In CNC G-code G53 is like a modifier + * It precedes a movement command (or other modifiers) on the same line. + * This is the first command to use parser.chain() to make this possible. + */ + void GCodeSuite::G53() { + // If this command has more following... + if (parser.chain()) { + const int8_t _system = active_coordinate_system; + active_coordinate_system = -1; + process_parsed_command(); + active_coordinate_system = _system; + } + } + + /** + * G54-G59.3: Select a new workspace + * + * A workspace is an XYZ offset to the machine native space. + * All workspaces default to 0,0,0 at start, or with EEPROM + * support they may be restored from a previous session. + * + * G92 is used to set the current workspace's offset. + */ + void G54_59(uint8_t subcode=0) { + const int8_t _space = parser.codenum - 54 + subcode; + if (gcode.select_coordinate_system(_space)) { + SERIAL_PROTOCOLLNPAIR("Select workspace ", _space); + report_current_position(); + } + } + void GCodeSuite::G54() { G54_59(); } + void GCodeSuite::G55() { G54_59(); } + void GCodeSuite::G56() { G54_59(); } + void GCodeSuite::G57() { G54_59(); } + void GCodeSuite::G58() { G54_59(); } + void GCodeSuite::G59() { G54_59(parser.subcode); } + +#endif // CNC_COORDINATE_SYSTEMS diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index 65d860dca..89fa12015 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -37,7 +37,30 @@ void GcodeSuite::G92() { if (!didE) stepper.synchronize(); - LOOP_XYZE(i) { + #if ENABLED(CNC_COORDINATE_SYSTEMS) + switch (parser.subcode) { + case 1: + // Zero the G92 values and restore current position + #if !IS_SCARA + LOOP_XYZ(i) { + const float v = position_shift[i]; + if (v) { + position_shift[i] = 0; + update_software_endstops((AxisEnum)i); + } + } + #endif // Not SCARA + return; + } + #endif + + #if ENABLED(CNC_COORDINATE_SYSTEMS) + #define IS_G92_0 (parser.subcode == 0) + #else + #define IS_G92_0 true + #endif + + if (IS_G92_0) LOOP_XYZE(i) { if (parser.seenval(axis_codes[i])) { #if IS_SCARA current_position[i] = parser.value_axis_units((AxisEnum)i); @@ -60,6 +83,13 @@ void GcodeSuite::G92() { #endif } } + + #if ENABLED(CNC_COORDINATE_SYSTEMS) + // Apply workspace offset to the active coordinate system + if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1)) + COPY(coordinate_system[active_coordinate_system], position_shift); + #endif + if (didXYZ) SYNC_PLAN_POSITION_KINEMATIC(); else if (didE) diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 503b5681d..06dd8ffbd 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -233,6 +233,26 @@ void GCodeParser::parse(char *p) { } } +#if ENABLED(CNC_COORDINATE_SYSTEMS) + + // Parse the next parameter as a new command + bool GCodeParser::chain() { + #if ENABLED(FASTER_GCODE_PARSER) + char *next_command = command_ptr; + if (next_command) { + while (*next_command && *next_command != ' ') ++next_command; + while (*next_command == ' ') ++next_command; + if (!*next_command) next_command = NULL; + } + #else + const char *next_command = command_args; + #endif + if (next_command) parse(next_command); + return !!next_command; + } + +#endif // CNC_COORDINATE_SYSTEMS + void GCodeParser::unknown_command_error() { SERIAL_ECHO_START(); SERIAL_ECHOPAIR(MSG_UNKNOWN_COMMAND, command_ptr); diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index d872b21d8..922e5829e 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -156,6 +156,11 @@ public: // This uses 54 bytes of SRAM to speed up seen/value static void parse(char * p); + #if ENABLED(CNC_COORDINATE_SYSTEMS) + // Parse the next parameter as a new command + static bool chain(); + #endif + // The code value pointer was set FORCE_INLINE static bool has_value() { return value_ptr != NULL; } diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index dbbb929b5..afa2ddcec 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1112,7 +1112,7 @@ #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) // Add commands that need sub-codes to this list -#define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET) +#define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET) || ENABLED(CNC_COORDINATE_SYSTEMS) // MESH_BED_LEVELING overrides PROBE_MANUALLY #if ENABLED(MESH_BED_LEVELING) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index fec4223a2..5ce74c3f3 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1450,6 +1450,10 @@ static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has to static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements."); static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements."); +#if ENABLED(CNC_COORDINATE_SYSTEMS) && ENABLED(NO_WORKSPACE_OFFSETS) + #error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS." +#endif + #include "../HAL/HAL_SanityCheck.h" // get CPU specific checks #endif // _SANITYCHECK_H_ diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 2a7ea5397..04f400328 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -36,13 +36,13 @@ * */ -#define EEPROM_VERSION "V43" +#define EEPROM_VERSION "V44" // Change EEPROM version if these are changed: #define EEPROM_OFFSET 100 /** - * V43 EEPROM Layout: + * V44 EEPROM Layout: * * 100 Version (char x4) * 104 EEPROM CRC16 (uint16_t) @@ -162,8 +162,11 @@ * 588 M907 Z Stepper Z current (uint32_t) * 592 M907 E Stepper E current (uint32_t) * - * 596 Minimum end-point - * 1917 (596 + 36 + 9 + 288 + 988) Maximum end-point + * CNC_COORDINATE_SYSTEMS 108 bytes + * 596 G54-G59.3 coordinate_system (float x 27) + * + * 704 Minimum end-point + * 2025 (704 + 36 + 9 + 288 + 988) Maximum end-point * * ======================================================================== * meshes_begin (between max and min end-point, directly above) @@ -207,6 +210,10 @@ MarlinSettings settings; float new_z_fade_height; #endif +#if ENABLED(CNC_COORDINATE_SYSTEMS) + bool position_changed; +#endif + /** * Post-process after Retrieve or Reset */ @@ -255,6 +262,13 @@ void MarlinSettings::postprocess() { #if ENABLED(FWRETRACT) fwretract.refresh_autoretract(); #endif + + #if ENABLED(CNC_COORDINATE_SYSTEMS) + if (position_changed) { + report_current_position(); + position_changed = false; + } + #endif } #if ENABLED(EEPROM_SETTINGS) @@ -630,6 +644,13 @@ void MarlinSettings::postprocess() { for (uint8_t q = 3; q--;) EEPROM_WRITE(dummyui32); #endif + #if ENABLED(CNC_COORDINATE_SYSTEMS) + EEPROM_WRITE(coordinate_system); // 27 floats + #else + dummy = 0.0f; + for (uint8_t q = 27; q--;) EEPROM_WRITE(dummy); + #endif + if (!eeprom_error) { #if ENABLED(EEPROM_CHITCHAT) const int eeprom_size = eeprom_index; @@ -1064,6 +1085,17 @@ void MarlinSettings::postprocess() { for (uint8_t q = 3; q--;) EEPROM_READ(dummyui32); #endif + // + // CNC Coordinate System + // + + #if ENABLED(CNC_COORDINATE_SYSTEMS) + position_changed = gcode.select_coordinate_system(-1); // Go back to machine space + EEPROM_READ(gcode.coordinate_system); // 27 floats + #else + for (uint8_t q = 27; q--;) EEPROM_READ(dummy); + #endif + if (working_crc == stored_crc) { postprocess(); #if ENABLED(EEPROM_CHITCHAT)