Skip to content

Commit

Permalink
🔧 Config-related preparations
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 12, 2024
1 parent 0790a9d commit 89b0143
Show file tree
Hide file tree
Showing 14 changed files with 371 additions and 85 deletions.
155 changes: 108 additions & 47 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
#undef FILAMENT_RUNOUT_SENSOR
#undef FILAMENT_RUNOUT_DISTANCE_MM
#undef DISABLE_OTHER_EXTRUDERS
#undef THERMAL_PROTECTION_HYSTERESIS
#undef THERMAL_PROTECTION_PERIOD
#endif

#define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N)
Expand Down Expand Up @@ -201,6 +203,10 @@
#undef HOTEND_OFFSET_Z
#endif

//
// Remove irrelevant Configuration.h settings
//

// Clean up E-stepper-based settings...
#if E_STEPPERS <= 7
#undef INVERT_E7_DIR
Expand Down Expand Up @@ -235,6 +241,72 @@
#endif
#endif

// Clean up unused temperature sensors and sub-options

#if !TEMP_SENSOR_0
#undef TEMP_SENSOR_0
#endif
#if !TEMP_SENSOR_1
#undef TEMP_SENSOR_1
#endif
#if !TEMP_SENSOR_2
#undef TEMP_SENSOR_2
#endif
#if !TEMP_SENSOR_3
#undef TEMP_SENSOR_3
#endif
#if !TEMP_SENSOR_4
#undef TEMP_SENSOR_4
#endif
#if !TEMP_SENSOR_5
#undef TEMP_SENSOR_5
#endif
#if !TEMP_SENSOR_6
#undef TEMP_SENSOR_6
#endif
#if !TEMP_SENSOR_7
#undef TEMP_SENSOR_7
#endif

#if TEMP_SENSOR_BED
#define HAS_HEATED_BED 1
#else
#undef TEMP_SENSOR_BED
#undef THERMAL_PROTECTION_BED_HYSTERESIS
#undef THERMAL_PROTECTION_BED_PERIOD
#undef MAX_BED_POWER
#endif
#if !TEMP_SENSOR_CHAMBER
#undef TEMP_SENSOR_CHAMBER
#undef THERMAL_PROTECTION_CHAMBER_HYSTERESIS
#undef THERMAL_PROTECTION_CHAMBER_PERIOD
#undef CHAMBER_AUTO_FAN_PIN
#undef CHAMBER_AUTO_FAN_SPEED
#undef CHAMBER_AUTO_FAN_TEMPERATURE
#undef MAX_CHAMBER_POWER
#endif
#if !TEMP_SENSOR_COOLER
#undef TEMP_SENSOR_COOLER
#undef COOLER_AUTO_FAN_PIN
#undef COOLER_AUTO_FAN_SPEED
#undef COOLER_AUTO_FAN_TEMPERATURE
#endif
#if !TEMP_SENSOR_PROBE
#undef TEMP_SENSOR_PROBE
#endif
#if !TEMP_SENSOR_REDUNDANT
#undef TEMP_SENSOR_REDUNDANT
#endif
#if !TEMP_SENSOR_BOARD
#undef TEMP_SENSOR_BOARD
#endif
#if !TEMP_SENSOR_SOC
#undef TEMP_SENSOR_SOC
#endif
#if !SOFT_PWM_SCALE
#undef SOFT_PWM_SCALE
#endif

