More IntelliSense-friendly declarations

This commit is contained in:
Scott Lahteine 2021-03-24 05:40:28 -05:00 committed by Scott Lahteine
parent da4b6896f7
commit 2d2291d00e
32 changed files with 562 additions and 203 deletions

View file

@ -303,7 +303,9 @@ void unified_bed_leveling::G29() {
const int8_t p_val = parser.intval('P', -1); const int8_t p_val = parser.intval('P', -1);
const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen('J'); const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen('J');
TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index = active_extruder); #if ENABLED(HAS_MULTI_HOTEND)
const uint8_t old_tool_index = active_extruder;
#endif
// Check for commands that require the printer to be homed // Check for commands that require the printer to be homed
if (may_move) { if (may_move) {

View file

@ -34,7 +34,9 @@
class CaseLight { class CaseLight {
public: public:
static bool on; static bool on;
TERN_(CASELIGHT_USES_BRIGHTNESS, static uint8_t brightness); #if ENABLED(CASELIGHT_USES_BRIGHTNESS)
static uint8_t brightness;
#endif
static bool pin_is_pwm() { return TERN0(NEED_CASE_LIGHT_PIN, PWM_PIN(CASE_LIGHT_PIN)); } static bool pin_is_pwm() { return TERN0(NEED_CASE_LIGHT_PIN, PWM_PIN(CASE_LIGHT_PIN)); }
static bool has_brightness() { return TERN0(CASELIGHT_USES_BRIGHTNESS, TERN(CASE_LIGHT_USE_NEOPIXEL, true, pin_is_pwm())); } static bool has_brightness() { return TERN0(CASELIGHT_USES_BRIGHTNESS, TERN(CASE_LIGHT_USE_NEOPIXEL, true, pin_is_pwm())); }
@ -50,8 +52,10 @@ public:
static inline void update_brightness() { update(false); } static inline void update_brightness() { update(false); }
static inline void update_enabled() { update(true); } static inline void update_enabled() { update(true); }
private: #if ENABLED(CASE_LIGHT_IS_COLOR_LED)
TERN_(CASE_LIGHT_IS_COLOR_LED, static LEDColor color); private:
static LEDColor color;
#endif
}; };
extern CaseLight caselight; extern CaseLight caselight;

View file

@ -32,11 +32,19 @@
class Joystick { class Joystick {
friend class Temperature; friend class Temperature;
private: private:
TERN_(HAS_JOY_ADC_X, static temp_info_t x); #if ENABLED(HAS_JOY_ADC_X)
TERN_(HAS_JOY_ADC_Y, static temp_info_t y); static temp_info_t x;
TERN_(HAS_JOY_ADC_Z, static temp_info_t z); #endif
#if ENABLED(HAS_JOY_ADC_Y)
static temp_info_t y;
#endif
#if ENABLED(HAS_JOY_ADC_Z)
static temp_info_t z;
#endif
public: public:
TERN_(JOYSTICK_DEBUG, static void report()); #if ENABLED(JOYSTICK_DEBUG)
static void report();
#endif
static void calculate(xyz_float_t &norm_jog); static void calculate(xyz_float_t &norm_jog);
static void inject_jog_moves(); static void inject_jog_moves();
}; };

View file

@ -57,7 +57,9 @@ uint8_t meatPackLookupTable[16] = {
'\0' // Unused. 0b1111 indicates a literal character '\0' // Unused. 0b1111 indicates a literal character
}; };
TERN_(MP_DEBUG, uint8_t chars_decoded = 0); // Log the first 64 bytes after each reset #if ENABLED(MP_DEBUG)
uint8_t chars_decoded = 0; // Log the first 64 bytes after each reset
#endif
void MeatPack::reset_state() { void MeatPack::reset_state() {
state = 0; state = 0;

View file

@ -61,9 +61,6 @@ enum MixTool {
#define MAX_VTOOLS TERN(HAS_MIXER_SYNC_CHANNEL, 254, 255) #define MAX_VTOOLS TERN(HAS_MIXER_SYNC_CHANNEL, 254, 255)
static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must be <= " STRINGIFY(MAX_VTOOLS) "!"); static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must be <= " STRINGIFY(MAX_VTOOLS) "!");
#define MIXER_BLOCK_FIELD mixer_comp_t b_color[MIXING_STEPPERS]
#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color)
#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_block->b_color)
#define MIXER_STEPPER_LOOP(VAR) for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) #define MIXER_STEPPER_LOOP(VAR) for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++)
#if ENABLED(GRADIENT_MIX) #if ENABLED(GRADIENT_MIX)
@ -73,9 +70,11 @@ static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must
mixer_comp_t color[MIXING_STEPPERS]; // The current gradient color mixer_comp_t color[MIXING_STEPPERS]; // The current gradient color
float start_z, end_z; // Region for gradient float start_z, end_z; // Region for gradient
int8_t start_vtool, end_vtool; // Start and end virtual tools int8_t start_vtool, end_vtool; // Start and end virtual tools
mixer_perc_t start_mix[MIXING_STEPPERS], // Start and end mixes from those tools mixer_perc_t start_mix[MIXING_STEPPERS], // Start and end mixes from those tools
end_mix[MIXING_STEPPERS]; end_mix[MIXING_STEPPERS];
TERN_(GRADIENT_VTOOL, int8_t vtool_index); // Use this virtual tool number as index #if ENABLED(GRADIENT_VTOOL)
int8_t vtool_index; // Use this virtual tool number as index
#endif
} gradient_t; } gradient_t;
#endif #endif

View file

@ -55,22 +55,38 @@ typedef struct {
float zraise; float zraise;
// Repeat information // Repeat information
TERN_(GCODE_REPEAT_MARKERS, Repeat stored_repeat); #if ENABLED(GCODE_REPEAT_MARKERS)
Repeat stored_repeat;
#endif
TERN_(HAS_HOME_OFFSET, xyz_pos_t home_offset); #if ENABLED(HAS_HOME_OFFSET)
TERN_(HAS_POSITION_SHIFT, xyz_pos_t position_shift); xyz_pos_t home_offset;
TERN_(HAS_MULTI_EXTRUDER, uint8_t active_extruder); #endif
#if ENABLED(HAS_POSITION_SHIFT)
xyz_pos_t position_shift;
#endif
#if ENABLED(HAS_MULTI_EXTRUDER)
uint8_t active_extruder;
#endif
#if DISABLED(NO_VOLUMETRICS) #if DISABLED(NO_VOLUMETRICS)
bool volumetric_enabled; bool volumetric_enabled;
float filament_size[EXTRUDERS]; float filament_size[EXTRUDERS];
#endif #endif
TERN_(HAS_HOTEND, celsius_t target_temperature[HOTENDS]); #if ENABLED(HAS_HOTEND)
TERN_(HAS_HEATED_BED, celsius_t target_temperature_bed); celsius_t target_temperature[HOTENDS];
TERN_(HAS_FAN, uint8_t fan_speed[FAN_COUNT]); #endif
#if ENABLED(HAS_HEATED_BED)
celsius_t target_temperature_bed;
#endif
#if ENABLED(HAS_FAN)
uint8_t fan_speed[FAN_COUNT];
#endif
TERN_(HAS_LEVELING, float fade); #if ENABLED(HAS_LEVELING)
float fade;
#endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
float retract[EXTRUDERS], retract_hop; float retract[EXTRUDERS], retract_hop;
@ -80,7 +96,9 @@ typedef struct {
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
//uint_fast8_t selected_vtool; //uint_fast8_t selected_vtool;
//mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; //mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
TERN_(GRADIENT_MIX, gradient_t gradient); #if ENABLED(GRADIENT_MIX)
gradient_t gradient;
#endif
#endif #endif
// SD Filename and position // SD Filename and position
@ -97,7 +115,9 @@ typedef struct {
struct { struct {
bool dryrun:1; // M111 S8 bool dryrun:1; // M111 S8
bool allow_cold_extrusion:1; // M302 P1 bool allow_cold_extrusion:1; // M302 P1
TERN_(HAS_LEVELING, bool leveling:1); #if ENABLED(HAS_LEVELING)
bool leveling:1;
#endif
} flag; } flag;
uint8_t valid_foot; uint8_t valid_foot;

View file

@ -70,9 +70,15 @@ class TMCStorage {
} }
struct { struct {
TERN_(HAS_STEALTHCHOP, bool stealthChop_enabled = false); #if ENABLED(HAS_STEALTHCHOP)
TERN_(HYBRID_THRESHOLD, uint8_t hybrid_thrs = 0); bool stealthChop_enabled = false;
TERN_(USE_SENSORLESS, int16_t homing_thrs = 0); #endif
#if ENABLED(HYBRID_THRESHOLD)
uint8_t hybrid_thrs = 0;
#endif
#if ENABLED(USE_SENSORLESS)
int16_t homing_thrs = 0;
#endif
} stored; } stored;
}; };
@ -363,7 +369,9 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
struct slow_homing_t { struct slow_homing_t {
xy_ulong_t acceleration; xy_ulong_t acceleration;
TERN_(HAS_CLASSIC_JERK, xy_float_t jerk_xy); #if ENABLED(HAS_CLASSIC_JERK)
xy_float_t jerk_xy;
#endif
}; };
#endif #endif

View file

@ -72,7 +72,9 @@ void GcodeSuite::G35() {
// Disable the leveling matrix before auto-aligning // Disable the leveling matrix before auto-aligning
#if HAS_LEVELING #if HAS_LEVELING
TERN_(RESTORE_LEVELING_AFTER_G35, const bool leveling_was_active = planner.leveling_active); #if ENABLED(RESTORE_LEVELING_AFTER_G35)
const bool leveling_was_active = planner.leveling_active;
#endif
set_bed_leveling_enabled(false); set_bed_leveling_enabled(false);
#endif #endif

View file

@ -63,7 +63,9 @@ enum CalEnum : char { // the 7 main calibration points -
#define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP) #define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP)
#define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP) #define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP)
TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index = active_extruder); #if ENABLED(HAS_MULTI_HOTEND)
const uint8_t old_tool_index = active_extruder;
#endif
float lcd_probe_pt(const xy_pos_t &xy); float lcd_probe_pt(const xy_pos_t &xy);

View file

@ -130,7 +130,9 @@ void GcodeSuite::G34() {
// Disable the leveling matrix before auto-aligning // Disable the leveling matrix before auto-aligning
#if HAS_LEVELING #if HAS_LEVELING
TERN_(RESTORE_LEVELING_AFTER_G34, const bool leveling_was_active = planner.leveling_active); #if ENABLED(RESTORE_LEVELING_AFTER_G34)
const bool leveling_was_active = planner.leveling_active;
#endif
set_bed_leveling_enabled(false); set_bed_leveling_enabled(false);
#endif #endif

View file

@ -418,24 +418,34 @@ public:
private: private:
TERN_(MARLIN_DEV_MODE, static void D(const int16_t dcode)); #if ENABLED(MARLIN_DEV_MODE)
static void D(const int16_t dcode);
#endif
static void G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move=false)); static void G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move=false));
TERN_(ARC_SUPPORT, static void G2_G3(const bool clockwise)); #if ENABLED(ARC_SUPPORT)
static void G2_G3(const bool clockwise);
#endif
static void G4(); static void G4();
TERN_(BEZIER_CURVE_SUPPORT, static void G5()); #if ENABLED(BEZIER_CURVE_SUPPORT)
static void G5();
#endif
TERN_(DIRECT_STEPPING, static void G6()); #if ENABLED(DIRECT_STEPPING)
static void G6();
#endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
static void G10(); static void G10();
static void G11(); static void G11();
#endif #endif
TERN_(NOZZLE_CLEAN_FEATURE, static void G12()); #if ENABLED(NOZZLE_CLEAN_FEATURE)
static void G12();
#endif
#if ENABLED(CNC_WORKSPACE_PLANES) #if ENABLED(CNC_WORKSPACE_PLANES)
static void G17(); static void G17();
@ -448,9 +458,13 @@ private:
static void G21(); static void G21();
#endif #endif
TERN_(G26_MESH_VALIDATION, static void G26()); #if ENABLED(G26_MESH_VALIDATION)
static void G26();
#endif
TERN_(NOZZLE_PARK_FEATURE, static void G27()); #if ENABLED(NOZZLE_PARK_FEATURE)
static void G27();
#endif
static void G28(); static void G28();
@ -474,19 +488,29 @@ private:
#endif #endif
#endif #endif
TERN_(DELTA_AUTO_CALIBRATION, static void G33()); #if ENABLED(DELTA_AUTO_CALIBRATION)
static void G33();
#endif
#if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION) #if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
static void G34(); static void G34();
#endif #endif
TERN_(Z_STEPPER_AUTO_ALIGN, static void M422()); #if ENABLED(Z_STEPPER_AUTO_ALIGN)
static void M422();
#endif
TERN_(ASSISTED_TRAMMING, static void G35()); #if ENABLED(ASSISTED_TRAMMING)
static void G35();
#endif
TERN_(G38_PROBE_TARGET, static void G38(const int8_t subcode)); #if ENABLED(G38_PROBE_TARGET)
static void G38(const int8_t subcode);
#endif
TERN_(HAS_MESH, static void G42()); #if ENABLED(HAS_MESH)
static void G42();
#endif
#if ENABLED(CNC_COORDINATE_SYSTEMS) #if ENABLED(CNC_COORDINATE_SYSTEMS)
static void G53(); static void G53();
@ -498,20 +522,28 @@ private:
static void G59(); static void G59();
#endif #endif
TERN_(PROBE_TEMP_COMPENSATION, static void G76()); #if ENABLED(PROBE_TEMP_COMPENSATION)
static void G76();
#endif
#if SAVED_POSITIONS #if SAVED_POSITIONS
static void G60(); static void G60();
static void G61(); static void G61();
#endif #endif
TERN_(GCODE_MOTION_MODES, static void G80()); #if ENABLED(GCODE_MOTION_MODES)
static void G80();
#endif
static void G92(); static void G92();
TERN_(CALIBRATION_GCODE, static void G425()); #if ENABLED(CALIBRATION_GCODE)
static void G425();
#endif
TERN_(HAS_RESUME_CONTINUE, static void M0_M1()); #if ENABLED(HAS_RESUME_CONTINUE)
static void M0_M1();
#endif
#if HAS_CUTTER #if HAS_CUTTER
static void M3_M4(const bool is_M4); static void M3_M4(const bool is_M4);
@ -519,14 +551,22 @@ private:
#endif #endif
#if ENABLED(COOLANT_CONTROL) #if ENABLED(COOLANT_CONTROL)
TERN_(COOLANT_MIST, static void M7()); #if ENABLED(COOLANT_MIST)
TERN_(COOLANT_FLOOD, static void M8()); static void M7();
#endif
#if ENABLED(COOLANT_FLOOD)
static void M8();
#endif
static void M9(); static void M9();
#endif #endif
TERN_(EXTERNAL_CLOSED_LOOP_CONTROLLER, static void M12()); #if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
static void M12();
#endif
TERN_(EXPECTED_PRINTER_CHECK, static void M16()); #if ENABLED(EXPECTED_PRINTER_CHECK)
static void M16();
#endif
static void M17(); static void M17();
@ -549,27 +589,43 @@ private:
static void M31(); static void M31();
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
TERN_(HAS_MEDIA_SUBCALLS, static void M32()); #if ENABLED(HAS_MEDIA_SUBCALLS)
TERN_(LONG_FILENAME_HOST_SUPPORT, static void M33()); static void M32();
#endif
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
static void M33();
#endif
#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
static void M34(); static void M34();
#endif #endif
#endif #endif
TERN_(DIRECT_PIN_CONTROL, static void M42()); #if ENABLED(DIRECT_PIN_CONTROL)
TERN_(PINS_DEBUGGING, static void M43()); static void M42();
#endif
#if ENABLED(PINS_DEBUGGING)
static void M43();
#endif
TERN_(Z_MIN_PROBE_REPEATABILITY_TEST, static void M48()); #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
static void M48();
#endif
TERN_(LCD_SET_PROGRESS_MANUALLY, static void M73()); #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
static void M73();
#endif
static void M75(); static void M75();
static void M76(); static void M76();
static void M77(); static void M77();
TERN_(PRINTCOUNTER, static void M78()); #if ENABLED(PRINTCOUNTER)
static void M78();
#endif
TERN_(PSU_CONTROL, static void M80()); #if ENABLED(PSU_CONTROL)
static void M80();
#endif
static void M81(); static void M81();
static void M82(); static void M82();
@ -577,7 +633,9 @@ private:
static void M85(); static void M85();
static void M92(); static void M92();
TERN_(M100_FREE_MEMORY_WATCHER, static void M100()); #if ENABLED(M100_FREE_MEMORY_WATCHER)
static void M100();
#endif
#if EXTRUDERS #if EXTRUDERS
static void M104(); static void M104();
@ -595,13 +653,17 @@ private:
static void M108(); static void M108();
static void M112(); static void M112();
static void M410(); static void M410();
TERN_(HOST_PROMPT_SUPPORT, static void M876()); #if ENABLED(HOST_PROMPT_SUPPORT)
static void M876();
#endif
#endif #endif
static void M110(); static void M110();
static void M111(); static void M111();
TERN_(HOST_KEEPALIVE_FEATURE, static void M113()); #if ENABLED(HOST_KEEPALIVE_FEATURE)
static void M113();
#endif
static void M114(); static void M114();
static void M115(); static void M115();
@ -611,7 +673,9 @@ private:
static void M120(); static void M120();
static void M121(); static void M121();
TERN_(PARK_HEAD_ON_PAUSE, static void M125()); #if ENABLED(PARK_HEAD_ON_PAUSE)
static void M125();
#endif
#if ENABLED(BARICUDA) #if ENABLED(BARICUDA)
#if HAS_HEATER_1 #if HAS_HEATER_1
@ -643,9 +707,13 @@ private:
static void M145(); static void M145();
#endif #endif
TERN_(TEMPERATURE_UNITS_SUPPORT, static void M149()); #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
static void M149();
#endif
TERN_(HAS_COLOR_LEDS, static void M150()); #if ENABLED(HAS_COLOR_LEDS)
static void M150();
#endif
#if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR) #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
static void M155(); static void M155();
@ -654,8 +722,12 @@ private:
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
static void M163(); static void M163();
static void M164(); static void M164();
TERN_(DIRECT_MIXING_IN_G1, static void M165()); #if ENABLED(DIRECT_MIXING_IN_G1)
TERN_(GRADIENT_MIX, static void M166()); static void M165();
#endif
#if ENABLED(GRADIENT_MIX)
static void M166();
#endif
#endif #endif
static void M200(); static void M200();
@ -669,19 +741,27 @@ private:
static void M204(); static void M204();
static void M205(); static void M205();
TERN_(HAS_M206_COMMAND, static void M206()); #if ENABLED(HAS_M206_COMMAND)
static void M206();
#endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
static void M207(); static void M207();
static void M208(); static void M208();
TERN_(FWRETRACT_AUTORETRACT, static void M209()); #if ENABLED(FWRETRACT_AUTORETRACT)
static void M209();
#endif
#endif #endif
static void M211(); static void M211();
TERN_(HAS_MULTI_EXTRUDER, static void M217()); #if ENABLED(HAS_MULTI_EXTRUDER)
static void M217();
#endif
TERN_(HAS_HOTEND_OFFSET, static void M218()); #if ENABLED(HAS_HOTEND_OFFSET)
static void M218();
#endif
static void M220(); static void M220();
@ -689,11 +769,17 @@ private:
static void M221(); static void M221();
#endif #endif
TERN_(DIRECT_PIN_CONTROL, static void M226()); #if ENABLED(DIRECT_PIN_CONTROL)
static void M226();
#endif
TERN_(PHOTO_GCODE, static void M240()); #if ENABLED(PHOTO_GCODE)
static void M240();
#endif
TERN_(HAS_LCD_CONTRAST, static void M250()); #if ENABLED(HAS_LCD_CONTRAST)
static void M250();
#endif
#if ENABLED(EXPERIMENTAL_I2CBUS) #if ENABLED(EXPERIMENTAL_I2CBUS)
static void M260(); static void M260();
@ -702,33 +788,55 @@ private:
#if HAS_SERVOS #if HAS_SERVOS
static void M280(); static void M280();
TERN_(EDITABLE_SERVO_ANGLES, static void M281()); #if ENABLED(EDITABLE_SERVO_ANGLES)
static void M281();
#endif
#endif #endif
TERN_(BABYSTEPPING, static void M290()); #if ENABLED(BABYSTEPPING)
static void M290();
#endif
TERN_(HAS_BUZZER, static void M300()); #if ENABLED(HAS_BUZZER)
static void M300();
#endif
TERN_(PIDTEMP, static void M301()); #if ENABLED(PIDTEMP)
static void M301();
#endif
TERN_(PREVENT_COLD_EXTRUSION, static void M302()); #if ENABLED(PREVENT_COLD_EXTRUSION)
static void M302();
#endif
TERN_(HAS_PID_HEATING, static void M303()); #if ENABLED(HAS_PID_HEATING)
static void M303();
#endif
TERN_(PIDTEMPBED, static void M304()); #if ENABLED(PIDTEMPBED)
static void M304();
#endif
TERN_(HAS_USER_THERMISTORS, static void M305()); #if ENABLED(HAS_USER_THERMISTORS)
static void M305();
#endif
TERN_(PIDTEMPCHAMBER, static void M309()); #if ENABLED(PIDTEMPCHAMBER)
static void M309();
#endif
#if HAS_MICROSTEPS #if HAS_MICROSTEPS
static void M350(); static void M350();
static void M351(); static void M351();
#endif #endif
TERN_(CASE_LIGHT_ENABLE, static void M355()); #if ENABLED(CASE_LIGHT_ENABLE)
static void M355();
#endif
TERN_(REPETIER_GCODE_M360, static void M360()); #if ENABLED(REPETIER_GCODE_M360)
static void M360();
#endif
#if ENABLED(MORGAN_SCARA) #if ENABLED(MORGAN_SCARA)
static bool M360(); static bool M360();
@ -750,7 +858,9 @@ private:
static void M402(); static void M402();
#endif #endif
TERN_(HAS_PRUSA_MMU2, static void M403()); #if ENABLED(HAS_PRUSA_MMU2)
static void M403();
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
static void M404(); static void M404();
@ -759,22 +869,34 @@ private:
static void M407(); static void M407();
#endif #endif
TERN_(HAS_FILAMENT_SENSOR, static void M412()); #if ENABLED(HAS_FILAMENT_SENSOR)
static void M412();
#endif
TERN_(HAS_MULTI_LANGUAGE, static void M414()); #if ENABLED(HAS_MULTI_LANGUAGE)
static void M414();
#endif
#if HAS_LEVELING #if HAS_LEVELING
static void M420(); static void M420();
static void M421(); static void M421();
#endif #endif
TERN_(BACKLASH_GCODE, static void M425()); #if ENABLED(BACKLASH_GCODE)
static void M425();
#endif
TERN_(HAS_M206_COMMAND, static void M428()); #if ENABLED(HAS_M206_COMMAND)
static void M428();
#endif
TERN_(HAS_POWER_MONITOR, static void M430()); #if ENABLED(HAS_POWER_MONITOR)
static void M430();
#endif
TERN_(CANCEL_OBJECTS, static void M486()); #if ENABLED(CANCEL_OBJECTS)
static void M486();
#endif
static void M500(); static void M500();
static void M501(); static void M501();
@ -782,17 +904,27 @@ private:
#if DISABLED(DISABLE_M503) #if DISABLED(DISABLE_M503)
static void M503(); static void M503();
#endif #endif
TERN_(EEPROM_SETTINGS, static void M504()); #if ENABLED(EEPROM_SETTINGS)
static void M504();
#endif
#if ENABLED(PASSWORD_FEATURE) #if ENABLED(PASSWORD_FEATURE)
static void M510(); static void M510();
TERN_(PASSWORD_UNLOCK_GCODE, static void M511()); #if ENABLED(PASSWORD_UNLOCK_GCODE)
TERN_(PASSWORD_CHANGE_GCODE, static void M512()); static void M511();
#endif
#if ENABLED(PASSWORD_CHANGE_GCODE)
static void M512();
#endif
#endif #endif
TERN_(SDSUPPORT, static void M524()); #if ENABLED(SDSUPPORT)
static void M524();
#endif
TERN_(SD_ABORT_ON_ENDSTOP_HIT, static void M540()); #if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
static void M540();
#endif
#if HAS_ETHERNET #if HAS_ETHERNET
static void M552(); static void M552();
@ -800,16 +932,22 @@ private:
static void M554(); static void M554();
#endif #endif
TERN_(BAUD_RATE_GCODE, static void M575()); #if ENABLED(BAUD_RATE_GCODE)
static void M575();
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
static void M600(); static void M600();
static void M603(); static void M603();
#endif #endif
TERN_(HAS_DUPLICATION_MODE, static void M605()); #if ENABLED(HAS_DUPLICATION_MODE)
static void M605();
#endif
TERN_(IS_KINEMATIC, static void M665()); #if ENABLED(IS_KINEMATIC)
static void M665();
#endif
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS #if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
static void M666(); static void M666();
@ -824,13 +962,21 @@ private:
static void M702(); static void M702();
#endif #endif
TERN_(GCODE_REPEAT_MARKERS, static void M808()); #if ENABLED(GCODE_REPEAT_MARKERS)
static void M808();
#endif
TERN_(GCODE_MACROS, static void M810_819()); #if ENABLED(GCODE_MACROS)
static void M810_819();
#endif
TERN_(HAS_BED_PROBE, static void M851()); #if ENABLED(HAS_BED_PROBE)
static void M851();
#endif
TERN_(SKEW_CORRECTION_GCODE, static void M852()); #if ENABLED(SKEW_CORRECTION_GCODE)
static void M852();
#endif
#if ENABLED(I2C_POSITION_ENCODERS) #if ENABLED(I2C_POSITION_ENCODERS)
FORCE_INLINE static void M860() { I2CPEM.M860(); } FORCE_INLINE static void M860() { I2CPEM.M860(); }
@ -850,18 +996,26 @@ private:
static void M871(); static void M871();
#endif #endif
TERN_(LIN_ADVANCE, static void M900()); #if ENABLED(LIN_ADVANCE)
static void M900();
#endif
#if HAS_TRINAMIC_CONFIG #if HAS_TRINAMIC_CONFIG
static void M122(); static void M122();
static void M906(); static void M906();
TERN_(HAS_STEALTHCHOP, static void M569()); #if ENABLED(HAS_STEALTHCHOP)
static void M569();
#endif
#if ENABLED(MONITOR_DRIVER_STATUS) #if ENABLED(MONITOR_DRIVER_STATUS)
static void M911(); static void M911();
static void M912(); static void M912();
#endif #endif
TERN_(HYBRID_THRESHOLD, static void M913()); #if ENABLED(HYBRID_THRESHOLD)
TERN_(USE_SENSORLESS, static void M914()); static void M913();
#endif
#if ENABLED(USE_SENSORLESS)
static void M914();
#endif
#endif #endif
#if HAS_L64XX #if HAS_L64XX
@ -883,18 +1037,26 @@ private:
#endif #endif
#endif #endif
TERN_(SDSUPPORT, static void M928()); #if ENABLED(SDSUPPORT)
static void M928();
#endif
TERN_(MAGNETIC_PARKING_EXTRUDER, static void M951()); #if ENABLED(MAGNETIC_PARKING_EXTRUDER)
static void M951();
#endif
TERN_(TOUCH_SCREEN_CALIBRATION, static void M995()); #if ENABLED(TOUCH_SCREEN_CALIBRATION)
static void M995();
#endif
#if BOTH(HAS_SPI_FLASH, SDSUPPORT) #if BOTH(HAS_SPI_FLASH, SDSUPPORT)
static void M993(); static void M993();
static void M994(); static void M994();
#endif #endif
TERN_(PLATFORM_M997_SUPPORT, static void M997()); #if ENABLED(PLATFORM_M997_SUPPORT)
static void M997();
#endif
static void M999(); static void M999();
@ -903,11 +1065,17 @@ private:
static void M1000(); static void M1000();
#endif #endif
TERN_(SDSUPPORT, static void M1001()); #if ENABLED(SDSUPPORT)
static void M1001();
#endif
TERN_(MAX7219_GCODE, static void M7219()); #if ENABLED(MAX7219_GCODE)
static void M7219();
#endif
TERN_(CONTROLLER_FAN_EDITABLE, static void M710()); #if ENABLED(CONTROLLER_FAN_EDITABLE)
static void M710();
#endif
static void T(const int8_t tool_index); static void T(const int8_t tool_index);

