diff --git a/Marlin/src/gcode/feature/fwretract/G10_G11.cpp b/Marlin/src/gcode/feature/fwretract/G10_G11.cpp index bba5bb18070a..a83280fc27ee 100644 --- a/Marlin/src/gcode/feature/fwretract/G10_G11.cpp +++ b/Marlin/src/gcode/feature/fwretract/G10_G11.cpp @@ -21,14 +21,16 @@ */ #include "../../../inc/MarlinConfig.h" -#if ENABLED(FWRETRACT) - #include "../../feature/fwretract.h" -#endif -#if ANY(FWRETRACT, CNC_COORDINATE_SYSTEMS) +#if ANY(FWRETRACT, CNC_COORDINATE_SYSTEMS, HAS_TOOL_LENGTH_COMPENSATION) #include "../../gcode.h" #include "../../../module/motion.h" + #if ENABLED(FWRETRACT) + #include "../../../feature/fwretract.h" + #endif + + /** * G10 * S# - Retract filament according to settings of M207 @@ -157,8 +159,6 @@ void GcodeSuite::G10() { #endif // ENABLED(CNC_COORDINATE_SYSTEMS) #endif // ANY(CNC_COORDINATE_SYSTEMS, HAS_TOOL_LENGTH_COMPENSATION) } -#endif // ANY(FWRETRACT, CNC_COORDINATE_SYSTEMS) - #if ENABLED(FWRETRACT) @@ -168,3 +168,5 @@ void GcodeSuite::G10() { void GcodeSuite::G11() { fwretract.retract(false); } #endif // FWRETRACT + +#endif // ANY(FWRETRACT, CNC_COORDINATE_SYSTEMS, HAS_TOOL_LENGTH_COMPENSATION) \ No newline at end of file diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 7f974afa0e4a..548deb6241ca 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -402,9 +402,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 6: G6(); break; // G6: Direct Stepper Move #endif - #if ENABLED(FWRETRACT) + #if ANY(FWRETRACT, CNC_COORDINATE_SYSTEMS, HAS_TOOL_LENGTH_COMPENSATION) case 10: G10(); break; // G10: Retract / Swap Retract - case 11: G11(); break; // G11: Recover / Swap Recover + #if ENABLED(FWRETRACT) + case 11: G11(); break; // G11: Recover / Swap Recover + #endif #endif #if ENABLED(NOZZLE_CLEAN_FEATURE) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 28b81d7eeb33..5cb73b2190ed 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -44,7 +44,7 @@ * G3 - CCW ARC * G4 - Dwell S or P * G5 - Cubic B-spline with XYZE destination and IJPQ offsets - * G10 - Set coordinate system and tool table. Retract filament according to settings of M207 (Requires FWRETRACT) + * G10 - Set coordinate system (Requires CNC_COORDINATE_SYSTEMS) and tool table (Requires DEFAULT_TOOL_CENTERPOINT_CONTROL). Retract filament according to settings of M207 (Requires FWRETRACT) * G11 - Retract recover filament according to settings of M208 (Requires FWRETRACT) * G12 - Clean tool (Requires NOZZLE_CLEAN_FEATURE) * G17 - Select Plane XY (Requires CNC_WORKSPACE_PLANES) @@ -64,8 +64,8 @@ * G35 - Read bed corners to help adjust bed screws: T (Requires ASSISTED_TRAMMING) * G38 - Probe in any direction using the Z_MIN_PROBE (Requires G38_PROBE_TARGET) * G42 - Coordinated move to a mesh point (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BLINEAR, or AUTO_BED_LEVELING_UBL) - * G43 - Tool length offset (Tool length compensation, tool centerpoint control) - * G49 - Cancel tool length offset (Cancel tool length compensation and tool centerpoint conrol) + * G43 - Tool length compensation, tool centerpoint control (Requires DEFAULT_TOOL_CENTERPOINT_CONTROL) + * G49 - Cancel tool length compensation (Cancel tool length compensation (Requires DEFAULT_TOOL_CENTERPOINT_CONTROL) * G60 - Save current position. (Requires SAVED_POSITIONS) * G61 - Apply/restore saved coordinates. (Requires SAVED_POSITIONS) * G76 - Calibrate first layer temperature offsets. (Requires PTC_PROBE and PTC_BED) @@ -527,7 +527,7 @@ class GcodeSuite { static void G6(); #endif -#if ANY(FWRETRACT, CNC_COORDINATE_SYSTEMS) +#if ANY(FWRETRACT, CNC_COORDINATE_SYSTEMS, HAS_TOOL_LENGTH_COMPENSATION) static void G10(); #endif diff --git a/Marlin/src/gcode/geometry/G43_G49.cpp b/Marlin/src/gcode/geometry/G43_G49.cpp index 97a03d137147..9eee7262e5d1 100644 --- a/Marlin/src/gcode/geometry/G43_G49.cpp +++ b/Marlin/src/gcode/geometry/G43_G49.cpp @@ -1,6 +1,6 @@ /** * Marlin2ForPipetBot [https://github.com/DerAndere1/Marlin] - * Copyright 2019 - 2024 DerAndere and other Marlin2ForPipetBot authors [https://github.com/DerAndere1/Marlin] + * Copyright 2019 - 2025 DerAndere and other Marlin2ForPipetBot authors [https://github.com/DerAndere1/Marlin] * * Based on: * Marlin 3D Printer Firmware @@ -63,13 +63,13 @@ void GcodeSuite::G43() { default: return; // Ignore unknown G43.x case 0: // G43 - Simple Tool Length Compensation Mode. - #if HAS_TOOL_CENTERPOINT_CONTROL + #if ANY(PENTA_AXIS_TRT, PENTA_AXIS_HT) tool_centerpoint_control = false; - simple_tool_length_compensation = true; #endif + simple_tool_length_compensation = true; break; - #if HAS_TOOL_CENTERPOINT_CONTROL + #if ANY(PENTA_AXIS_TRT, PENTA_AXIS_HT) case 4: // G43.4 - Rotational Tool Center Point Control Mode. simple_tool_length_compensation = false; tool_centerpoint_control = true; @@ -92,7 +92,9 @@ void GcodeSuite::G43() { */ void GcodeSuite::G49() { simple_tool_length_compensation = false; - tool_centerpoint_control = false; + #if ANY(PENTA_AXIS_TRT, PENTA_AXIS_HT) + tool_centerpoint_control = false; + #endif current_position -= hotend_offset[active_extruder]; sync_plan_position(); diff --git a/Marlin/src/inc/Conditionals-1-axes.h b/Marlin/src/inc/Conditionals-1-axes.h index 432b7dc83a74..d2de33c617a7 100644 --- a/Marlin/src/inc/Conditionals-1-axes.h +++ b/Marlin/src/inc/Conditionals-1-axes.h @@ -241,6 +241,11 @@ #undef HOTEND_OFFSET_Z #endif +#if defined(DEFAULT_TOOL_LENGTH_COMPENSATION) + #define HAS_TOOL_LENGTH_COMPENSATION 1 + #define HAS_HOTEND_OFFSET 1 +#endif + /** * Number of Linear Axes (e.g., XYZIJKUVW) * All the logical axes except for the tool (E) axis diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index f51550d49eab..90d49d3c63f0 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -163,13 +163,17 @@ int16_t feedrate_percentage = 100; xyz_pos_t cartes; #if HAS_TOOL_LENGTH_COMPENSATION - bool simple_tool_length_compensation = false; + bool simple_tool_length_compensation = DEFAULT_TOOL_LENGTH_COMPENSATION; #endif #if IS_KINEMATIC abce_pos_t delta = LOGICAL_AXIS_ARRAY(0, X_HOME_POS, Y_HOME_POS, Z_INIT_POS, I_HOME_POS, J_HOME_POS, K_HOME_POS, U_HOME_POS, V_HOME_POS, W_HOME_POS); + #if ANY(PENTA_AXIS_TRT, PENTA_AXIS_HT) + bool tool_centerpoint_control = false; + #endif + #if HAS_SCARA_OFFSET abc_pos_t scara_home_offset; #endif @@ -187,11 +191,6 @@ xyz_pos_t cartes; delta_max_radius_2 = sq(PRINTABLE_RADIUS); #endif - - #if ANY(PENTA_AXIS_TRT, PENTA_AXIS_HT) - bool tool_centerpoint_control = false; - #endif - #endif /** diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 54471fd5550f..e64bf5e36677 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1388,10 +1388,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #if HAS_HOTEND_OFFSET #if HAS_TOOL_LENGTH_COMPENSATION xyz_pos_t diff{0}; - if (simple_tool_length_compensation || tool_centerpoint_control) + if (simple_tool_length_compensation || TERN0(HAS_TOOL_CENTERPOINT_CONTROL, tool_centerpoint_control)) diff = hotend_offset[new_tool] - hotend_offset[old_tool]; #else - const xyz_pos_t diff = hotend_offset[new_tool] - hotend_offset[old_tool]; + xyz_pos_t diff = hotend_offset[new_tool] - hotend_offset[old_tool]; #endif TERN_(DUAL_X_CARRIAGE, diff.x = 0); #else diff --git a/ini/features.ini b/ini/features.ini index dabf283a2268..e78665d3cb91 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -317,7 +317,7 @@ PARK_HEAD_ON_PAUSE = build_src_filter=+ HAS_STEALTHCHOP = build_src_filter=+ CNC_WORKSPACE_PLANES = build_src_filter=+ -CNC_COORDINATE_SYSTEMS = build_src_filter=+ +CNC_COORDINATE_SYSTEMS = build_src_filter=+ + + HAS_TOOL_LENGTH_COMPENSATION = build_src_filter=+ + + HAS_HOME_OFFSET = build_src_filter=+ EXPECTED_PRINTER_CHECK = build_src_filter=+