/**
* Number of Linear Axes (e.g., XYZIJKUVW)
* All the logical axes except for the tool (E) axis
Expand Down Expand Up @@ -296,12 +368,20 @@
#endif
#endif

#if HAS_Z_AXIS
#ifdef Z4_DRIVER_TYPE
#define NUM_Z_STEPPERS 4
#elif defined(Z3_DRIVER_TYPE)
#define NUM_Z_STEPPERS 3
#elif defined(Z2_DRIVER_TYPE)
#define NUM_Z_STEPPERS 2
#else
#define NUM_Z_STEPPERS 1
#endif
#endif

#if !HAS_X_AXIS
#undef AVOID_OBSTACLES
#undef ENDSTOPPULLUP_XMIN
#undef ENDSTOPPULLUP_XMAX
#undef X_MIN_ENDSTOP_HIT_STATE
#undef X_MAX_ENDSTOP_HIT_STATE
#undef X2_DRIVER_TYPE
#undef X_ENABLE_ON
#undef DISABLE_X
Expand All @@ -312,14 +392,12 @@
#undef MANUAL_X_HOME_POS
#undef MIN_SOFTWARE_ENDSTOPS
#undef MAX_SOFTWARE_ENDSTOPS
#undef MIN_SOFTWARE_ENDSTOP_X
#undef MAX_SOFTWARE_ENDSTOP_X
#endif

#if !HAS_Y_AXIS
#undef AVOID_OBSTACLES
#undef ENDSTOPPULLUP_YMIN
#undef ENDSTOPPULLUP_YMAX
#undef Y_MIN_ENDSTOP_HIT_STATE
#undef Y_MAX_ENDSTOP_HIT_STATE
#undef Y2_DRIVER_TYPE
#undef Y_ENABLE_ON
#undef DISABLE_Y
Expand All @@ -332,21 +410,7 @@
#undef MAX_SOFTWARE_ENDSTOP_Y
#endif

#if HAS_Z_AXIS
#ifdef Z4_DRIVER_TYPE
#define NUM_Z_STEPPERS 4
#elif defined(Z3_DRIVER_TYPE)
#define NUM_Z_STEPPERS 3
#elif defined(Z2_DRIVER_TYPE)
#define NUM_Z_STEPPERS 2
#else
#define NUM_Z_STEPPERS 1
#endif
#else
#undef ENDSTOPPULLUP_ZMIN
#undef ENDSTOPPULLUP_ZMAX
#undef Z_MIN_ENDSTOP_HIT_STATE
#undef Z_MAX_ENDSTOP_HIT_STATE
#if !HAS_Z_AXIS
#undef Z2_DRIVER_TYPE
#undef Z3_DRIVER_TYPE
#undef Z4_DRIVER_TYPE
Expand All @@ -363,10 +427,6 @@
#endif

#if !HAS_I_AXIS
#undef ENDSTOPPULLUP_IMIN
#undef ENDSTOPPULLUP_IMAX
#undef I_MIN_ENDSTOP_HIT_STATE
#undef I_MAX_ENDSTOP_HIT_STATE
#undef I_ENABLE_ON
#undef DISABLE_I
#undef INVERT_I_DIR
Expand All @@ -379,10 +439,6 @@
#endif

#if !HAS_J_AXIS
#undef ENDSTOPPULLUP_JMIN
#undef ENDSTOPPULLUP_JMAX
#undef J_MIN_ENDSTOP_HIT_STATE
#undef J_MAX_ENDSTOP_HIT_STATE
#undef J_ENABLE_ON
#undef DISABLE_J
#undef INVERT_J_DIR
Expand All @@ -395,10 +451,6 @@
#endif

#if !HAS_K_AXIS
#undef ENDSTOPPULLUP_KMIN
#undef ENDSTOPPULLUP_KMAX
#undef K_MIN_ENDSTOP_HIT_STATE
#undef K_MAX_ENDSTOP_HIT_STATE
#undef K_ENABLE_ON
#undef DISABLE_K
#undef INVERT_K_DIR
Expand All @@ -411,10 +463,6 @@
#endif

#if !HAS_U_AXIS
#undef ENDSTOPPULLUP_UMIN
#undef ENDSTOPPULLUP_UMAX
#undef U_MIN_ENDSTOP_HIT_STATE
#undef U_MAX_ENDSTOP_HIT_STATE
#undef U_ENABLE_ON
#undef DISABLE_U
#undef INVERT_U_DIR
Expand All @@ -427,10 +475,6 @@
#endif

#if !HAS_V_AXIS
#undef ENDSTOPPULLUP_VMIN
#undef ENDSTOPPULLUP_VMAX
#undef V_MIN_ENDSTOP_HIT_STATE
#undef V_MAX_ENDSTOP_HIT_STATE
#undef V_ENABLE_ON
#undef DISABLE_V
#undef INVERT_V_DIR
Expand All @@ -443,10 +487,6 @@
#endif

#if !HAS_W_AXIS
#undef ENDSTOPPULLUP_WMIN
#undef ENDSTOPPULLUP_WMAX
#undef W_MIN_ENDSTOP_HIT_STATE
#undef W_MAX_ENDSTOP_HIT_STATE
#undef W_ENABLE_ON
#undef DISABLE_W
#undef INVERT_W_DIR
Expand Down Expand Up @@ -1151,6 +1191,19 @@
#endif
#endif

/**
* Unused LCD options
*/
#if NONE(HAS_MARLINUI_HD44780, IS_DWIN_MARLINUI, IS_TFTGLCD_PANEL) && !MB(SIMULATED)
#undef DISPLAY_CHARSET_HD44780
#endif
#if !HAS_MARLINUI_HD44780
#undef LCD_INFO_SCREEN_STYLE
#endif
#if NONE(HAS_MARLINUI_U8GLIB, HAS_TFT_LVGL_UI)
#undef LCD_LANGUAGE
#endif