View file

@ -40,9 +40,9 @@ public:
* M110 N<int> sets the current line number. * M110 N<int> sets the current line number.
*/ */
long last_N; long last_N;
int count; //!< Number of characters read in the current line of serial input int count; //!< Number of characters read in the current line of serial input
char line_buffer[MAX_CMD_SIZE]; //!< The current line accumulator char line_buffer[MAX_CMD_SIZE]; //!< The current line accumulator
uint8_t input_state; //!< The input state uint8_t input_state; //!< The input state
}; };
static SerialState serial_state[NUM_SERIAL]; //!< Serial states for each serial port static SerialState serial_state[NUM_SERIAL]; //!< Serial states for each serial port
@ -57,9 +57,11 @@ public:
* command and hands off execution to individual handler functions. * command and hands off execution to individual handler functions.
*/ */
struct CommandLine { struct CommandLine {
char buffer[MAX_CMD_SIZE]; //!< The command buffer char buffer[MAX_CMD_SIZE]; //!< The command buffer
bool skip_ok; //!< Skip sending ok when command is processed? bool skip_ok; //!< Skip sending ok when command is processed?
TERN_(HAS_MULTI_SERIAL, serial_index_t port); //!< Serial port the command was received on #if ENABLED(HAS_MULTI_SERIAL)
serial_index_t port; //!< Serial port the command was received on
#endif
}; };
/** /**

View file

@ -536,7 +536,9 @@ void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool
static struct { static struct {
bool E1_show_target : 1; bool E1_show_target : 1;
bool E2_show_target : 1; bool E2_show_target : 1;
TERN_(HAS_HEATED_BED, bool bed_show_target : 1); #if ENABLED(HAS_HEATED_BED)
bool bed_show_target : 1;
#endif
} display_state = { } display_state = {
true, true, TERN_(HAS_HEATED_BED, true) true, true, TERN_(HAS_HEATED_BED, true)
}; };

View file

@ -180,8 +180,12 @@ static uint8_t _card_percent = 0;
static uint16_t _remain_time = 0; static uint16_t _remain_time = 0;
#if ENABLED(PAUSE_HEAT) #if ENABLED(PAUSE_HEAT)
TERN_(HAS_HOTEND, uint16_t resume_hotend_temp = 0); #if ENABLED(HAS_HOTEND)
TERN_(HAS_HEATED_BED, uint16_t resume_bed_temp = 0); uint16_t resume_hotend_temp = 0;
#endif
#if ENABLED(HAS_HEATED_BED)
uint16_t resume_bed_temp = 0;
#endif
#endif #endif
#if HAS_ZOFFSET_ITEM #if HAS_ZOFFSET_ITEM

View file

@ -234,9 +234,15 @@ extern char print_filename[16];
extern millis_t dwin_heat_time; extern millis_t dwin_heat_time;
typedef struct { typedef struct {
TERN_(HAS_HOTEND, celsius_t E_Temp = 0); #if ENABLED(HAS_HOTEND)
TERN_(HAS_HEATED_BED, celsius_t Bed_Temp = 0); celsius_t E_Temp = 0;
TERN_(HAS_FAN, int16_t Fan_speed = 0); #endif
#if ENABLED(HAS_HEATED_BED)
celsius_t Bed_Temp = 0;
#endif
#if ENABLED(HAS_FAN)
int16_t Fan_speed = 0;
#endif
int16_t print_speed = 100; int16_t print_speed = 100;
float Max_Feedspeed = 0; float Max_Feedspeed = 0;
float Max_Acceleration = 0; float Max_Acceleration = 0;
@ -312,9 +318,15 @@ void HMI_Move_E();
void HMI_Zoffset(); void HMI_Zoffset();
TERN_(HAS_HOTEND, void HMI_ETemp()); #if ENABLED(HAS_HOTEND)
TERN_(HAS_HEATED_BED, void HMI_BedTemp()); void HMI_ETemp();
TERN_(HAS_FAN, void HMI_FanSpeed()); #endif
#if ENABLED(HAS_HEATED_BED)
void HMI_BedTemp();
#endif
#if ENABLED(HAS_FAN)
void HMI_FanSpeed();
#endif
void HMI_PrintSpeed(); void HMI_PrintSpeed();

View file

@ -624,7 +624,9 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
DEBUG_ECHOLNPGM("HandlePreheat"); DEBUG_ECHOLNPGM("HandlePreheat");
uint8_t e_temp = 0; uint8_t e_temp = 0;
TERN_(HAS_HEATED_BED, uint8_t bed_temp = 0); #if ENABLED(HAS_HEATED_BED)
uint8_t bed_temp = 0;
#endif
const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr); const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
switch (preheat_option) { switch (preheat_option) {
default: default:

View file

@ -49,7 +49,9 @@ static lv_obj_t *labelPause, *labelStop, *labelOperat;
static lv_obj_t *bar1, *bar1ValueText; static lv_obj_t *bar1, *bar1ValueText;
static lv_obj_t *buttonPause, *buttonOperat, *buttonStop; static lv_obj_t *buttonPause, *buttonOperat, *buttonStop;
TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2); #if ENABLED(HAS_MULTI_EXTRUDER)
static lv_obj_t *labelExt2;
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
static lv_obj_t* labelBed; static lv_obj_t* labelBed;

View file

@ -103,8 +103,12 @@
namespace ExtUI { namespace ExtUI {
static struct { static struct {
uint8_t printer_killed : 1; uint8_t printer_killed : 1;
TERN_(JOYSTICK, uint8_t jogging : 1); #if ENABLED(JOYSTICK)
TERN_(SDSUPPORT, uint8_t was_sd_printing : 1); uint8_t jogging : 1;
#endif
#if ENABLED(SDSUPPORT)
uint8_t was_sd_printing : 1;
#endif
} flags; } flags;
#ifdef __SAM3X8E__ #ifdef __SAM3X8E__
@ -175,8 +179,12 @@ namespace ExtUI {
#if HAS_HEATED_BED #if HAS_HEATED_BED
case BED: thermalManager.reset_bed_idle_timer(); return; case BED: thermalManager.reset_bed_idle_timer(); return;
#endif #endif
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return); // Chamber has no idle timer #if ENABLED(HAS_HEATED_CHAMBER)
TERN_(HAS_COOLER, case COOLER: return); // Cooler has no idle timer case CHAMBER: return; // Chamber has no idle timer
#endif
#if ENABLED(HAS_COOLER)
case COOLER: return; // Cooler has no idle timer
#endif
default: default:
TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0)); TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0));
break; break;
@ -234,8 +242,12 @@ namespace ExtUI {
bool isHeaterIdle(const heater_t heater) { bool isHeaterIdle(const heater_t heater) {
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
switch (heater) { switch (heater) {
TERN_(HAS_HEATED_BED, case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out); #if ENABLED(HAS_HEATED_BED)
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return false); // Chamber has no idle timer case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out;
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
case CHAMBER: return false; // Chamber has no idle timer
#endif
default: default:
return TERN0(HAS_HOTEND, thermalManager.heater_idle[heater - H0].timed_out); return TERN0(HAS_HOTEND, thermalManager.heater_idle[heater - H0].timed_out);
} }
@ -253,8 +265,12 @@ namespace ExtUI {
float getActualTemp_celsius(const heater_t heater) { float getActualTemp_celsius(const heater_t heater) {
switch (heater) { switch (heater) {
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed())); #if ENABLED(HAS_HEATED_BED)
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber())); case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed());
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber());
#endif
default: return GET_TEMP_ADJUSTMENT(thermalManager.degHotend(heater - H0)); default: return GET_TEMP_ADJUSTMENT(thermalManager.degHotend(heater - H0));
} }
} }
@ -265,8 +281,12 @@ namespace ExtUI {
float getTargetTemp_celsius(const heater_t heater) { float getTargetTemp_celsius(const heater_t heater) {
switch (heater) { switch (heater) {
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed())); #if ENABLED(HAS_HEATED_BED)
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber())); case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed());
#endif
#if ENABLED(HAS_HEATED_CHAMBER)
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber());
#endif
default: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetHotend(heater - H0)); default: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetHotend(heater - H0));
} }
} }
@ -294,13 +314,13 @@ namespace ExtUI {
} }
float getAxisPosition_mm(const axis_t axis) { float getAxisPosition_mm(const axis_t axis) {
return TERN_(JOYSTICK, flags.jogging ? destination[axis] :) current_position[axis]; return TERN0(JOYSTICK, flags.jogging) ? destination[axis] : current_position[axis];
} }
float getAxisPosition_mm(const extruder_t extruder) { float getAxisPosition_mm(const extruder_t extruder) {
const extruder_t old_tool = getActiveTool(); const extruder_t old_tool = getActiveTool();
setActiveTool(extruder, true); setActiveTool(extruder, true);
const float epos = TERN_(JOYSTICK, flags.jogging ? destination.e :) current_position.e; const float epos = TERN0(JOYSTICK, flags.jogging) ? destination.e : current_position.e;
setActiveTool(old_tool, true); setActiveTool(old_tool, true);
return epos; return epos;
} }
@ -491,14 +511,30 @@ namespace ExtUI {
int getTMCBumpSensitivity(const axis_t axis) { int getTMCBumpSensitivity(const axis_t axis) {
switch (axis) { switch (axis) {
TERN_(X_SENSORLESS, case X: return stepperX.homing_threshold()); #if ENABLED(X_SENSORLESS)
TERN_(X2_SENSORLESS, case X2: return stepperX2.homing_threshold()); case X: return stepperX.homing_threshold();
TERN_(Y_SENSORLESS, case Y: return stepperY.homing_threshold()); #endif
TERN_(Y2_SENSORLESS, case Y2: return stepperY2.homing_threshold()); #if ENABLED(X2_SENSORLESS)
TERN_(Z_SENSORLESS, case Z: return stepperZ.homing_threshold()); case X2: return stepperX2.homing_threshold();
TERN_(Z2_SENSORLESS, case Z2: return stepperZ2.homing_threshold()); #endif
TERN_(Z3_SENSORLESS, case Z3: return stepperZ3.homing_threshold()); #if ENABLED(Y_SENSORLESS)
TERN_(Z4_SENSORLESS, case Z4: return stepperZ4.homing_threshold()); case Y: return stepperY.homing_threshold();
#endif
#if ENABLED(Y2_SENSORLESS)
case Y2: return stepperY2.homing_threshold();
#endif
#if ENABLED(Z_SENSORLESS)
case Z: return stepperZ.homing_threshold();
#endif
#if ENABLED(Z2_SENSORLESS)
case Z2: return stepperZ2.homing_threshold();
#endif
#if ENABLED(Z3_SENSORLESS)
case Z3: return stepperZ3.homing_threshold();
#endif
#if ENABLED(Z4_SENSORLESS)
case Z4: return stepperZ4.homing_threshold();
#endif
default: return 0; default: return 0;
} }
} }

View file

@ -688,7 +688,9 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
xyze_pos_t ManualMove::all_axes_destination = { 0 }; xyze_pos_t ManualMove::all_axes_destination = { 0 };
bool ManualMove::processing = false; bool ManualMove::processing = false;
#endif #endif
TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0); #if ENABLED(MULTI_MANUAL)
int8_t ManualMove::e_index = 0;
#endif
AxisEnum ManualMove::axis = NO_AXIS; AxisEnum ManualMove::axis = NO_AXIS;
/** /**

View file

@ -105,9 +105,15 @@
#if PREHEAT_COUNT #if PREHEAT_COUNT
typedef struct { typedef struct {
TERN_(HAS_HOTEND, celsius_t hotend_temp); #if ENABLED(HAS_HOTEND)
TERN_(HAS_HEATED_BED, celsius_t bed_temp ); celsius_t hotend_temp;
TERN_(HAS_FAN, uint16_t fan_speed ); #endif
#if ENABLED(HAS_HEATED_BED)
celsius_t bed_temp;
#endif
#if ENABLED(HAS_FAN)
uint16_t fan_speed;
#endif
} preheat_t; } preheat_t;
#endif #endif
@ -123,10 +129,14 @@
static int8_t constexpr e_index = 0; static int8_t constexpr e_index = 0;
#endif #endif
static millis_t start_time; static millis_t start_time;
TERN_(IS_KINEMATIC, static xyze_pos_t all_axes_destination); #if ENABLED(IS_KINEMATIC)
static xyze_pos_t all_axes_destination;
#endif
public: public:
static float menu_scale; static float menu_scale;
TERN_(IS_KINEMATIC, static float offset); #if ENABLED(IS_KINEMATIC)
static float offset;
#endif
template <typename T> template <typename T>
void set_destination(const T& dest) { void set_destination(const T& dest) {
#if IS_KINEMATIC #if IS_KINEMATIC

View file

@ -53,10 +53,18 @@
// Pool game data to save SRAM // Pool game data to save SRAM
union MarlinGameData { union MarlinGameData {
TERN_(MARLIN_BRICKOUT, brickout_data_t brickout); #if ENABLED(MARLIN_BRICKOUT)
TERN_(MARLIN_INVADERS, invaders_data_t invaders); brickout_data_t brickout;
TERN_(MARLIN_SNAKE, snake_data_t snake); #endif
TERN_(MARLIN_MAZE, maze_data_t maze); #if ENABLED(MARLIN_INVADERS)
invaders_data_t invaders;
#endif
#if ENABLED(MARLIN_SNAKE)
snake_data_t snake;
#endif
#if ENABLED(MARLIN_MAZE)
maze_data_t maze;
#endif
}; };
extern MarlinGameData marlin_game_data; extern MarlinGameData marlin_game_data;

View file

@ -119,7 +119,9 @@ void lcd_delta_settings() {
} }
void menu_delta_calibrate() { void menu_delta_calibrate() {
TERN_(DELTA_CALIBRATION_MENU, const bool all_homed = all_axes_homed()); // Acquire ahead of loop #if ENABLED(DELTA_CALIBRATION_MENU)
const bool all_homed = all_axes_homed(); // Acquire ahead of loop
#endif
START_MENU(); START_MENU();
BACK_ITEM(MSG_MAIN); BACK_ITEM(MSG_MAIN);

View file

@ -42,7 +42,9 @@
// Global storage // Global storage
float z_offset_backup, calculated_z_offset, z_offset_ref; float z_offset_backup, calculated_z_offset, z_offset_ref;
TERN_(HAS_LEVELING, bool leveling_was_active); #if ENABLED(HAS_LEVELING)
bool leveling_was_active;
#endif
inline void z_clearance_move() { inline void z_clearance_move() {
do_z_clearance( do_z_clearance(

View file

@ -46,7 +46,9 @@ Nozzle nozzle;
* @param strokes number of strokes to execute * @param strokes number of strokes to execute
*/ */
void Nozzle::stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) { void Nozzle::stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) {
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t oldpos = current_position); #if ENABLED(NOZZLE_CLEAN_GOBACK)
const xyz_pos_t oldpos = current_position;
#endif
// Move to the starting point // Move to the starting point
#if ENABLED(NOZZLE_CLEAN_NO_Z) #if ENABLED(NOZZLE_CLEAN_NO_Z)
@ -86,7 +88,9 @@ Nozzle nozzle;
const xy_pos_t diff = end - start; const xy_pos_t diff = end - start;
if (!diff.x || !diff.y) return; if (!diff.x || !diff.y) return;
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position); #if ENABLED(NOZZLE_CLEAN_GOBACK)
const xyz_pos_t back = current_position;
#endif
#if ENABLED(NOZZLE_CLEAN_NO_Z) #if ENABLED(NOZZLE_CLEAN_NO_Z)
do_blocking_move_to_xy(start); do_blocking_move_to_xy(start);
@ -129,7 +133,9 @@ Nozzle nozzle;
void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const float &radius) { void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const float &radius) {
if (strokes == 0) return; if (strokes == 0) return;
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position); #if ENABLED(NOZZLE_CLEAN_GOBACK)
const xyz_pos_t back = current_position;
#endif
TERN(NOZZLE_CLEAN_NO_Z, do_blocking_move_to_xy, do_blocking_move_to)(start); TERN(NOZZLE_CLEAN_NO_Z, do_blocking_move_to_xy, do_blocking_move_to)(start);
LOOP_L_N(s, strokes) LOOP_L_N(s, strokes)

