Skip to content

Commit

Permalink
🎨 Clean up some checks & includes
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 4, 2024
1 parent 991f433 commit 52693f7
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 110 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/feature/mixing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/solenoid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/bedlevel/G35.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/calibrate/G33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/calibrate/G34_M422.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/gcode/calibrate/G425.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/gcode/config/M217.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/control/T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
4 changes: 0 additions & 4 deletions Marlin/src/gcode/feature/pause/M603.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/probe/G30.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/gcode/temp/M104_M109.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions Marlin/src/inc/Changes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
38 changes: 22 additions & 16 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
40 changes: 2 additions & 38 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
*/
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/lcd/menu/menu_temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
#include "../../feature/cooler.h"
#endif

#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
#include "../../module/tool_change.h"
#endif

//
// "Temperature" submenu items
//
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/lcd/menu/menu_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52693f7

Please sign in to comment.