/**
* Disable unused SINGLENOZZLE sub-options
*/
Expand Down Expand Up @@ -1585,6 +1638,14 @@
#define PROBE_SELECTED 1
#endif

#if !HAS_MESH
#undef MESH_INSET
#endif

#if DISABLED(ENABLE_LEVELING_FADE_HEIGHT)
#undef DEFAULT_LEVELING_FADE_HEIGHT
#endif

#ifdef GRID_MAX_POINTS_X
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
#define GRID_LOOP(A,B) for (uint8_t A = 0; A < GRID_MAX_POINTS_X; ++A) for (uint8_t B = 0; B < GRID_MAX_POINTS_Y; ++B)
Expand Down
20 changes: 20 additions & 0 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@

// Convenience override for a BLTouch alone
#if ENABLED(BLTOUCH)
#ifndef BLTOUCH_DELAY
#define BLTOUCH_DELAY 500
#endif
#ifdef BLTOUCH_HS_MODE
#define HAS_BLTOUCH_HS_MODE 1
#endif
Expand Down Expand Up @@ -622,6 +625,10 @@
#define HAS_MAX31865 1
#endif

#if !HAS_MAX_TC
#undef THERMOCOUPLE_MAX_ERRORS
#endif

#if TEMP_SENSOR_3 == -4
#define TEMP_SENSOR_3_IS_AD8495 1
#elif TEMP_SENSOR_3 == -3
Expand Down Expand Up @@ -819,6 +826,15 @@
#endif
#endif

#if !ANY_THERMISTOR_IS(-1)
#undef TEMP_SENSOR_AD595_GAIN
#undef TEMP_SENSOR_AD595_OFFSET
#endif
#if !ANY_THERMISTOR_IS(-4)
#undef TEMP_SENSOR_AD8495_GAIN
#undef TEMP_SENSOR_AD8495_OFFSET
#endif

#if HAS_MULTI_EXTRUDER || HAS_MULTI_HOTEND || HAS_PRUSA_MMU2 || (ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1)
#define HAS_TOOLCHANGE 1
#endif
Expand Down Expand Up @@ -869,6 +885,10 @@
#define HAS_PRINT_PROGRESS 1
#endif

#if !ALL(HAS_MARLINUI_MENU, HAS_MEDIA)
#undef SD_MENU_CONFIRM_START
#endif

#if DISABLED(SET_PROGRESS_MANUALLY)
#undef SET_REMAINING_TIME
#undef SET_INTERACTION_TIME
Expand Down
Loading

0 comments on commit 89b0143

Please sign in to comment.