View file

@ -46,9 +46,15 @@ class Endstops {
public: public:
#if HAS_EXTRA_ENDSTOPS #if HAS_EXTRA_ENDSTOPS
typedef uint16_t esbits_t; typedef uint16_t esbits_t;
TERN_(X_DUAL_ENDSTOPS, static float x2_endstop_adj); #if ENABLED(X_DUAL_ENDSTOPS)
TERN_(Y_DUAL_ENDSTOPS, static float y2_endstop_adj); static float x2_endstop_adj;
TERN_(Z_MULTI_ENDSTOPS, static float z2_endstop_adj); #endif
#if ENABLED(Y_DUAL_ENDSTOPS)
static float y2_endstop_adj;
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
static float z2_endstop_adj;
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
static float z3_endstop_adj; static float z3_endstop_adj;
#endif #endif

View file

@ -2019,9 +2019,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
// Bail if this is a zero-length block // Bail if this is a zero-length block
if (block->step_event_count < MIN_STEPS_PER_SEGMENT) return false; if (block->step_event_count < MIN_STEPS_PER_SEGMENT) return false;
#if ENABLED(MIXING_EXTRUDER) TERN_(MIXING_EXTRUDER, mixer.populate_block(block->b_color))
MIXER_POPULATE_BLOCK();
#endif
TERN_(HAS_CUTTER, block->cutter_power = cutter.power); TERN_(HAS_CUTTER, block->cutter_power = cutter.power);

View file

@ -170,7 +170,9 @@ typedef struct block_t {
static constexpr uint8_t extruder = 0; static constexpr uint8_t extruder = 0;
#endif #endif
TERN_(MIXING_EXTRUDER, MIXER_BLOCK_FIELD); // Normalized color for the mixing steppers #if ENABLED(MIXING_EXTRUDER)
mixer_comp_t b_color[MIXING_STEPPERS]; // Normalized color for the mixing steppers
#endif
// Settings for the trapezoid generator // Settings for the trapezoid generator
uint32_t accelerate_until, // The index of the step event on which to stop acceleration uint32_t accelerate_until, // The index of the step event on which to stop acceleration

View file

@ -32,7 +32,9 @@
HAL_SERVO_LIB servo[NUM_SERVOS]; HAL_SERVO_LIB servo[NUM_SERVOS];
TERN_(EDITABLE_SERVO_ANGLES, uint16_t servo_angles[NUM_SERVOS][2]); #if ENABLED(EDITABLE_SERVO_ANGLES)
uint16_t servo_angles[NUM_SERVOS][2];
#endif
void servo_init() { void servo_init() {
#if NUM_SERVOS >= 1 && HAS_SERVO_0 #if NUM_SERVOS >= 1 && HAS_SERVO_0

View file

@ -2130,9 +2130,7 @@ uint32_t Stepper::block_phase_isr() {
accelerate_until = current_block->accelerate_until << oversampling; accelerate_until = current_block->accelerate_until << oversampling;
decelerate_after = current_block->decelerate_after << oversampling; decelerate_after = current_block->decelerate_after << oversampling;
#if ENABLED(MIXING_EXTRUDER) TERN_(MIXING_EXTRUDER, mixer.stepper_setup(current_block->b_color))
MIXER_STEPPER_SETUP();
#endif
TERN_(HAS_MULTI_EXTRUDER, stepper_extruder = current_block->extruder); TERN_(HAS_MULTI_EXTRUDER, stepper_extruder = current_block->extruder);

View file

@ -326,14 +326,28 @@ class Temperature {
static const celsius_t hotend_maxtemp[HOTENDS]; static const celsius_t hotend_maxtemp[HOTENDS];
FORCE_INLINE static celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); } FORCE_INLINE static celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
#endif #endif
TERN_(HAS_HEATED_BED, static bed_info_t temp_bed); #if ENABLED(HAS_HEATED_BED)
TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe); static bed_info_t temp_bed;
TERN_(HAS_TEMP_CHAMBER, static chamber_info_t temp_chamber); #endif
TERN_(HAS_TEMP_COOLER, static cooler_info_t temp_cooler); #if ENABLED(HAS_TEMP_PROBE)
static probe_info_t temp_probe;
#endif
#if ENABLED(HAS_TEMP_CHAMBER)
static chamber_info_t temp_chamber;
#endif
#if ENABLED(HAS_TEMP_COOLER)
static cooler_info_t temp_cooler;
#endif
TERN_(AUTO_POWER_E_FANS, static uint8_t autofan_speed[HOTENDS]); #if ENABLED(AUTO_POWER_E_FANS)
TERN_(AUTO_POWER_CHAMBER_FAN, static uint8_t chamberfan_speed); static uint8_t autofan_speed[HOTENDS];
TERN_(AUTO_POWER_COOLER_FAN, static uint8_t coolerfan_speed); #endif
#if ENABLED(AUTO_POWER_CHAMBER_FAN)
static uint8_t chamberfan_speed;
#endif
#if ENABLED(AUTO_POWER_COOLER_FAN)
static uint8_t coolerfan_speed;
#endif
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
static uint8_t soft_pwm_amount_fan[FAN_COUNT], static uint8_t soft_pwm_amount_fan[FAN_COUNT],
@ -403,11 +417,15 @@ class Temperature {
private: private:
TERN_(EARLY_WATCHDOG, static bool inited); // If temperature controller is running #if ENABLED(EARLY_WATCHDOG)
static bool inited; // If temperature controller is running
#endif
static volatile bool raw_temps_ready; static volatile bool raw_temps_ready;
TERN_(WATCH_HOTENDS, static hotend_watch_t watch_hotend[HOTENDS]); #if ENABLED(WATCH_HOTENDS)
static hotend_watch_t watch_hotend[HOTENDS];
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static uint16_t redundant_temperature_raw; static uint16_t redundant_temperature_raw;
@ -419,22 +437,30 @@ class Temperature {
static lpq_ptr_t lpq_ptr; static lpq_ptr_t lpq_ptr;
#endif #endif
TERN_(HAS_HOTEND, static temp_range_t temp_range[HOTENDS]); #if ENABLED(HAS_HOTEND)
static temp_range_t temp_range[HOTENDS];
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
TERN_(WATCH_BED, static bed_watch_t watch_bed); #if ENABLED(WATCH_BED)
static bed_watch_t watch_bed;
#endif
IF_DISABLED(PIDTEMPBED, static millis_t next_bed_check_ms); IF_DISABLED(PIDTEMPBED, static millis_t next_bed_check_ms);
static int16_t mintemp_raw_BED, maxtemp_raw_BED; static int16_t mintemp_raw_BED, maxtemp_raw_BED;
#endif #endif
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER
TERN_(WATCH_CHAMBER, static chamber_watch_t watch_chamber); #if ENABLED(WATCH_CHAMBER)
static chamber_watch_t watch_chamber;
#endif
TERN(PIDTEMPCHAMBER,,static millis_t next_chamber_check_ms); TERN(PIDTEMPCHAMBER,,static millis_t next_chamber_check_ms);
static int16_t mintemp_raw_CHAMBER, maxtemp_raw_CHAMBER; static int16_t mintemp_raw_CHAMBER, maxtemp_raw_CHAMBER;
#endif #endif
#if HAS_COOLER #if HAS_COOLER
TERN_(WATCH_COOLER, static cooler_watch_t watch_cooler); #if ENABLED(WATCH_COOLER)
static cooler_watch_t watch_cooler;
#endif
static millis_t next_cooler_check_ms, cooler_fan_flush_ms; static millis_t next_cooler_check_ms, cooler_fan_flush_ms;
static int16_t mintemp_raw_COOLER, maxtemp_raw_COOLER; static int16_t mintemp_raw_COOLER, maxtemp_raw_COOLER;
#endif #endif
@ -447,9 +473,13 @@ class Temperature {
static millis_t preheat_end_time[HOTENDS]; static millis_t preheat_end_time[HOTENDS];
#endif #endif
TERN_(HAS_AUTO_FAN, static millis_t next_auto_fan_check_ms); #if ENABLED(HAS_AUTO_FAN)
static millis_t next_auto_fan_check_ms;
#endif
TERN_(PROBING_HEATERS_OFF, static bool paused); #if ENABLED(PROBING_HEATERS_OFF)
static bool paused;
#endif
public: public:
#if HAS_ADC_BUTTONS #if HAS_ADC_BUTTONS
@ -457,7 +487,9 @@ class Temperature {
static uint16_t ADCKey_count; static uint16_t ADCKey_count;
#endif #endif
TERN_(PID_EXTRUSION_SCALING, static int16_t lpq_len); #if ENABLED(PID_EXTRUSION_SCALING)
static int16_t lpq_len;
#endif
/** /**
* Instance Methods * Instance Methods
@ -534,7 +566,9 @@ class Temperature {
static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); } static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); }
TERN_(ADAPTIVE_FAN_SLOWING, static uint8_t fan_speed_scaler[FAN_COUNT]); #if ENABLED(ADAPTIVE_FAN_SLOWING)
static uint8_t fan_speed_scaler[FAN_COUNT];
#endif
static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) { static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) {
UNUSED(target); // Potentially unused! UNUSED(target); // Potentially unused!
@ -843,7 +877,9 @@ class Temperature {
#endif #endif
#endif #endif
TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e)); #if ENABLED(HAS_DISPLAY)
static void set_heating_message(const uint8_t e);
#endif
#if HAS_LCD_MENU && HAS_TEMPERATURE #if HAS_LCD_MENU && HAS_TEMPERATURE
static void lcd_preheat(const uint8_t e, const int8_t indh, const int8_t indb); static void lcd_preheat(const uint8_t e, const int8_t indh, const int8_t indb);
@ -866,9 +902,15 @@ class Temperature {
static void checkExtruderAutoFans(); static void checkExtruderAutoFans();
TERN_(HAS_HOTEND, static float get_pid_output_hotend(const uint8_t e)); #if ENABLED(HAS_HOTEND)
TERN_(PIDTEMPBED, static float get_pid_output_bed()); static float get_pid_output_hotend(const uint8_t e);
TERN_(PIDTEMPCHAMBER, static float get_pid_output_chamber()); #endif
#if ENABLED(PIDTEMPBED)
static float get_pid_output_bed();
#endif
#if ENABLED(PIDTEMPCHAMBER)
static float get_pid_output_chamber();
#endif
static void _temp_error(const heater_id_t e, PGM_P const serial_msg, PGM_P const lcd_msg); static void _temp_error(const heater_id_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
static void min_temp_error(const heater_id_t e); static void min_temp_error(const heater_id_t e);

View file

@ -109,9 +109,11 @@
#endif #endif
TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init()); #if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
void est_init();
TERN_(SWITCHING_TOOLHEAD, void swt_init()); #elif ENABLED(SWITCHING_TOOLHEAD)
void swt_init();
#endif
/** /**
* Perform a tool-change, which may result in moving the * Perform a tool-change, which may result in moving the

View file

@ -1084,7 +1084,9 @@ void CardReader::cdroot() {
#if DISABLED(SDSORT_USES_RAM) #if DISABLED(SDSORT_USES_RAM)
selectFileByIndex(o1); // Pre-fetch the first entry and save it selectFileByIndex(o1); // Pre-fetch the first entry and save it
strcpy(name1, longest_filename()); // so the loop only needs one fetch strcpy(name1, longest_filename()); // so the loop only needs one fetch
TERN_(HAS_FOLDER_SORTING, bool dir1 = flag.filenameIsDir); #if ENABLED(HAS_FOLDER_SORTING)
bool dir1 = flag.filenameIsDir;
#endif
#endif #endif
for (uint16_t j = 0; j < i; ++j) { for (uint16_t j = 0; j < i; ++j) {