From 52693f72afca243ace00a7a57365301f5f8c42c0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 4 Jan 2024 13:01:45 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Clean=20up=20some=20checks=20&?= =?UTF-8?q?=20includes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 2 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 4 --- Marlin/src/feature/mixing.h | 4 --- Marlin/src/feature/solenoid.cpp | 2 +- Marlin/src/gcode/bedlevel/G35.cpp | 4 --- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 --- Marlin/src/gcode/calibrate/G33.cpp | 4 --- Marlin/src/gcode/calibrate/G34_M422.cpp | 4 --- Marlin/src/gcode/calibrate/G425.cpp | 5 ++- Marlin/src/gcode/config/M217.cpp | 4 +-- Marlin/src/gcode/control/T.cpp | 4 +-- Marlin/src/gcode/feature/pause/M603.cpp | 4 --- Marlin/src/gcode/probe/G30.cpp | 4 --- Marlin/src/gcode/temp/M104_M109.cpp | 4 --- Marlin/src/inc/Changes.h | 32 +++++++++++++++++ Marlin/src/inc/Conditionals_LCD.h | 38 +++++++++++--------- Marlin/src/inc/SanityCheck.h | 40 ++------------------- Marlin/src/lcd/menu/menu_temperature.cpp | 4 --- Marlin/src/lcd/menu/menu_tune.cpp | 4 --- Marlin/src/module/temperature.cpp | 4 --- 20 files changed, 65 insertions(+), 110 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 1dcee50d12..0a97b4d132 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -776,7 +776,7 @@ void idle(const bool no_stepper_sleep/*=false*/) { if (marlin_state == MF_INITIALIZING) goto IDLE_DONE; // TODO: Still causing errors - (void)check_tool_sensor_stats(active_extruder, true); + TERN_(TOOL_SENSOR, (void)check_tool_sensor_stats(active_extruder, true)); // Handle filament runout sensors #if HAS_FILAMENT_SENSOR diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index c61a84894a..720c86769d 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -37,10 +37,6 @@ #include "../../../gcode/gcode.h" #include "../../../libs/least_squares_fit.h" -#if HAS_MULTI_HOTEND - #include "../../../module/tool_change.h" -#endif - #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../../core/debug_out.h" diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h index 4340a510a5..c0f45e364a 100644 --- a/Marlin/src/feature/mixing.h +++ b/Marlin/src/feature/mixing.h @@ -43,10 +43,6 @@ typedef int8_t mixer_perc_t; -#ifndef MIXING_VIRTUAL_TOOLS - #define MIXING_VIRTUAL_TOOLS 1 -#endif - enum MixTool { FIRST_USER_VIRTUAL_TOOL = 0 , LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1 diff --git a/Marlin/src/feature/solenoid.cpp b/Marlin/src/feature/solenoid.cpp index 46364eaf8f..cc4522e30a 100644 --- a/Marlin/src/feature/solenoid.cpp +++ b/Marlin/src/feature/solenoid.cpp @@ -27,7 +27,7 @@ #include "solenoid.h" #include "../module/motion.h" // for active_extruder -#include "../module/tool_change.h" +#include "../module/tool_change.h" // for parking_extruder_set_parked // Used primarily with MANUAL_SOLENOID_CONTROL static void set_solenoid(const uint8_t num, const uint8_t state) { diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 8e11383166..89a43ef08a 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -29,10 +29,6 @@ #include "../../module/probe.h" #include "../../feature/bedlevel/bedlevel.h" -#if HAS_MULTI_HOTEND - #include "../../module/tool_change.h" -#endif - #if ENABLED(BLTOUCH) #include "../../feature/bltouch.h" #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index acd920c729..700562df81 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -55,10 +55,6 @@ #include "../../../lcd/e3v2/proui/dwin.h" #endif -#if HAS_MULTI_HOTEND - #include "../../../module/tool_change.h" -#endif - #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../../core/debug_out.h" diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index d8f104bfce..223beb4ddf 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -35,10 +35,6 @@ #include "../../module/probe.h" #endif -#if HAS_MULTI_HOTEND - #include "../../module/tool_change.h" -#endif - #if HAS_LEVELING #include "../../feature/bedlevel/bedlevel.h" #endif diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index af2c6a5f65..bbc403904f 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -37,10 +37,6 @@ #include "../../feature/bedlevel/bedlevel.h" #endif -#if HAS_MULTI_HOTEND - #include "../../module/tool_change.h" -#endif - #if HAS_Z_STEPPER_ALIGN_STEPPER_XY #include "../../libs/least_squares_fit.h" #endif diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index fb211ad88c..992d7c38e6 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -33,10 +33,13 @@ #include "../../lcd/marlinui.h" #include "../../module/motion.h" #include "../../module/planner.h" -#include "../../module/tool_change.h" #include "../../module/endstops.h" #include "../../feature/bedlevel/bedlevel.h" +#if HAS_MULTI_HOTEND + #include "../../module/tool_change.h" +#endif + #if !AXIS_CAN_CALIBRATE(X) #undef CALIBRATION_MEASURE_LEFT #undef CALIBRATION_MEASURE_RIGHT diff --git a/Marlin/src/gcode/config/M217.cpp b/Marlin/src/gcode/config/M217.cpp index 908a19fae7..5ef06e4823 100644 --- a/Marlin/src/gcode/config/M217.cpp +++ b/Marlin/src/gcode/config/M217.cpp @@ -28,11 +28,9 @@ #include "../../module/tool_change.h" #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE) - #include "../../module/motion.h" + #include "../../module/motion.h" // for active_extruder #endif -#include "../../MarlinCore.h" // for SP_X_STR, etc. - /** * M217 - Set toolchange parameters * diff --git a/Marlin/src/gcode/control/T.cpp b/Marlin/src/gcode/control/T.cpp index c5ebbcf50e..cbe4d26fac 100644 --- a/Marlin/src/gcode/control/T.cpp +++ b/Marlin/src/gcode/control/T.cpp @@ -71,8 +71,8 @@ void GcodeSuite::T(const int8_t tool_index) { tool_change(tool_index #if HAS_MULTI_EXTRUDER - , TERN(PARKING_EXTRUDER, false, tool_index == active_extruder) // For PARKING_EXTRUDER motion is decided in tool_change() - || parser.boolval('S') + , parser.boolval('S') + || TERN(PARKING_EXTRUDER, false, tool_index == active_extruder) // For PARKING_EXTRUDER motion is decided in tool_change() #endif ); } diff --git a/Marlin/src/gcode/feature/pause/M603.cpp b/Marlin/src/gcode/feature/pause/M603.cpp index 2f24cc6421..0204ab25ef 100644 --- a/Marlin/src/gcode/feature/pause/M603.cpp +++ b/Marlin/src/gcode/feature/pause/M603.cpp @@ -29,10 +29,6 @@ #include "../../../module/motion.h" #include "../../../module/printcounter.h" -#if HAS_MULTI_EXTRUDER - #include "../../../module/tool_change.h" -#endif - /** * M603: Configure filament change * diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index 383b5015a0..e83df544c8 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -34,10 +34,6 @@ #include "../../feature/probe_temp_comp.h" #endif -#if HAS_MULTI_HOTEND - #include "../../module/tool_change.h" -#endif - /** * G30: Do a single Z probe at the given XY (default: current) * diff --git a/Marlin/src/gcode/temp/M104_M109.cpp b/Marlin/src/gcode/temp/M104_M109.cpp index db150d5518..4df86edc55 100644 --- a/Marlin/src/gcode/temp/M104_M109.cpp +++ b/Marlin/src/gcode/temp/M104_M109.cpp @@ -45,10 +45,6 @@ #endif #endif -#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) - #include "../../module/tool_change.h" -#endif - /** * M104: Set Hotend Temperature target and return immediately * M109: Set Hotend Temperature target and wait diff --git a/Marlin/src/inc/Changes.h b/Marlin/src/inc/Changes.h index 25d3401579..5a03e87b1d 100644 --- a/Marlin/src/inc/Changes.h +++ b/Marlin/src/inc/Changes.h @@ -579,6 +579,18 @@ #error "Y_DUAL_STEPPER_DRIVERS is no longer needed and should be removed." #elif defined(NUM_Z_STEPPER_DRIVERS) #error "NUM_Z_STEPPER_DRIVERS is no longer needed and should be removed." +#elif defined(SNMM) + #error "SNMM is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead." +#elif defined(MK2_MULTIPLEXER) + #error "MK2_MULTIPLEXER is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead." +#elif defined(PRUSA_MMU2) + #error "PRUSA_MMU2 is obsolete. Define MMU_MODEL as PRUSA_MMU2 instead." +#elif defined(PRUSA_MMU2_S_MODE) + #error "PRUSA_MMU2_S_MODE is obsolete. Define MMU_MODEL as PRUSA_MMU2S instead." +#elif defined(SMUFF_EMU_MMU2) + #error "SMUFF_EMU_MMU2 is obsolete. Define MMU_MODEL as EXTENDABLE_EMU_MMU2 instead." +#elif defined(SMUFF_EMU_MMU2S) + #error "SMUFF_EMU_MMU2S is obsolete. Define MMU_MODEL as EXTENDABLE_EMU_MMU2S instead." #elif defined(LEVEL_BED_CORNERS) #error "LEVEL_BED_CORNERS is now LCD_BED_TRAMMING." #elif defined(LEVEL_CORNERS_INSET_LFRB) || defined(LEVEL_CORNERS_HEIGHT) || defined(LEVEL_CORNERS_Z_HOP) || defined(LEVEL_CORNERS_USE_PROBE) || defined(LEVEL_CORNERS_PROBE_TOLERANCE) || defined(LEVEL_CORNERS_VERIFY_RAISED) || defined(LEVEL_CORNERS_AUDIO_FEEDBACK) @@ -675,6 +687,26 @@ #error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING is now CTC_A10S_A13." #endif +// Changes to Probe Temp Compensation (#17392) +#if HAS_PTC && TEMP_SENSOR_PROBE && TEMP_SENSOR_BED + #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z) + #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)." + #elif defined(PTC_PROBE_POS_X) || defined(PTC_PROBE_POS_Y) + #error "PTC_PROBE_POS_[XY] is now PTC_PROBE_POS (array)." + #endif +#endif + +// Consolidate TMC26X, validate migration (#24373) +#define _ISMAX_1(A) defined(A##_MAX_CURRENT) +#define _ISSNS_1(A) defined(A##_SENSE_RESISTOR) +#if DO(ISMAX,||,ALL_AXIS_NAMES) + #error "*_MAX_CURRENT is now set with *_CURRENT." +#elif DO(ISSNS,||,ALL_AXIS_NAMES) + #error "*_SENSE_RESISTOR (in Milli-Ohms) is now set with *_RSENSE (in Ohms), so you must divide values by 1000." +#endif +#undef _ISMAX_1 +#undef _ISSNS_1 + // L64xx stepper drivers have been removed #define _L6470 0x6470 #define _L6474 0x6474 diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index a81c8639cf..e07d026cb9 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -82,33 +82,36 @@ /** * Multi-Material-Unit supported models */ -#define PRUSA_MMU1 1 -#define PRUSA_MMU2 2 -#define PRUSA_MMU2S 3 -#define EXTENDABLE_EMU_MMU2 12 -#define EXTENDABLE_EMU_MMU2S 13 - #ifdef MMU_MODEL #define HAS_MMU 1 #define SINGLENOZZLE - #if MMU_MODEL == PRUSA_MMU1 + + #define _PRUSA_MMU1 1 + #define _PRUSA_MMU2 2 + #define _PRUSA_MMU2S 3 + #define _EXTENDABLE_EMU_MMU2 12 + #define _EXTENDABLE_EMU_MMU2S 13 + #define _MMU CAT(_,MMU_MODEL) + + #if _MMU == _PRUSA_MMU1 #define HAS_PRUSA_MMU1 1 - #elif MMU_MODEL % 10 == PRUSA_MMU2 + #elif _MMU % 10 == _PRUSA_MMU2 #define HAS_PRUSA_MMU2 1 - #elif MMU_MODEL % 10 == PRUSA_MMU2S + #elif _MMU % 10 == _PRUSA_MMU2S #define HAS_PRUSA_MMU2 1 #define HAS_PRUSA_MMU2S 1 #endif - #if MMU_MODEL >= EXTENDABLE_EMU_MMU2 + #if _MMU == _EXTENDABLE_EMU_MMU2 || _MMU == _EXTENDABLE_EMU_MMU2S #define HAS_EXTENDABLE_MMU 1 #endif -#endif -#undef PRUSA_MMU1 -#undef PRUSA_MMU2 -#undef PRUSA_MMU2S -#undef EXTENDABLE_EMU_MMU2 -#undef EXTENDABLE_EMU_MMU2S + #undef _MMU + #undef _PRUSA_MMU1 + #undef _PRUSA_MMU2 + #undef _PRUSA_MMU2S + #undef _EXTENDABLE_EMU_MMU2 + #undef _EXTENDABLE_EMU_MMU2S +#endif #if ENABLED(E_DUAL_STEPPER_DRIVERS) // E0/E1 steppers act in tandem as E0 @@ -132,6 +135,9 @@ #if MIXING_STEPPERS == 2 #define HAS_DUAL_MIXING 1 #endif + #ifndef MIXING_VIRTUAL_TOOLS + #define MIXING_VIRTUAL_TOOLS 1 + #endif #elif ENABLED(SWITCHING_TOOLHEAD) // Toolchanger diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index d1c84665ed..c3fed355d3 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -116,17 +116,6 @@ constexpr float arm[] = AXIS_RELATIVE_MODES; static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements."); -// Consolidate TMC26X, validate migration (#24373) -#define _ISMAX_1(A) defined(A##_MAX_CURRENT) -#define _ISSNS_1(A) defined(A##_SENSE_RESISTOR) -#if DO(ISMAX,||,ALL_AXIS_NAMES) - #error "*_MAX_CURRENT is now set with *_CURRENT." -#elif DO(ISSNS,||,ALL_AXIS_NAMES) - #error "*_SENSE_RESISTOR (in Milli-Ohms) is now set with *_RSENSE (in Ohms), so you must divide values by 1000." -#endif -#undef _ISMAX_1 -#undef _ISSNS_1 - /** * RADDS is forbidden for non-DUE boards, for now. */ @@ -160,16 +149,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * Probe temp compensation requirements */ #if HAS_PTC - #if TEMP_SENSOR_PROBE && TEMP_SENSOR_BED - #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z) - #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)." - #elif !defined(PTC_PARK_POS) - #error "PTC_PARK_POS is required for Probe Temperature Compensation." - #elif defined(PTC_PROBE_POS_X) || defined(PTC_PROBE_POS_Y) - #error "PTC_PROBE_POS_[XY] is now PTC_PROBE_POS (array)." - #elif !defined(PTC_PROBE_POS) - #error "PTC_PROBE_POS is required for Probe Temperature Compensation." - #endif + #if TEMP_SENSOR_PROBE && TEMP_SENSOR_BED && !(defined(PTC_PARK_POS) && defined(PTC_PROBE_POS)) + #error "PTC_PARK_POS and PTC_PROBE_POS are required for Probe Temperature Compensation." #endif #if ENABLED(PTC_PROBE) @@ -611,23 +592,6 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "INDIVIDUAL_AXIS_HOMING_MENU is incompatible with DELTA kinematics." #endif -/** - * Sanity checking for all Průša MMU - */ -#ifdef SNMM - #error "SNMM is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead." -#elif ENABLED(MK2_MULTIPLEXER) - #error "MK2_MULTIPLEXER is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead." -#elif ENABLED(PRUSA_MMU2) - #error "PRUSA_MMU2 is obsolete. Define MMU_MODEL as PRUSA_MMU2 instead." -#elif ENABLED(PRUSA_MMU2_S_MODE) - #error "PRUSA_MMU2_S_MODE is obsolete. Define MMU_MODEL as PRUSA_MMU2S instead." -#elif ENABLED(SMUFF_EMU_MMU2) - #error "SMUFF_EMU_MMU2 is obsolete. Define MMU_MODEL as EXTENDABLE_EMU_MMU2 instead." -#elif ENABLED(SMUFF_EMU_MMU2S) - #error "SMUFF_EMU_MMU2S is obsolete. Define MMU_MODEL as EXTENDABLE_EMU_MMU2S instead." -#endif - /** * Multi-Material-Unit 2 / EXTENDABLE_EMU_MMU2 requirements */ diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 710cef6468..e8a7b25dcb 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -39,10 +39,6 @@ #include "../../feature/cooler.h" #endif -#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) - #include "../../module/tool_change.h" -#endif - // // "Temperature" submenu items // diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index ecd4e5f342..68f61caaec 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -34,10 +34,6 @@ #include "../../module/temperature.h" #include "../../MarlinCore.h" -#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) - #include "../../module/tool_change.h" -#endif - #if HAS_LEVELING #include "../../feature/bedlevel/bedlevel.h" #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 3f55dde598..e65297b04a 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -182,10 +182,6 @@ #include "../feature/joystick.h" #endif -#if ENABLED(SINGLENOZZLE) - #include "tool_change.h" -#endif - #if HAS_BEEPER #include "../libs/buzzer.h" #endif