Apply TERN to compact code (#17619)
This commit is contained in:
@@ -126,9 +126,9 @@
|
||||
void M710_report(const bool forReplay);
|
||||
#endif
|
||||
|
||||
#define HAS_CASE_LIGHT_BRIGHTNESS (ENABLED(CASE_LIGHT_MENU) && DISABLED(CASE_LIGHT_NO_BRIGHTNESS))
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
#if ENABLED(CASE_LIGHT_MENU) && DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
|
||||
#include "../feature/caselight.h"
|
||||
#define HAS_CASE_LIGHT_BRIGHTNESS 1
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 1) // No padding between variables
|
||||
@@ -235,7 +235,7 @@ typedef struct SettingsDataStruct {
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
, z_offsets_ext[COUNT(temp_comp.z_offsets_ext)] // M871 E I V
|
||||
#endif
|
||||
;
|
||||
;
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -411,13 +411,9 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
// Make sure delta kinematics are updated before refreshing the
|
||||
// planner position so the stepper counts will be set correctly.
|
||||
#if ENABLED(DELTA)
|
||||
recalc_delta_settings();
|
||||
#endif
|
||||
TERN_(DELTA, recalc_delta_settings());
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
thermalManager.updatePID();
|
||||
#endif
|
||||
TERN_(PIDTEMP, thermalManager.updatePID());
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
planner.calculate_volumetric_multipliers();
|
||||
@@ -432,29 +428,17 @@ void MarlinSettings::postprocess() {
|
||||
update_software_endstops((AxisEnum)i);
|
||||
}
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
set_z_fade_height(new_z_fade_height, false); // false = no report
|
||||
#endif
|
||||
TERN_(ENABLE_LEVELING_FADE_HEIGHT, set_z_fade_height(new_z_fade_height, false)); // false = no report
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
refresh_bed_level();
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_BILINEAR, refresh_bed_level());
|
||||
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
stepper.refresh_motor_power();
|
||||
#endif
|
||||
TERN_(HAS_MOTOR_CURRENT_PWM, stepper.refresh_motor_power());
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
fwretract.refresh_autoretract();
|
||||
#endif
|
||||
TERN_(FWRETRACT, fwretract.refresh_autoretract());
|
||||
|
||||
#if HAS_LINEAR_E_JERK
|
||||
planner.recalculate_max_e_jerk();
|
||||
#endif
|
||||
TERN_(HAS_LINEAR_E_JERK, planner.recalculate_max_e_jerk());
|
||||
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
update_case_light();
|
||||
#endif
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, update_case_light());
|
||||
|
||||
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
|
||||
// and init stepper.count[], planner.position[] with current_position
|
||||
@@ -585,9 +569,7 @@ void MarlinSettings::postprocess() {
|
||||
EEPROM_WRITE(planner_max_jerk);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CLASSIC_JERK)
|
||||
dummyf = 0.02f;
|
||||
#endif
|
||||
TERN_(CLASSIC_JERK, dummyf = 0.02f);
|
||||
EEPROM_WRITE(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
|
||||
}
|
||||
|
||||
@@ -1130,18 +1112,10 @@ void MarlinSettings::postprocess() {
|
||||
{
|
||||
tmc_sgt_t tmc_sgt{0};
|
||||
#if USE_SENSORLESS
|
||||
#if X_SENSORLESS
|
||||
tmc_sgt.X = stepperX.homing_threshold();
|
||||
#endif
|
||||
#if X2_SENSORLESS
|
||||
tmc_sgt.X2 = stepperX2.homing_threshold();
|
||||
#endif
|
||||
#if Y_SENSORLESS
|
||||
tmc_sgt.Y = stepperY.homing_threshold();
|
||||
#endif
|
||||
#if Z_SENSORLESS
|
||||
tmc_sgt.Z = stepperZ.homing_threshold();
|
||||
#endif
|
||||
TERN_(X_SENSORLESS, tmc_sgt.X = stepperX.homing_threshold());
|
||||
TERN_(X2_SENSORLESS, tmc_sgt.X2 = stepperX2.homing_threshold());
|
||||
TERN_(Y_SENSORLESS, tmc_sgt.Y = stepperY.homing_threshold());
|
||||
TERN_(Z_SENSORLESS, tmc_sgt.Z = stepperZ.homing_threshold());
|
||||
#endif
|
||||
EEPROM_WRITE(tmc_sgt);
|
||||
}
|
||||
@@ -1362,9 +1336,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
if (!eeprom_error) LCD_MESSAGEPGM(MSG_SETTINGS_STORED);
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onConfigurationStoreWritten(!eeprom_error);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error));
|
||||
|
||||
return !eeprom_error;
|
||||
}
|
||||
@@ -1703,12 +1675,8 @@ void MarlinSettings::postprocess() {
|
||||
PID_PARAM(Kp, e) = pidcf.Kp;
|
||||
PID_PARAM(Ki, e) = scalePID_i(pidcf.Ki);
|
||||
PID_PARAM(Kd, e) = scalePID_d(pidcf.Kd);
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
PID_PARAM(Kc, e) = pidcf.Kc;
|
||||
#endif
|
||||
#if ENABLED(PID_FAN_SCALING)
|
||||
PID_PARAM(Kf, e) = pidcf.Kf;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, PID_PARAM(Kc, e) = pidcf.Kc);
|
||||
TERN_(PID_FAN_SCALING, PID_PARAM(Kf, e) = pidcf.Kf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1761,9 +1729,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
int16_t lcd_contrast;
|
||||
EEPROM_READ(lcd_contrast);
|
||||
#if HAS_LCD_CONTRAST
|
||||
ui.set_contrast(lcd_contrast);
|
||||
#endif
|
||||
TERN_(HAS_LCD_CONTRAST, ui.set_contrast(lcd_contrast));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1981,9 +1947,7 @@ void MarlinSettings::postprocess() {
|
||||
stepperX2.homing_threshold(tmc_sgt.X);
|
||||
#endif
|
||||
#endif
|
||||
#if X2_SENSORLESS
|
||||
stepperX2.homing_threshold(tmc_sgt.X2);
|
||||
#endif
|
||||
TERN_(X2_SENSORLESS, stepperX2.homing_threshold(tmc_sgt.X2));
|
||||
#ifdef Y_STALL_SENSITIVITY
|
||||
#if AXIS_HAS_STALLGUARD(Y)
|
||||
stepperY.homing_threshold(tmc_sgt.Y);
|
||||
@@ -2284,9 +2248,7 @@ void MarlinSettings::postprocess() {
|
||||
bool MarlinSettings::load() {
|
||||
if (validate()) {
|
||||
const bool success = _load();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onConfigurationStoreRead(success);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreRead(success));
|
||||
return success;
|
||||
}
|
||||
reset();
|
||||
@@ -2428,9 +2390,7 @@ void MarlinSettings::reset() {
|
||||
#define DEFAULT_ZJERK 0
|
||||
#endif
|
||||
planner.max_jerk.set(DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK);
|
||||
#if HAS_CLASSIC_E_JERK
|
||||
planner.max_jerk.e = DEFAULT_EJERK;
|
||||
#endif
|
||||
TERN_(HAS_CLASSIC_E_JERK, planner.max_jerk.e = DEFAULT_EJERK;);
|
||||
#endif
|
||||
|
||||
#if DISABLED(CLASSIC_JERK)
|
||||
@@ -2443,9 +2403,7 @@ void MarlinSettings::reset() {
|
||||
home_offset.reset();
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
reset_hotend_offsets();
|
||||
#endif
|
||||
TERN_(HAS_HOTEND_OFFSET, reset_hotend_offsets());
|
||||
|
||||
//
|
||||
// Filament Runout Sensor
|
||||
@@ -2486,37 +2444,23 @@ void MarlinSettings::reset() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onFactoryReset();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
|
||||
|
||||
//
|
||||
// Case Light Brightness
|
||||
//
|
||||
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS;
|
||||
#endif
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS);
|
||||
|
||||
//
|
||||
// Magnetic Parking Extruder
|
||||
//
|
||||
|
||||
#if ENABLED(MAGNETIC_PARKING_EXTRUDER)
|
||||
mpe_settings_init();
|
||||
#endif
|
||||
TERN_(MAGNETIC_PARKING_EXTRUDER, mpe_settings_init());
|
||||
|
||||
//
|
||||
// Global Leveling
|
||||
//
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
new_z_fade_height = 0.0;
|
||||
#endif
|
||||
|
||||
#if HAS_LEVELING
|
||||
reset_bed_level();
|
||||
#endif
|
||||
TERN_(ENABLE_LEVELING_FADE_HEIGHT, new_z_fade_height = 0.0);
|
||||
TERN_(HAS_LEVELING, reset_bed_level());
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
constexpr float dpo[] = NOZZLE_TO_PROBE_OFFSET;
|
||||
@@ -2532,18 +2476,12 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// Z Stepper Auto-alignment points
|
||||
//
|
||||
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
z_stepper_align.reset_to_default();
|
||||
#endif
|
||||
TERN_(Z_STEPPER_AUTO_ALIGN, z_stepper_align.reset_to_default());
|
||||
|
||||
//
|
||||
// Servo Angles
|
||||
//
|
||||
|
||||
#if ENABLED(EDITABLE_SERVO_ANGLES)
|
||||
COPY(servo_angles, base_servo_angles); // When not editable only one copy of servo angles exists
|
||||
#endif
|
||||
TERN_(EDITABLE_SERVO_ANGLES, COPY(servo_angles, base_servo_angles)); // When not editable only one copy of servo angles exists
|
||||
|
||||
//
|
||||
// BLTOUCH
|
||||
@@ -2564,7 +2502,6 @@ void MarlinSettings::reset() {
|
||||
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
||||
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
|
||||
delta_tower_angle_trim = dta;
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
@@ -2622,23 +2559,15 @@ void MarlinSettings::reset() {
|
||||
PID_PARAM(Kp, e) = float(DEFAULT_Kp);
|
||||
PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki);
|
||||
PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd);
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
PID_PARAM(Kc, e) = DEFAULT_Kc;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PID_FAN_SCALING)
|
||||
PID_PARAM(Kf, e) = DEFAULT_Kf;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, PID_PARAM(Kc, e) = DEFAULT_Kc);
|
||||
TERN_(PID_FAN_SCALING, PID_PARAM(Kf, e) = DEFAULT_Kf);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// PID Extrusion Scaling
|
||||
//
|
||||
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
thermalManager.lpq_len = 20; // Default last-position-queue size
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, thermalManager.lpq_len = 20); // Default last-position-queue size
|
||||
|
||||
//
|
||||
// Heated Bed PID
|
||||
@@ -2653,67 +2582,39 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// User-Defined Thermistors
|
||||
//
|
||||
|
||||
#if HAS_USER_THERMISTORS
|
||||
thermalManager.reset_user_thermistors();
|
||||
#endif
|
||||
TERN_(HAS_USER_THERMISTORS, thermalManager.reset_user_thermistors());
|
||||
|
||||
//
|
||||
// LCD Contrast
|
||||
//
|
||||
|
||||
#if HAS_LCD_CONTRAST
|
||||
ui.set_contrast(DEFAULT_LCD_CONTRAST);
|
||||
#endif
|
||||
TERN_(HAS_LCD_CONTRAST, ui.set_contrast(DEFAULT_LCD_CONTRAST));
|
||||
|
||||
//
|
||||
// Controller Fan
|
||||
//
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
controllerFan.reset();
|
||||
#endif
|
||||
TERN_(USE_CONTROLLER_FAN, controllerFan.reset());
|
||||
|
||||
//
|
||||
// Power-Loss Recovery
|
||||
//
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.enable(ENABLED(PLR_ENABLED_DEFAULT));
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.enable(ENABLED(PLR_ENABLED_DEFAULT)));
|
||||
|
||||
//
|
||||
// Firmware Retraction
|
||||
//
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
fwretract.reset();
|
||||
#endif
|
||||
TERN_(FWRETRACT, fwretract.reset());
|
||||
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
parser.volumetric_enabled =
|
||||
#if ENABLED(VOLUMETRIC_DEFAULT_ON)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
parser.volumetric_enabled = ENABLED(VOLUMETRIC_DEFAULT_ON);
|
||||
LOOP_L_N(q, COUNT(planner.filament_size))
|
||||
planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
|
||||
#endif
|
||||
|
||||
endstops.enable_globally(
|
||||
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
endstops.enable_globally(ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT));
|
||||
|
||||
reset_stepper_drivers();
|
||||
|
||||
@@ -2724,9 +2625,7 @@ void MarlinSettings::reset() {
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
LOOP_L_N(i, EXTRUDERS) {
|
||||
planner.extruder_advance_K[i] = LIN_ADVANCE_K;
|
||||
#if ENABLED(EXTRA_LIN_ADVANCE_K)
|
||||
other_extruder_advance_K[i] = LIN_ADVANCE_K;
|
||||
#endif
|
||||
TERN_(EXTRA_LIN_ADVANCE_K, other_extruder_advance_K[i] = LIN_ADVANCE_K);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2743,15 +2642,11 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// CNC Coordinate System
|
||||
//
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
(void)gcode.select_coordinate_system(-1); // Go back to machine space
|
||||
#endif
|
||||
TERN_(CNC_COORDINATE_SYSTEMS, (void)gcode.select_coordinate_system(-1)); // Go back to machine space
|
||||
|
||||
//
|
||||
// Skew Correction
|
||||
//
|
||||
|
||||
#if ENABLED(SKEW_CORRECTION_GCODE)
|
||||
planner.skew_factor.xy = XY_SKEW_FACTOR;
|
||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
||||
@@ -2763,7 +2658,6 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// Advanced Pause filament load & unload lengths
|
||||
//
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
LOOP_L_N(e, EXTRUDERS) {
|
||||
fc_settings[e].unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH;
|
||||
@@ -2776,9 +2670,7 @@ void MarlinSettings::reset() {
|
||||
DEBUG_ECHO_START();
|
||||
DEBUG_ECHOLNPGM("Hardcoded Default Settings Loaded");
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onFactoryReset();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
|
||||
}
|
||||
|
||||
#if DISABLED(DISABLE_M503)
|
||||
@@ -2959,9 +2851,7 @@ void MarlinSettings::reset() {
|
||||
#endif
|
||||
#if HAS_CLASSIC_JERK
|
||||
" X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>"
|
||||
#if HAS_CLASSIC_E_JERK
|
||||
" E<max_e_jerk>"
|
||||
#endif
|
||||
TERN_(HAS_CLASSIC_E_JERK, " E<max_e_jerk>")
|
||||
#endif
|
||||
);
|
||||
CONFIG_ECHO_START();
|
||||
@@ -3237,9 +3127,7 @@ void MarlinSettings::reset() {
|
||||
SERIAL_ECHOLNPAIR(" M250 C", ui.contrast);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CONTROLLER_FAN_EDITABLE)
|
||||
M710_report(forReplay);
|
||||
#endif
|
||||
TERN_(CONTROLLER_FAN_EDITABLE, M710_report(forReplay));
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
CONFIG_ECHO_HEADING("Power-Loss Recovery:");
|
||||
|
@@ -38,9 +38,7 @@ class MarlinSettings {
|
||||
reset();
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
const bool success = save();
|
||||
#if ENABLED(EEPROM_CHITCHAT)
|
||||
if (success) report();
|
||||
#endif
|
||||
if (TERN0(EEPROM_CHITCHAT, success)) report();
|
||||
return success;
|
||||
#else
|
||||
return true;
|
||||
|
@@ -249,11 +249,7 @@ void home_delta() {
|
||||
#endif
|
||||
|
||||
// Move all carriages together linearly until an endstop is hit.
|
||||
current_position.z = (delta_height + 10
|
||||
#if HAS_BED_PROBE
|
||||
- probe.offset.z
|
||||
#endif
|
||||
);
|
||||
current_position.z = (delta_height + 10 - TERN0(HAS_BED_PROBE, probe.offset.z));
|
||||
line_to_current_position(homing_feedrate(Z_AXIS));
|
||||
planner.synchronize();
|
||||
|
||||
|
@@ -276,27 +276,17 @@ void Endstops::init() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
setup_endstop_interrupts();
|
||||
#endif
|
||||
TERN_(ENDSTOP_INTERRUPTS_FEATURE, setup_endstop_interrupts());
|
||||
|
||||
// Enable endstops
|
||||
enable_globally(
|
||||
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
enable_globally(ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT));
|
||||
|
||||
} // Endstops::init
|
||||
|
||||
// Called at ~1KHz from Temperature ISR: Poll endstop state if required
|
||||
void Endstops::poll() {
|
||||
|
||||
#if ENABLED(PINS_DEBUGGING)
|
||||
run_monitor(); // report changes in endstop status
|
||||
#endif
|
||||
TERN_(PINS_DEBUGGING, run_monitor()); // Report changes in endstop status
|
||||
|
||||
#if DISABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
update();
|
||||
@@ -341,14 +331,9 @@ void Endstops::not_homing() {
|
||||
void Endstops::resync() {
|
||||
if (!abort_enabled()) return; // If endstops/probes are disabled the loop below can hang
|
||||
|
||||
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
update();
|
||||
#else
|
||||
safe_delay(2); // Wait for Temperature ISR to run at least once (runs at 1KHz)
|
||||
#endif
|
||||
#if ENDSTOP_NOISE_THRESHOLD
|
||||
while (endstop_poll_count) safe_delay(1);
|
||||
#endif
|
||||
// Wait for Temperature ISR to run at least once (runs at 1KHz)
|
||||
TERN(ENDSTOP_INTERRUPTS_FEATURE, update(), safe_delay(2));
|
||||
while (TERN0(ENDSTOP_NOISE_THRESHOLD, endstop_poll_count)) safe_delay(1);
|
||||
}
|
||||
|
||||
#if ENABLED(PINS_DEBUGGING)
|
||||
@@ -397,9 +382,7 @@ void Endstops::event_handler() {
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP);
|
||||
#endif
|
||||
TERN_(HAS_SPI_LCD, ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP));
|
||||
|
||||
#if BOTH(SD_ABORT_ON_ENDSTOP_HIT, SDSUPPORT)
|
||||
if (planner.abort_on_endstop_hit) {
|
||||
@@ -420,9 +403,7 @@ static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {
|
||||
}
|
||||
|
||||
void _O2 Endstops::report_states() {
|
||||
#if ENABLED(BLTOUCH)
|
||||
bltouch._set_SW_mode();
|
||||
#endif
|
||||
TERN_(BLTOUCH, bltouch._set_SW_mode());
|
||||
SERIAL_ECHOLNPGM(STR_M119_REPORT);
|
||||
#define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(STR_##S))
|
||||
#if HAS_X_MIN
|
||||
@@ -494,13 +475,9 @@ void _O2 Endstops::report_states() {
|
||||
#undef _CASE_RUNOUT
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(BLTOUCH)
|
||||
bltouch._reset_SW_mode();
|
||||
#endif
|
||||
|
||||
#if ENABLED(JOYSTICK_DEBUG)
|
||||
joystick.report();
|
||||
#endif
|
||||
TERN_(BLTOUCH, bltouch._reset_SW_mode());
|
||||
TERN_(JOYSTICK_DEBUG, joystick.report());
|
||||
|
||||
} // Endstops::report_states
|
||||
|
||||
@@ -796,12 +773,8 @@ void Endstops::update() {
|
||||
if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
|
||||
|
||||
#if HAS_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_DIR < 0)
|
||||
if (true
|
||||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
&& z_probe_enabled
|
||||
#elif HAS_CUSTOM_PROBE_PIN
|
||||
&& !z_probe_enabled
|
||||
#endif
|
||||
if ( TERN1(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, z_probe_enabled)
|
||||
&& TERN1(HAS_CUSTOM_PROBE_PIN, !z_probe_enabled)
|
||||
) PROCESS_ENDSTOP_Z(MIN);
|
||||
#endif
|
||||
|
||||
@@ -852,15 +825,9 @@ void Endstops::update() {
|
||||
}
|
||||
|
||||
void Endstops::clear_endstop_state() {
|
||||
#if X_SPI_SENSORLESS
|
||||
CBI(live_state, X_STOP);
|
||||
#endif
|
||||
#if Y_SPI_SENSORLESS
|
||||
CBI(live_state, Y_STOP);
|
||||
#endif
|
||||
#if Z_SPI_SENSORLESS
|
||||
CBI(live_state, Z_STOP);
|
||||
#endif
|
||||
TERN_(X_SPI_SENSORLESS, CBI(live_state, X_STOP));
|
||||
TERN_(Y_SPI_SENSORLESS, CBI(live_state, Y_STOP));
|
||||
TERN_(Z_SPI_SENSORLESS, CBI(live_state, Z_STOP));
|
||||
}
|
||||
|
||||
#endif // SPI_ENDSTOPS
|
||||
|
@@ -42,15 +42,9 @@ class Endstops {
|
||||
public:
|
||||
#if HAS_EXTRA_ENDSTOPS
|
||||
typedef uint16_t esbits_t;
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
static float x2_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
|
||||
TERN_(X_DUAL_ENDSTOPS, static float x2_endstop_adj);
|
||||
TERN_(Y_DUAL_ENDSTOPS, static float y2_endstop_adj);
|
||||
TERN_(Z_MULTI_ENDSTOPS, static float z2_endstop_adj);
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
|
||||
static float z3_endstop_adj;
|
||||
#endif
|
||||
@@ -83,11 +77,7 @@ class Endstops {
|
||||
* Are endstops or the probe set to abort the move?
|
||||
*/
|
||||
FORCE_INLINE static bool abort_enabled() {
|
||||
return (enabled
|
||||
#if HAS_BED_PROBE
|
||||
|| z_probe_enabled
|
||||
#endif
|
||||
);
|
||||
return enabled || TERN0(HAS_BED_PROBE, z_probe_enabled);
|
||||
}
|
||||
|
||||
static inline bool global_enabled() { return enabled_globally; }
|
||||
|
@@ -204,9 +204,7 @@ xyz_pos_t cartes;
|
||||
|
||||
inline void report_more_positions() {
|
||||
stepper.report_positions();
|
||||
#if IS_SCARA
|
||||
scara_report_positions();
|
||||
#endif
|
||||
TERN_(IS_SCARA, scara_report_positions());
|
||||
}
|
||||
|
||||
// Report the logical position for a given machine position
|
||||
@@ -329,9 +327,7 @@ void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) {
|
||||
|
||||
#if EXTRUDERS
|
||||
void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s) {
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.reset();
|
||||
#endif
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
||||
current_position.e += length / planner.e_factor[active_extruder];
|
||||
line_to_current_position(fr_mm_s);
|
||||
planner.synchronize();
|
||||
@@ -554,7 +550,8 @@ void restore_feedrate_and_scaling() {
|
||||
*/
|
||||
void update_software_endstops(const AxisEnum axis
|
||||
#if HAS_HOTEND_OFFSET
|
||||
, const uint8_t old_tool_index/*=0*/, const uint8_t new_tool_index/*=0*/
|
||||
, const uint8_t old_tool_index/*=0*/
|
||||
, const uint8_t new_tool_index/*=0*/
|
||||
#endif
|
||||
) {
|
||||
|
||||
@@ -587,11 +584,7 @@ void restore_feedrate_and_scaling() {
|
||||
#elif ENABLED(DELTA)
|
||||
|
||||
soft_endstop.min[axis] = base_min_pos(axis);
|
||||
soft_endstop.max[axis] = (axis == Z_AXIS ? delta_height
|
||||
#if HAS_BED_PROBE
|
||||
- probe.offset.z
|
||||
#endif
|
||||
: base_max_pos(axis));
|
||||
soft_endstop.max[axis] = (axis == Z_AXIS) ? delta_height - TERN0(HAS_BED_PROBE, probe.offset.z) : base_max_pos(axis);
|
||||
|
||||
switch (axis) {
|
||||
case X_AXIS:
|
||||
@@ -644,9 +637,7 @@ void restore_feedrate_and_scaling() {
|
||||
|
||||
#if IS_KINEMATIC
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
if (!all_axes_homed()) return;
|
||||
#endif
|
||||
if (TERN0(DELTA, !all_axes_homed())) return;
|
||||
|
||||
#if HAS_HOTEND_OFFSET && ENABLED(DELTA)
|
||||
// The effector center position will be the target minus the hotend offset.
|
||||
@@ -656,11 +647,7 @@ void restore_feedrate_and_scaling() {
|
||||
constexpr xy_pos_t offs{0};
|
||||
#endif
|
||||
|
||||
if (true
|
||||
#if IS_SCARA
|
||||
&& TEST(axis_homed, X_AXIS) && TEST(axis_homed, Y_AXIS)
|
||||
#endif
|
||||
) {
|
||||
if (TERN1(IS_SCARA, TEST(axis_homed, X_AXIS) && TEST(axis_homed, Y_AXIS))) {
|
||||
const float dist_2 = HYPOT2(target.x - offs.x, target.y - offs.y);
|
||||
if (dist_2 > delta_max_radius_2)
|
||||
target *= float(delta_max_radius / SQRT(dist_2)); // 200 / 300 = 0.66
|
||||
@@ -811,8 +798,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
|
||||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
))
|
||||
break;
|
||||
)) break;
|
||||
}
|
||||
|
||||
// Ensure last segment arrives at target location.
|
||||
@@ -883,8 +869,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
|
||||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
))
|
||||
break;
|
||||
)) break;
|
||||
}
|
||||
|
||||
// Since segment_distance is only approximate,
|
||||
@@ -1090,9 +1075,7 @@ void prepare_line_to_destination() {
|
||||
|
||||
#endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
if (dual_x_carriage_unpark()) return;
|
||||
#endif
|
||||
if (TERN0(DUAL_X_CARRIAGE, dual_x_carriage_unpark())) return;
|
||||
|
||||
if (
|
||||
#if UBL_SEGMENTED
|
||||
@@ -1135,9 +1118,7 @@ bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) {
|
||||
);
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLN(msg);
|
||||
#if HAS_DISPLAY
|
||||
ui.set_status(msg);
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.set_status(msg));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1147,9 +1128,8 @@ bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) {
|
||||
* Homing bump feedrate (mm/s)
|
||||
*/
|
||||
feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
if (axis == Z_AXIS) return MMM_TO_MMS(Z_PROBE_SPEED_SLOW);
|
||||
#endif
|
||||
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS))
|
||||
return MMM_TO_MMS(Z_PROBE_SPEED_SLOW);
|
||||
static const uint8_t homing_bump_divisor[] PROGMEM = HOMING_BUMP_DIVISOR;
|
||||
uint8_t hbd = pgm_read_byte(&homing_bump_divisor[axis]);
|
||||
if (hbd < 1) {
|
||||
@@ -1224,9 +1204,7 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
sg_guard_period = millis() + default_sg_guard_duration;
|
||||
#endif
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, sg_guard_period = millis() + default_sg_guard_duration);
|
||||
|
||||
return stealth_states;
|
||||
}
|
||||
@@ -1316,11 +1294,8 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
|
||||
#endif
|
||||
|
||||
// Only do some things when moving towards an endstop
|
||||
const int8_t axis_home_dir =
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
(axis == X_AXIS) ? x_home_dir(active_extruder) :
|
||||
#endif
|
||||
home_dir(axis);
|
||||
const int8_t axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
|
||||
? x_home_dir(active_extruder) : home_dir(axis);
|
||||
const bool is_home_dir = (axis_home_dir > 0) == (distance > 0);
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
@@ -1334,9 +1309,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
|
||||
#endif
|
||||
|
||||
// Disable stealthChop if used. Enable diag1 pin on driver.
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
stealth_states = start_sensorless_homing_per_axis(axis);
|
||||
#endif
|
||||
TERN_(SENSORLESS_HOMING, stealth_states = start_sensorless_homing_per_axis(axis));
|
||||
}
|
||||
|
||||
#if IS_SCARA
|
||||
@@ -1375,9 +1348,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
|
||||
endstops.validate_homing_move();
|
||||
|
||||
// Re-enable stealthChop if used. Disable diag1 pin on driver.
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
end_sensorless_homing_per_axis(axis, stealth_states);
|
||||
#endif
|
||||
TERN_(SENSORLESS_HOMING, end_sensorless_homing_per_axis(axis, stealth_states));
|
||||
}
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< do_homing_move(", axis_codes[axis], ")");
|
||||
@@ -1417,11 +1388,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
scara_set_axis_is_at_home(axis);
|
||||
#elif ENABLED(DELTA)
|
||||
current_position[axis] = (axis == Z_AXIS ? delta_height
|
||||
#if HAS_BED_PROBE
|
||||
- probe.offset.z
|
||||
#endif
|
||||
: base_home_pos(axis));
|
||||
current_position[axis] = (axis == Z_AXIS) ? delta_height - TERN0(HAS_BED_PROBE, probe.offset.z) : base_home_pos(axis);
|
||||
#else
|
||||
current_position[axis] = base_home_pos(axis);
|
||||
#endif
|
||||
@@ -1445,13 +1412,9 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||
I2CPEM.homed(axis);
|
||||
#endif
|
||||
TERN_(I2C_POSITION_ENCODERS, I2CPEM.homed(axis));
|
||||
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
babystep.reset_total(axis);
|
||||
#endif
|
||||
TERN_(BABYSTEP_DISPLAY_TOTAL, babystep.reset_total(axis));
|
||||
|
||||
#if HAS_POSITION_SHIFT
|
||||
position_shift[axis] = 0;
|
||||
@@ -1478,9 +1441,7 @@ void set_axis_not_trusted(const AxisEnum axis) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< set_axis_not_trusted(", axis_codes[axis], ")");
|
||||
|
||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||
I2CPEM.unhomed(axis);
|
||||
#endif
|
||||
TERN_(I2C_POSITION_ENCODERS, I2CPEM.unhomed(axis));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1596,31 +1557,20 @@ void homeaxis(const AxisEnum axis) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> homeaxis(", axis_codes[axis], ")");
|
||||
|
||||
const int axis_home_dir = (
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
axis == X_AXIS ? x_home_dir(active_extruder) :
|
||||
#endif
|
||||
home_dir(axis)
|
||||
);
|
||||
const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
|
||||
? x_home_dir(active_extruder) : home_dir(axis);
|
||||
|
||||
// Homing Z towards the bed? Deploy the Z probe or endstop.
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
if (axis == Z_AXIS && probe.deploy()) return;
|
||||
#endif
|
||||
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy()))
|
||||
return;
|
||||
|
||||
// Set flags for X, Y, Z motor locking
|
||||
#if HAS_EXTRA_ENDSTOPS
|
||||
switch (axis) {
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
case X_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
case Y_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
case Z_AXIS:
|
||||
#endif
|
||||
stepper.set_separate_multi_axis(true);
|
||||
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
|
||||
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
|
||||
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
|
||||
stepper.set_separate_multi_axis(true);
|
||||
default: break;
|
||||
}
|
||||
#endif
|
||||
@@ -1645,11 +1595,9 @@ void homeaxis(const AxisEnum axis) {
|
||||
#endif
|
||||
|
||||
// When homing Z with probe respect probe clearance
|
||||
const bool use_probe_bump = TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && home_bump_mm(Z_AXIS));
|
||||
const float bump = axis_home_dir * (
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
(axis == Z_AXIS && home_bump_mm(Z_AXIS)) ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, home_bump_mm(Z_AXIS)) :
|
||||
#endif
|
||||
home_bump_mm(axis)
|
||||
use_probe_bump ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, home_bump_mm(Z_AXIS)) : home_bump_mm(axis)
|
||||
);
|
||||
|
||||
// If a second homing move is configured...
|
||||
@@ -1803,16 +1751,10 @@ void homeaxis(const AxisEnum axis) {
|
||||
// Reset flags for X, Y, Z motor locking
|
||||
switch (axis) {
|
||||
default: break;
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
case X_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
case Y_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
case Z_AXIS:
|
||||
#endif
|
||||
stepper.set_separate_multi_axis(false);
|
||||
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
|
||||
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
|
||||
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
|
||||
stepper.set_separate_multi_axis(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1868,9 +1810,8 @@ void homeaxis(const AxisEnum axis) {
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
planner.synchronize();
|
||||
#if IS_CORE
|
||||
if (axis != NORMAL_AXIS) safe_delay(200); // Short delay to allow belts to spring back
|
||||
#endif
|
||||
if (TERN0(IS_CORE, axis != NORMAL_AXIS))
|
||||
safe_delay(200); // Short delay to allow belts to spring back
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@@ -44,13 +44,7 @@ FORCE_INLINE void set_all_unhomed() { axis_homed = 0; }
|
||||
FORCE_INLINE void set_all_unknown() { axis_known_position = 0; }
|
||||
|
||||
FORCE_INLINE bool homing_needed() {
|
||||
return !(
|
||||
#if ENABLED(HOME_AFTER_DEACTIVATE)
|
||||
all_axes_known()
|
||||
#else
|
||||
all_axes_homed()
|
||||
#endif
|
||||
);
|
||||
return !TERN(HOME_AFTER_DEACTIVATE, all_axes_known, all_axes_homed)();
|
||||
}
|
||||
|
||||
// Error margin to work around float imprecision
|
||||
@@ -136,7 +130,7 @@ inline float home_bump_mm(const AxisEnum axis) {
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
void update_workspace_offset(const AxisEnum axis);
|
||||
#else
|
||||
#define update_workspace_offset(x) NOOP
|
||||
inline void update_workspace_offset(const AxisEnum) {}
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
|
@@ -236,17 +236,11 @@ Planner::Planner() { init(); }
|
||||
|
||||
void Planner::init() {
|
||||
position.reset();
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.reset();
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
position_cart.reset();
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.reset());
|
||||
TERN_(IS_KINEMATIC, position_cart.reset());
|
||||
previous_speed.reset();
|
||||
previous_nominal_speed_sqr = 0;
|
||||
#if ABL_PLANAR
|
||||
bed_level_matrix.set_to_identity();
|
||||
#endif
|
||||
TERN_(ABL_PLANAR, bed_level_matrix.set_to_identity());
|
||||
clear_block_buffer();
|
||||
delay_before_delivering = 0;
|
||||
}
|
||||
@@ -738,9 +732,8 @@ block_t* Planner::get_current_block() {
|
||||
// No trapezoid calculated? Don't execute yet.
|
||||
if (TEST(block->flag, BLOCK_BIT_RECALCULATE)) return nullptr;
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
block_buffer_runtime_us -= block->segment_time_us; // We can't be sure how long an active block will take, so don't count it.
|
||||
#endif
|
||||
// We can't be sure how long an active block will take, so don't count it.
|
||||
TERN_(HAS_SPI_LCD, block_buffer_runtime_us -= block->segment_time_us);
|
||||
|
||||
// As this block is busy, advance the nonbusy block pointer
|
||||
block_buffer_nonbusy = next_block_index(block_buffer_tail);
|
||||
@@ -754,9 +747,7 @@ block_t* Planner::get_current_block() {
|
||||
}
|
||||
|
||||
// The queue became empty
|
||||
#if HAS_SPI_LCD
|
||||
clear_block_buffer_runtime(); // paranoia. Buffer is empty now - so reset accumulated time to zero.
|
||||
#endif
|
||||
TERN_(HAS_SPI_LCD, clear_block_buffer_runtime()); // paranoia. Buffer is empty now - so reset accumulated time to zero.
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1304,12 +1295,8 @@ void Planner::check_axes_activity() {
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
tail_valve_pressure = block->valve_pressure;
|
||||
#endif
|
||||
#if HAS_HEATER_2
|
||||
tail_e_to_p_pressure = block->e_to_p_pressure;
|
||||
#endif
|
||||
TERN_(HAS_HEATER_1, tail_valve_pressure = block->valve_pressure);
|
||||
TERN_(HAS_HEATER_2, tail_e_to_p_pressure = block->e_to_p_pressure);
|
||||
#endif
|
||||
|
||||
#if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_E)
|
||||
@@ -1321,9 +1308,7 @@ void Planner::check_axes_activity() {
|
||||
}
|
||||
else {
|
||||
|
||||
#if HAS_CUTTER
|
||||
cutter.refresh();
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, cutter.refresh());
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
FANS_LOOP(i)
|
||||
@@ -1331,30 +1316,18 @@ void Planner::check_axes_activity() {
|
||||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
tail_valve_pressure = baricuda_valve_pressure;
|
||||
#endif
|
||||
#if HAS_HEATER_2
|
||||
tail_e_to_p_pressure = baricuda_e_to_p_pressure;
|
||||
#endif
|
||||
TERN_(HAS_HEATER_1, tail_valve_pressure = baricuda_valve_pressure);
|
||||
TERN_(HAS_HEATER_2, tail_e_to_p_pressure = baricuda_e_to_p_pressure);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Disable inactive axes
|
||||
//
|
||||
#if ENABLED(DISABLE_X)
|
||||
if (!axis_active.x) DISABLE_AXIS_X();
|
||||
#endif
|
||||
#if ENABLED(DISABLE_Y)
|
||||
if (!axis_active.y) DISABLE_AXIS_Y();
|
||||
#endif
|
||||
#if ENABLED(DISABLE_Z)
|
||||
if (!axis_active.z) DISABLE_AXIS_Z();
|
||||
#endif
|
||||
#if ENABLED(DISABLE_E)
|
||||
if (!axis_active.e) disable_e_steppers();
|
||||
#endif
|
||||
if (TERN0(DISABLE_X, !axis_active.x)) DISABLE_AXIS_X();
|
||||
if (TERN0(DISABLE_Y, !axis_active.y)) DISABLE_AXIS_Y();
|
||||
if (TERN0(DISABLE_Z, !axis_active.z)) DISABLE_AXIS_Z();
|
||||
if (TERN0(DISABLE_E, !axis_active.e)) disable_e_steppers();
|
||||
|
||||
//
|
||||
// Update Fan speeds
|
||||
@@ -1391,43 +1364,21 @@ void Planner::check_axes_activity() {
|
||||
#endif
|
||||
#define FAN_SET(F) do{ KICKSTART_FAN(F); _FAN_SET(F); }while(0)
|
||||
|
||||
#if HAS_FAN0
|
||||
FAN_SET(0);
|
||||
#endif
|
||||
#if HAS_FAN1
|
||||
FAN_SET(1);
|
||||
#endif
|
||||
#if HAS_FAN2
|
||||
FAN_SET(2);
|
||||
#endif
|
||||
#if HAS_FAN3
|
||||
FAN_SET(3);
|
||||
#endif
|
||||
#if HAS_FAN4
|
||||
FAN_SET(4);
|
||||
#endif
|
||||
#if HAS_FAN5
|
||||
FAN_SET(5);
|
||||
#endif
|
||||
#if HAS_FAN6
|
||||
FAN_SET(6);
|
||||
#endif
|
||||
#if HAS_FAN7
|
||||
FAN_SET(7);
|
||||
#endif
|
||||
TERN_(HAS_FAN0, FAN_SET(0));
|
||||
TERN_(HAS_FAN1, FAN_SET(1));
|
||||
TERN_(HAS_FAN2, FAN_SET(2));
|
||||
TERN_(HAS_FAN3, FAN_SET(3));
|
||||
TERN_(HAS_FAN4, FAN_SET(4));
|
||||
TERN_(HAS_FAN5, FAN_SET(5));
|
||||
TERN_(HAS_FAN6, FAN_SET(6));
|
||||
TERN_(HAS_FAN7, FAN_SET(7));
|
||||
#endif // FAN_COUNT > 0
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
getHighESpeed();
|
||||
#endif
|
||||
TERN_(AUTOTEMP, getHighESpeed());
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
analogWrite(pin_t(HEATER_1_PIN), tail_valve_pressure);
|
||||
#endif
|
||||
#if HAS_HEATER_2
|
||||
analogWrite(pin_t(HEATER_2_PIN), tail_e_to_p_pressure);
|
||||
#endif
|
||||
TERN_(HAS_HEATER_1, analogWrite(pin_t(HEATER_1_PIN), tail_valve_pressure));
|
||||
TERN_(HAS_HEATER_2, analogWrite(pin_t(HEATER_2_PIN), tail_e_to_p_pressure));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1477,11 +1428,8 @@ void Planner::check_axes_activity() {
|
||||
#if HAS_LEVELING
|
||||
|
||||
constexpr xy_pos_t level_fulcrum = {
|
||||
#if ENABLED(Z_SAFE_HOMING)
|
||||
Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT
|
||||
#else
|
||||
X_HOME_POS, Y_HOME_POS
|
||||
#endif
|
||||
TERN(Z_SAFE_HOMING, Z_SAFE_HOMING_X_POINT, X_HOME_POS),
|
||||
TERN(Z_SAFE_HOMING, Z_SAFE_HOMING_Y_POINT, Y_HOME_POS)
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1779,9 +1727,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (thermalManager.tooColdToExtrude(extruder)) {
|
||||
position.e = target.e; // Behave as if the move really took place, but ignore E part
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = target_float.e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = target_float.e);
|
||||
de = 0; // no difference
|
||||
SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP);
|
||||
}
|
||||
@@ -1801,9 +1747,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
#endif
|
||||
if (ignore_e) {
|
||||
position.e = target.e; // Behave as if the move really took place, but ignore E part
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = target_float.e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = target_float.e);
|
||||
de = 0; // no difference
|
||||
SERIAL_ECHO_MSG(STR_ERR_LONG_EXTRUDE_STOP);
|
||||
}
|
||||
@@ -1882,9 +1826,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
|
||||
*/
|
||||
struct DistanceMM : abce_float_t {
|
||||
#if IS_CORE
|
||||
xyz_pos_t head;
|
||||
#endif
|
||||
TERN_(IS_CORE, xyz_pos_t head);
|
||||
} steps_dist_mm;
|
||||
#if IS_CORE
|
||||
#if CORE_IS_XY
|
||||
@@ -1918,9 +1860,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
steps_dist_mm.e = 0.0f;
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
e_move_accumulator += steps_dist_mm.e;
|
||||
#endif
|
||||
TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e);
|
||||
|
||||
if (block->steps.a < MIN_STEPS_PER_SEGMENT && block->steps.b < MIN_STEPS_PER_SEGMENT && block->steps.c < MIN_STEPS_PER_SEGMENT) {
|
||||
block->millimeters = (0
|
||||
@@ -1954,9 +1894,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
* A correction function is permitted to add steps to an axis, it
|
||||
* should *never* remove steps!
|
||||
*/
|
||||
#if ENABLED(BACKLASH_COMPENSATION)
|
||||
backlash.add_correction_steps(da, db, dc, dm, block);
|
||||
#endif
|
||||
TERN_(BACKLASH_COMPENSATION, backlash.add_correction_steps(da, db, dc, dm, block));
|
||||
}
|
||||
|
||||
#if EXTRUDERS
|
||||
@@ -1972,9 +1910,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
MIXER_POPULATE_BLOCK();
|
||||
#endif
|
||||
|
||||
#if HAS_CUTTER
|
||||
block->cutter_power = cutter.power;
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, block->cutter_power = cutter.power);
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i];
|
||||
@@ -2026,9 +1962,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
// Enable extruder(s)
|
||||
#if EXTRUDERS
|
||||
if (esteps) {
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
|
||||
#if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder
|
||||
|
||||
@@ -2195,9 +2129,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
if (!block->steps.a && !block->steps.b && !block->steps.c) {
|
||||
// convert to: acceleration steps/sec^2
|
||||
accel = CEIL(settings.retract_acceleration * steps_per_mm);
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
block->use_advance_lead = false;
|
||||
#endif
|
||||
TERN_(LIN_ADVANCE, block->use_advance_lead = false);
|
||||
}
|
||||
else {
|
||||
#define LIMIT_ACCEL_LONG(AXIS,INDX) do{ \
|
||||
@@ -2260,9 +2192,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
block->use_advance_lead = false;
|
||||
else {
|
||||
const uint32_t max_accel_steps_per_s2 = MAX_E_JERK / (extruder_advance_K[active_extruder] * block->e_D_ratio) * steps_per_mm;
|
||||
#if ENABLED(LA_DEBUG)
|
||||
if (accel > max_accel_steps_per_s2) SERIAL_ECHOLNPGM("Acceleration limited.");
|
||||
#endif
|
||||
if (TERN0(LA_DEBUG, accel > max_accel_steps_per_s2))
|
||||
SERIAL_ECHOLNPGM("Acceleration limited.");
|
||||
NOMORE(accel, max_accel_steps_per_s2);
|
||||
}
|
||||
}
|
||||
@@ -2561,22 +2492,14 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
previous_speed = current_speed;
|
||||
previous_nominal_speed_sqr = block->nominal_speed_sqr;
|
||||
|
||||
// Update the position
|
||||
position = target;
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float = target_float;
|
||||
#endif
|
||||
position = target; // Update the position
|
||||
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
mixer.gradient_control(target_float.z);
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float = target_float);
|
||||
TERN_(GRADIENT_MIX, mixer.gradient_control(target_float.z));
|
||||
TERN_(POWER_LOSS_RECOVERY, block->sdpos = recovery.command_sdpos());
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
block->sdpos = recovery.command_sdpos();
|
||||
#endif
|
||||
return true; // Movement was accepted
|
||||
|
||||
// Movement was accepted
|
||||
return true;
|
||||
} // _populate_block()
|
||||
|
||||
/**
|
||||
@@ -2654,15 +2577,9 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
|
||||
#endif
|
||||
|
||||
// DRYRUN prevents E moves from taking place
|
||||
if (DEBUGGING(DRYRUN)
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
|| cancelable.skipping
|
||||
#endif
|
||||
) {
|
||||
if (DEBUGGING(DRYRUN) || TERN0(CANCEL_OBJECTS, cancelable.skipping)) {
|
||||
position.e = target.e;
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = e);
|
||||
}
|
||||
|
||||
/* <-- add a slash to enable
|
||||
@@ -2697,16 +2614,14 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
|
||||
//*/
|
||||
|
||||
// Queue the movement
|
||||
if (
|
||||
!_buffer_steps(target
|
||||
if (!_buffer_steps(target
|
||||
#if HAS_POSITION_FLOAT
|
||||
, target_float
|
||||
#endif
|
||||
#if HAS_DIST_MM_ARG
|
||||
, cart_dist_mm
|
||||
#endif
|
||||
, fr_mm_s, extruder, millimeters
|
||||
)
|
||||
, fr_mm_s, extruder, millimeters)
|
||||
) return false;
|
||||
|
||||
stepper.wake_up();
|
||||
@@ -2730,9 +2645,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
|
||||
#endif
|
||||
) {
|
||||
xyze_pos_t machine = { rx, ry, rz, e };
|
||||
#if HAS_POSITION_MODIFIERS
|
||||
apply_modifiers(machine);
|
||||
#endif
|
||||
TERN_(HAS_POSITION_MODIFIERS, apply_modifiers(machine));
|
||||
|
||||
#if IS_KINEMATIC
|
||||
|
||||
@@ -2785,12 +2698,8 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
|
||||
*/
|
||||
|
||||
void Planner::set_machine_position_mm(const float &a, const float &b, const float &c, const float &e) {
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
last_extruder = active_extruder;
|
||||
#endif
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.set(a, b, c, e);
|
||||
#endif
|
||||
TERN_(DISTINCT_E_FACTORS, last_extruder = active_extruder);
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.set(a, b, c, e));
|
||||
position.set(LROUND(a * settings.axis_steps_per_mm[A_AXIS]),
|
||||
LROUND(b * settings.axis_steps_per_mm[B_AXIS]),
|
||||
LROUND(c * settings.axis_steps_per_mm[C_AXIS]),
|
||||
@@ -2807,13 +2716,11 @@ void Planner::set_machine_position_mm(const float &a, const float &b, const floa
|
||||
void Planner::set_position_mm(const float &rx, const float &ry, const float &rz, const float &e) {
|
||||
xyze_pos_t machine = { rx, ry, rz, e };
|
||||
#if HAS_POSITION_MODIFIERS
|
||||
{
|
||||
apply_modifiers(machine
|
||||
#if HAS_LEVELING
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
}
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
position_cart.set(rx, ry, rz, e);
|
||||
@@ -2829,21 +2736,13 @@ void Planner::set_position_mm(const float &rx, const float &ry, const float &rz,
|
||||
*/
|
||||
void Planner::set_e_position_mm(const float &e) {
|
||||
const uint8_t axis_index = E_AXIS_N(active_extruder);
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
last_extruder = active_extruder;
|
||||
#endif
|
||||
#if ENABLED(FWRETRACT)
|
||||
float e_new = e - fwretract.current_retract[active_extruder];
|
||||
#else
|
||||
const float e_new = e;
|
||||
#endif
|
||||
TERN_(DISTINCT_E_FACTORS, last_extruder = active_extruder);
|
||||
|
||||
const float e_new = e - TERN0(FWRETRACT, fwretract.current_retract[active_extruder]);
|
||||
position.e = LROUND(settings.axis_steps_per_mm[axis_index] * e_new);
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = e_new;
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
position_cart.e = e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = e_new);
|
||||
TERN_(IS_KINEMATIC, position_cart.e = e);
|
||||
|
||||
if (has_blocks_queued())
|
||||
buffer_sync_block();
|
||||
else
|
||||
@@ -2863,9 +2762,7 @@ void Planner::reset_acceleration_rates() {
|
||||
if (AXIS_CONDITION) NOLESS(highest_rate, max_acceleration_steps_per_s2[i]);
|
||||
}
|
||||
cutoff_long = 4294967295UL / highest_rate; // 0xFFFFFFFFUL
|
||||
#if HAS_LINEAR_E_JERK
|
||||
recalculate_max_e_jerk();
|
||||
#endif
|
||||
TERN_(HAS_LINEAR_E_JERK, recalculate_max_e_jerk());
|
||||
}
|
||||
|
||||
// Recalculate position, steps_to_mm if settings.axis_steps_per_mm changes!
|
||||
|
@@ -197,7 +197,9 @@ typedef struct block_t {
|
||||
|
||||
} block_t;
|
||||
|
||||
#define HAS_POSITION_FLOAT ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL)
|
||||
#if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL)
|
||||
#define HAS_POSITION_FLOAT 1
|
||||
#endif
|
||||
|
||||
#define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
|
||||
|
||||
@@ -547,44 +549,22 @@ class Planner {
|
||||
#if HAS_POSITION_MODIFIERS
|
||||
FORCE_INLINE static void apply_modifiers(xyze_pos_t &pos
|
||||
#if HAS_LEVELING
|
||||
, bool leveling =
|
||||
#if PLANNER_LEVELING
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
, bool leveling = ENABLED(PLANNER_LEVELING)
|
||||
#endif
|
||||
) {
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
skew(pos);
|
||||
#endif
|
||||
#if HAS_LEVELING
|
||||
if (leveling) apply_leveling(pos);
|
||||
#endif
|
||||
#if ENABLED(FWRETRACT)
|
||||
apply_retract(pos);
|
||||
#endif
|
||||
TERN_(SKEW_CORRECTION, skew(pos));
|
||||
TERN_(HAS_LEVELING, if (leveling) apply_leveling(pos));
|
||||
TERN_(FWRETRACT, apply_retract(pos));
|
||||
}
|
||||
|
||||
FORCE_INLINE static void unapply_modifiers(xyze_pos_t &pos
|
||||
#if HAS_LEVELING
|
||||
, bool leveling =
|
||||
#if PLANNER_LEVELING
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
, bool leveling = ENABLED(PLANNER_LEVELING)
|
||||
#endif
|
||||
) {
|
||||
#if ENABLED(FWRETRACT)
|
||||
unapply_retract(pos);
|
||||
#endif
|
||||
#if HAS_LEVELING
|
||||
if (leveling) unapply_leveling(pos);
|
||||
#endif
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
unskew(pos);
|
||||
#endif
|
||||
TERN_(FWRETRACT, unapply_retract(pos));
|
||||
TERN_(HAS_LEVELING, if (leveling) unapply_leveling(pos));
|
||||
TERN_(SKEW_CORRECTION, unskew(pos));
|
||||
}
|
||||
#endif // HAS_POSITION_MODIFIERS
|
||||
|
||||
|
@@ -70,19 +70,14 @@ millis_t PrintCounter::lastDuration;
|
||||
bool PrintCounter::loaded = false;
|
||||
|
||||
millis_t PrintCounter::deltaDuration() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("deltaDuration"));
|
||||
#endif
|
||||
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("deltaDuration")));
|
||||
millis_t tmp = lastDuration;
|
||||
lastDuration = duration();
|
||||
return lastDuration - tmp;
|
||||
}
|
||||
|
||||
void PrintCounter::incFilamentUsed(float const &amount) {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("incFilamentUsed"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("incFilamentUsed")));
|
||||
|
||||
// Refuses to update data if object is not loaded
|
||||
if (!isLoaded()) return;
|
||||
@@ -91,9 +86,7 @@ void PrintCounter::incFilamentUsed(float const &amount) {
|
||||
}
|
||||
|
||||
void PrintCounter::initStats() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("initStats"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("initStats")));
|
||||
|
||||
loaded = true;
|
||||
data = { 0, 0, 0, 0, 0.0
|
||||
@@ -129,9 +122,7 @@ void PrintCounter::initStats() {
|
||||
#endif
|
||||
|
||||
void PrintCounter::loadStats() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("loadStats"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("loadStats")));
|
||||
|
||||
// Check if the EEPROM block is initialized
|
||||
uint8_t value = 0;
|
||||
@@ -164,9 +155,7 @@ void PrintCounter::loadStats() {
|
||||
}
|
||||
|
||||
void PrintCounter::saveStats() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("saveStats"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("saveStats")));
|
||||
|
||||
// Refuses to save data if object is not loaded
|
||||
if (!isLoaded()) return;
|
||||
@@ -176,9 +165,7 @@ void PrintCounter::saveStats() {
|
||||
persistentStore.write_data(address + sizeof(uint8_t), (uint8_t*)&data, sizeof(printStatistics));
|
||||
persistentStore.access_finish();
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onConfigurationStoreWritten(true);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(true));
|
||||
}
|
||||
|
||||
#if HAS_SERVICE_INTERVALS
|
||||
@@ -239,9 +226,7 @@ void PrintCounter::tick() {
|
||||
|
||||
static uint32_t update_next; // = 0
|
||||
if (ELAPSED(now, update_next)) {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("tick"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("tick")));
|
||||
millis_t delta = deltaDuration();
|
||||
data.printTime += delta;
|
||||
|
||||
@@ -267,9 +252,7 @@ void PrintCounter::tick() {
|
||||
|
||||
// @Override
|
||||
bool PrintCounter::start() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("start"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("start")));
|
||||
|
||||
bool paused = isPaused();
|
||||
|
||||
@@ -286,9 +269,7 @@ bool PrintCounter::start() {
|
||||
|
||||
// @Override
|
||||
bool PrintCounter::stop() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("stop"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("stop")));
|
||||
|
||||
if (super::stop()) {
|
||||
data.finishedPrints++;
|
||||
@@ -305,9 +286,7 @@ bool PrintCounter::stop() {
|
||||
|
||||
// @Override
|
||||
void PrintCounter::reset() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("stop"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("stop")));
|
||||
|
||||
super::reset();
|
||||
lastDuration = 0;
|
||||
|
@@ -134,9 +134,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
|
||||
LCD_MESSAGEPGM(MSG_MANUAL_DEPLOY_TOUCHMI);
|
||||
ui.return_to_status();
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI"), CONTINUE_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI"), CONTINUE_STR));
|
||||
wait_for_user_response();
|
||||
ui.reset_status();
|
||||
ui.goto_screen(prev_screen);
|
||||
@@ -241,23 +239,17 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
|
||||
#if QUIET_PROBING
|
||||
|
||||
void Probe::set_probing_paused(const bool p) {
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
thermalManager.pause(p);
|
||||
#endif
|
||||
#if ENABLED(PROBING_FANS_OFF)
|
||||
thermalManager.set_fans_paused(p);
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, thermalManager.pause(p));
|
||||
TERN_(PROBING_FANS_OFF, thermalManager.set_fans_paused(p));
|
||||
#if ENABLED(PROBING_STEPPERS_OFF)
|
||||
disable_e_steppers();
|
||||
#if NONE(DELTA, HOME_AFTER_DEACTIVATE)
|
||||
DISABLE_AXIS_X(); DISABLE_AXIS_Y();
|
||||
#endif
|
||||
#endif
|
||||
if (p) safe_delay(
|
||||
if (p) safe_delay(25
|
||||
#if DELAY_BEFORE_PROBING > 25
|
||||
DELAY_BEFORE_PROBING
|
||||
#else
|
||||
25
|
||||
- 25 + DELAY_BEFORE_PROBING
|
||||
#endif
|
||||
);
|
||||
}
|
||||
@@ -295,22 +287,13 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
||||
serialprintPGM(ds_str);
|
||||
SERIAL_EOL();
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe")));
|
||||
|
||||
wait_for_user_response();
|
||||
ui.reset_status();
|
||||
|
||||
} while(
|
||||
#if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
} while (ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED));
|
||||
|
||||
#endif // PAUSE_BEFORE_DEPLOY_STOW
|
||||
|
||||
@@ -381,11 +364,7 @@ bool Probe::set_deployed(const bool deploy) {
|
||||
do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
|
||||
|
||||
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
|
||||
if (axis_unhomed_error(
|
||||
#if ENABLED(Z_PROBE_SLED)
|
||||
_BV(X_AXIS)
|
||||
#endif
|
||||
)) {
|
||||
if (axis_unhomed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) {
|
||||
SERIAL_ERROR_MSG(STR_STOP_UNHOMED);
|
||||
stop();
|
||||
return true;
|
||||
@@ -481,9 +460,7 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
|
||||
endstops.enable(true);
|
||||
#endif
|
||||
|
||||
#if QUIET_PROBING
|
||||
set_probing_paused(true);
|
||||
#endif
|
||||
TERN_(QUIET_PROBING, set_probing_paused(true));
|
||||
|
||||
// Move down until the probe is triggered
|
||||
do_blocking_move_to_z(z, fr_mm_s);
|
||||
@@ -493,19 +470,11 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
|
||||
#if BOTH(DELTA, SENSORLESS_PROBING)
|
||||
endstops.trigger_state() & (_BV(X_MIN) | _BV(Y_MIN) | _BV(Z_MIN))
|
||||
#else
|
||||
TEST(endstops.trigger_state(),
|
||||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
Z_MIN
|
||||
#else
|
||||
Z_MIN_PROBE
|
||||
#endif
|
||||
)
|
||||
TEST(endstops.trigger_state(), TERN(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, Z_MIN, Z_MIN_PROBE))
|
||||
#endif
|
||||
;
|
||||
|
||||
#if QUIET_PROBING
|
||||
set_probing_paused(false);
|
||||
#endif
|
||||
TERN_(QUIET_PROBING, set_probing_paused(false));
|
||||
|
||||
// Re-enable stealthChop if used. Disable diag1 pin on driver.
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
@@ -615,9 +584,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||
if (try_to_probe(PSTR("SLOW"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW),
|
||||
sanity_check, _MAX(Z_CLEARANCE_MULTI_PROBE, 4) / 2) ) return NAN;
|
||||
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
backlash.measure_with_probe();
|
||||
#endif
|
||||
TERN_(MEASURE_BACKLASH_WHEN_PROBING, backlash.measure_with_probe());
|
||||
|
||||
const float z = current_position.z;
|
||||
|
||||
@@ -638,11 +605,8 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||
|
||||
#if TOTAL_PROBING > 2
|
||||
// Small Z raise after all but the last probe
|
||||
if (p
|
||||
#if EXTRA_PROBING
|
||||
< TOTAL_PROBING - 1
|
||||
#endif
|
||||
) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
|
||||
if (TERN(EXTRA_PROBING, p < TOTAL_PROBING - 1, p))
|
||||
do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -32,9 +32,7 @@
|
||||
|
||||
HAL_SERVO_LIB servo[NUM_SERVOS];
|
||||
|
||||
#if ENABLED(EDITABLE_SERVO_ANGLES)
|
||||
uint16_t servo_angles[NUM_SERVOS][2];
|
||||
#endif
|
||||
TERN_(EDITABLE_SERVO_ANGLES, uint16_t servo_angles[NUM_SERVOS][2]);
|
||||
|
||||
void servo_init() {
|
||||
#if NUM_SERVOS >= 1 && HAS_SERVO_0
|
||||
|
@@ -470,11 +470,9 @@ void Stepper::set_directions() {
|
||||
#if HAS_X_DIR
|
||||
SET_STEP_DIR(X); // A
|
||||
#endif
|
||||
|
||||
#if HAS_Y_DIR
|
||||
SET_STEP_DIR(Y); // B
|
||||
#endif
|
||||
|
||||
#if HAS_Z_DIR
|
||||
SET_STEP_DIR(Z); // C
|
||||
#endif
|
||||
@@ -1503,8 +1501,12 @@ void Stepper::isr() {
|
||||
ENABLE_ISRS();
|
||||
}
|
||||
|
||||
#define ISR_PULSE_CONTROL (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE)
|
||||
#define ISR_MULTI_STEPS (ISR_PULSE_CONTROL && DISABLED(I2S_STEPPER_STREAM))
|
||||
#if MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE
|
||||
#define ISR_PULSE_CONTROL 1
|
||||
#endif
|
||||
#if ISR_PULSE_CONTROL && DISABLED(I2S_STEPPER_STREAM)
|
||||
#define ISR_MULTI_STEPS 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This phase of the ISR should ONLY create the pulses for the steppers.
|
||||
@@ -1872,13 +1874,9 @@ uint32_t Stepper::block_phase_isr() {
|
||||
return interval; // No more queued movements!
|
||||
}
|
||||
|
||||
#if HAS_CUTTER
|
||||
cutter.apply_power(current_block->cutter_power);
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, cutter.apply_power(current_block->cutter_power));
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.info.sdpos = current_block->sdpos;
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.info.sdpos = current_block->sdpos);
|
||||
|
||||
// Flag all moving axes for proper endstop handling
|
||||
|
||||
@@ -2024,9 +2022,7 @@ uint32_t Stepper::block_phase_isr() {
|
||||
last_moved_extruder = stepper_extruder;
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
L64XX_OK_to_power_up = true;
|
||||
#endif
|
||||
TERN_(HAS_L64XX, L64XX_OK_to_power_up = true);
|
||||
set_directions();
|
||||
}
|
||||
|
||||
@@ -2262,17 +2258,11 @@ void Stepper::init() {
|
||||
#endif
|
||||
|
||||
// Init Microstepping Pins
|
||||
#if HAS_MICROSTEPS
|
||||
microstep_init();
|
||||
#endif
|
||||
TERN_(HAS_MICROSTEPS, microstep_init());
|
||||
|
||||
// Init Dir Pins
|
||||
#if HAS_X_DIR
|
||||
X_DIR_INIT();
|
||||
#endif
|
||||
#if HAS_X2_DIR
|
||||
X2_DIR_INIT();
|
||||
#endif
|
||||
TERN_(HAS_X_DIR, X_DIR_INIT());
|
||||
TERN_(HAS_X2_DIR, X2_DIR_INIT());
|
||||
#if HAS_Y_DIR
|
||||
Y_DIR_INIT();
|
||||
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
|
||||
@@ -2466,9 +2456,7 @@ void Stepper::init() {
|
||||
set_directions();
|
||||
|
||||
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
initialized = true;
|
||||
#endif
|
||||
TERN_(HAS_MOTOR_CURRENT_PWM, initialized = true);
|
||||
digipot_init();
|
||||
#endif
|
||||
}
|
||||
@@ -2948,112 +2936,112 @@ void Stepper::report_positions() {
|
||||
*/
|
||||
|
||||
void Stepper::microstep_init() {
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
SET_OUTPUT(X_MS1_PIN);
|
||||
SET_OUTPUT(X_MS2_PIN);
|
||||
#if PIN_EXISTS(X_MS3)
|
||||
SET_OUTPUT(X_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS
|
||||
#if HAS_X2_MS_PINS
|
||||
SET_OUTPUT(X2_MS1_PIN);
|
||||
SET_OUTPUT(X2_MS2_PIN);
|
||||
#if PIN_EXISTS(X2_MS3)
|
||||
SET_OUTPUT(X2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
SET_OUTPUT(Y_MS1_PIN);
|
||||
SET_OUTPUT(Y_MS2_PIN);
|
||||
#if PIN_EXISTS(Y_MS3)
|
||||
SET_OUTPUT(Y_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y2_MS_PINS
|
||||
SET_OUTPUT(Y2_MS1_PIN);
|
||||
SET_OUTPUT(Y2_MS2_PIN);
|
||||
#if PIN_EXISTS(Y2_MS3)
|
||||
SET_OUTPUT(Y2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
SET_OUTPUT(Z_MS1_PIN);
|
||||
SET_OUTPUT(Z_MS2_PIN);
|
||||
#if PIN_EXISTS(Z_MS3)
|
||||
SET_OUTPUT(Z_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS
|
||||
#if HAS_Z2_MS_PINS
|
||||
SET_OUTPUT(Z2_MS1_PIN);
|
||||
SET_OUTPUT(Z2_MS2_PIN);
|
||||
#if PIN_EXISTS(Z2_MS3)
|
||||
SET_OUTPUT(Z2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS
|
||||
#if HAS_Z3_MS_PINS
|
||||
SET_OUTPUT(Z3_MS1_PIN);
|
||||
SET_OUTPUT(Z3_MS2_PIN);
|
||||
#if PIN_EXISTS(Z3_MS3)
|
||||
SET_OUTPUT(Z3_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS
|
||||
#if HAS_Z4_MS_PINS
|
||||
SET_OUTPUT(Z4_MS1_PIN);
|
||||
SET_OUTPUT(Z4_MS2_PIN);
|
||||
#if PIN_EXISTS(Z4_MS3)
|
||||
SET_OUTPUT(Z4_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
SET_OUTPUT(E0_MS1_PIN);
|
||||
SET_OUTPUT(E0_MS2_PIN);
|
||||
#if PIN_EXISTS(E0_MS3)
|
||||
SET_OUTPUT(E0_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
SET_OUTPUT(E1_MS1_PIN);
|
||||
SET_OUTPUT(E1_MS2_PIN);
|
||||
#if PIN_EXISTS(E1_MS3)
|
||||
SET_OUTPUT(E1_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
SET_OUTPUT(E2_MS1_PIN);
|
||||
SET_OUTPUT(E2_MS2_PIN);
|
||||
#if PIN_EXISTS(E2_MS3)
|
||||
SET_OUTPUT(E2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
SET_OUTPUT(E3_MS1_PIN);
|
||||
SET_OUTPUT(E3_MS2_PIN);
|
||||
#if PIN_EXISTS(E3_MS3)
|
||||
SET_OUTPUT(E3_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
SET_OUTPUT(E4_MS1_PIN);
|
||||
SET_OUTPUT(E4_MS2_PIN);
|
||||
#if PIN_EXISTS(E4_MS3)
|
||||
SET_OUTPUT(E4_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
SET_OUTPUT(E5_MS1_PIN);
|
||||
SET_OUTPUT(E5_MS2_PIN);
|
||||
#if PIN_EXISTS(E5_MS3)
|
||||
SET_OUTPUT(E5_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
SET_OUTPUT(E6_MS1_PIN);
|
||||
SET_OUTPUT(E6_MS2_PIN);
|
||||
#if PIN_EXISTS(E6_MS3)
|
||||
SET_OUTPUT(E6_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
SET_OUTPUT(E7_MS1_PIN);
|
||||
SET_OUTPUT(E7_MS2_PIN);
|
||||
#if PIN_EXISTS(E7_MS3)
|
||||
@@ -3068,188 +3056,188 @@ void Stepper::report_positions() {
|
||||
|
||||
void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) {
|
||||
if (ms1 >= 0) switch (driver) {
|
||||
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
case 0:
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
WRITE(X_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS
|
||||
#if HAS_X2_MS_PINS
|
||||
WRITE(X2_MS1_PIN, ms1);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS || HAS_Y2_MS_PINS
|
||||
case 1:
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
WRITE(Y_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y2_MS_PINS
|
||||
WRITE(Y2_MS1_PIN, ms1);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOME_Z_MICROSTEPS
|
||||
#if HAS_SOME_Z_MS_PINS
|
||||
case 2:
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
WRITE(Z_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS
|
||||
#if HAS_Z2_MS_PINS
|
||||
WRITE(Z2_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS
|
||||
#if HAS_Z3_MS_PINS
|
||||
WRITE(Z3_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS
|
||||
#if HAS_Z4_MS_PINS
|
||||
WRITE(Z4_MS1_PIN, ms1);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
case 3: WRITE(E0_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
case 4: WRITE(E1_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
case 5: WRITE(E2_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
case 6: WRITE(E3_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
case 7: WRITE(E4_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
case 8: WRITE(E5_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
case 9: WRITE(E6_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
case 10: WRITE(E7_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
}
|
||||
if (ms2 >= 0) switch (driver) {
|
||||
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
case 0:
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
WRITE(X_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS
|
||||
#if HAS_X2_MS_PINS
|
||||
WRITE(X2_MS2_PIN, ms2);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS || HAS_Y2_MS_PINS
|
||||
case 1:
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
WRITE(Y_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y2_MS_PINS
|
||||
WRITE(Y2_MS2_PIN, ms2);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOME_Z_MICROSTEPS
|
||||
#if HAS_SOME_Z_MS_PINS
|
||||
case 2:
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
WRITE(Z_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS
|
||||
#if HAS_Z2_MS_PINS
|
||||
WRITE(Z2_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS
|
||||
#if HAS_Z3_MS_PINS
|
||||
WRITE(Z3_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS
|
||||
#if HAS_Z4_MS_PINS
|
||||
WRITE(Z4_MS2_PIN, ms2);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
case 3: WRITE(E0_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
case 4: WRITE(E1_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
case 5: WRITE(E2_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
case 6: WRITE(E3_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
case 7: WRITE(E4_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
case 8: WRITE(E5_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
case 9: WRITE(E6_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
case 10: WRITE(E7_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
}
|
||||
if (ms3 >= 0) switch (driver) {
|
||||
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
case 0:
|
||||
#if HAS_X_MICROSTEPS && PIN_EXISTS(X_MS3)
|
||||
#if HAS_X_MS_PINS && PIN_EXISTS(X_MS3)
|
||||
WRITE(X_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS && PIN_EXISTS(X2_MS3)
|
||||
#if HAS_X2_MS_PINS && PIN_EXISTS(X2_MS3)
|
||||
WRITE(X2_MS3_PIN, ms3);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS || HAS_Y2_MS_PINS
|
||||
case 1:
|
||||
#if HAS_Y_MICROSTEPS && PIN_EXISTS(Y_MS3)
|
||||
#if HAS_Y_MS_PINS && PIN_EXISTS(Y_MS3)
|
||||
WRITE(Y_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS && PIN_EXISTS(Y2_MS3)
|
||||
#if HAS_Y2_MS_PINS && PIN_EXISTS(Y2_MS3)
|
||||
WRITE(Y2_MS3_PIN, ms3);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOME_Z_MICROSTEPS
|
||||
#if HAS_SOME_Z_MS_PINS
|
||||
case 2:
|
||||
#if HAS_Z_MICROSTEPS && PIN_EXISTS(Z_MS3)
|
||||
#if HAS_Z_MS_PINS && PIN_EXISTS(Z_MS3)
|
||||
WRITE(Z_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS && PIN_EXISTS(Z2_MS3)
|
||||
#if HAS_Z2_MS_PINS && PIN_EXISTS(Z2_MS3)
|
||||
WRITE(Z2_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS && PIN_EXISTS(Z3_MS3)
|
||||
#if HAS_Z3_MS_PINS && PIN_EXISTS(Z3_MS3)
|
||||
WRITE(Z3_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS && PIN_EXISTS(Z4_MS3)
|
||||
#if HAS_Z4_MS_PINS && PIN_EXISTS(Z4_MS3)
|
||||
WRITE(Z4_MS3_PIN, ms3);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS && PIN_EXISTS(E0_MS3)
|
||||
#if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3)
|
||||
case 3: WRITE(E0_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS && PIN_EXISTS(E1_MS3)
|
||||
#if HAS_E1_MS_PINS && PIN_EXISTS(E1_MS3)
|
||||
case 4: WRITE(E1_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS && PIN_EXISTS(E2_MS3)
|
||||
#if HAS_E2_MS_PINS && PIN_EXISTS(E2_MS3)
|
||||
case 5: WRITE(E2_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS && PIN_EXISTS(E3_MS3)
|
||||
#if HAS_E3_MS_PINS && PIN_EXISTS(E3_MS3)
|
||||
case 6: WRITE(E3_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS && PIN_EXISTS(E4_MS3)
|
||||
#if HAS_E4_MS_PINS && PIN_EXISTS(E4_MS3)
|
||||
case 7: WRITE(E4_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS && PIN_EXISTS(E5_MS3)
|
||||
#if HAS_E5_MS_PINS && PIN_EXISTS(E5_MS3)
|
||||
case 8: WRITE(E5_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS && PIN_EXISTS(E6_MS3)
|
||||
#if HAS_E6_MS_PINS && PIN_EXISTS(E6_MS3)
|
||||
case 9: WRITE(E6_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS && PIN_EXISTS(E7_MS3)
|
||||
#if HAS_E7_MS_PINS && PIN_EXISTS(E7_MS3)
|
||||
case 10: WRITE(E7_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
}
|
||||
@@ -3288,7 +3276,7 @@ void Stepper::report_positions() {
|
||||
|
||||
void Stepper::microstep_readings() {
|
||||
SERIAL_ECHOLNPGM("MS1|MS2|MS3 Pins");
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
SERIAL_ECHOPGM("X: ");
|
||||
SERIAL_CHAR('0' + READ(X_MS1_PIN), '0' + READ(X_MS2_PIN)
|
||||
#if PIN_EXISTS(X_MS3)
|
||||
@@ -3296,7 +3284,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
SERIAL_ECHOPGM("Y: ");
|
||||
SERIAL_CHAR('0' + READ(Y_MS1_PIN), '0' + READ(Y_MS2_PIN)
|
||||
#if PIN_EXISTS(Y_MS3)
|
||||
@@ -3304,7 +3292,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
SERIAL_ECHOPGM("Z: ");
|
||||
SERIAL_CHAR('0' + READ(Z_MS1_PIN), '0' + READ(Z_MS2_PIN)
|
||||
#if PIN_EXISTS(Z_MS3)
|
||||
@@ -3312,7 +3300,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
SERIAL_ECHOPGM("E0: ");
|
||||
SERIAL_CHAR('0' + READ(E0_MS1_PIN), '0' + READ(E0_MS2_PIN)
|
||||
#if PIN_EXISTS(E0_MS3)
|
||||
@@ -3320,7 +3308,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
SERIAL_ECHOPGM("E1: ");
|
||||
SERIAL_CHAR('0' + READ(E1_MS1_PIN), '0' + READ(E1_MS2_PIN)
|
||||
#if PIN_EXISTS(E1_MS3)
|
||||
@@ -3328,7 +3316,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
SERIAL_ECHOPGM("E2: ");
|
||||
SERIAL_CHAR('0' + READ(E2_MS1_PIN), '0' + READ(E2_MS2_PIN)
|
||||
#if PIN_EXISTS(E2_MS3)
|
||||
@@ -3336,7 +3324,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
SERIAL_ECHOPGM("E3: ");
|
||||
SERIAL_CHAR('0' + READ(E3_MS1_PIN), '0' + READ(E3_MS2_PIN)
|
||||
#if PIN_EXISTS(E3_MS3)
|
||||
@@ -3344,7 +3332,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
SERIAL_ECHOPGM("E4: ");
|
||||
SERIAL_CHAR('0' + READ(E4_MS1_PIN), '0' + READ(E4_MS2_PIN)
|
||||
#if PIN_EXISTS(E4_MS3)
|
||||
@@ -3352,7 +3340,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
SERIAL_ECHOPGM("E5: ");
|
||||
SERIAL_CHAR('0' + READ(E5_MS1_PIN), '0' + READ(E5_MS2_PIN)
|
||||
#if PIN_EXISTS(E5_MS3)
|
||||
@@ -3360,7 +3348,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
SERIAL_ECHOPGM("E6: ");
|
||||
SERIAL_CHAR('0' + READ(E6_MS1_PIN), '0' + READ(E6_MS2_PIN)
|
||||
#if PIN_EXISTS(E6_MS3)
|
||||
@@ -3368,7 +3356,7 @@ void Stepper::report_positions() {
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
SERIAL_ECHOPGM("E7: ");
|
||||
SERIAL_CHAR('0' + READ(E7_MS1_PIN), '0' + READ(E7_MS2_PIN)
|
||||
#if PIN_EXISTS(E7_MS3)
|
||||
|
@@ -33,21 +33,13 @@
|
||||
#include "indirection.h"
|
||||
|
||||
void restore_stepper_drivers() {
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
restore_trinamic_drivers();
|
||||
#endif
|
||||
TERN_(HAS_TRINAMIC_CONFIG, restore_trinamic_drivers());
|
||||
}
|
||||
|
||||
void reset_stepper_drivers() {
|
||||
#if HAS_DRIVER(TMC26X)
|
||||
tmc26x_init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
L64xxManager.init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
reset_trinamic_drivers();
|
||||
#endif
|
||||
TERN_(HAS_L64XX, L64xxManager.init_to_defaults());
|
||||
TERN_(HAS_TRINAMIC_CONFIG, reset_trinamic_drivers());
|
||||
}
|
||||
|
@@ -140,9 +140,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@@ -181,9 +179,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@@ -475,9 +471,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@@ -523,9 +517,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@@ -569,15 +561,10 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
st.sdoff(0);
|
||||
st.rms_current(mA);
|
||||
st.microsteps(microsteps);
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
st.dedge(true);
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, st.dedge(true));
|
||||
st.intpol(INTERPOLATE);
|
||||
st.diss2g(true); // Disable short to ground protection. Too many false readings?
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
st.rdsel(0b01);
|
||||
#endif
|
||||
TERN_(TMC_DEBUG, st.rdsel(0b01));
|
||||
}
|
||||
#endif // TMC2660
|
||||
|
||||
@@ -592,9 +579,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@@ -633,9 +618,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
@@ -236,15 +236,9 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
||||
#ifdef BED_MAXTEMP
|
||||
int16_t Temperature::maxtemp_raw_BED = HEATER_BED_RAW_HI_TEMP;
|
||||
#endif
|
||||
#if WATCH_BED
|
||||
bed_watch_t Temperature::watch_bed; // = { 0 }
|
||||
#endif
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
millis_t Temperature::next_bed_check_ms;
|
||||
#endif
|
||||
#if HEATER_IDLE_HANDLER
|
||||
hotend_idle_t Temperature::bed_idle; // = { 0 }
|
||||
#endif
|
||||
TERN_(WATCH_BED, bed_watch_t Temperature::watch_bed); // = { 0 }
|
||||
TERN(PIDTEMPBED,, millis_t Temperature::next_bed_check_ms);
|
||||
TERN_(HEATER_IDLE_HANDLER, hotend_idle_t Temperature::bed_idle); // = { 0 }
|
||||
#endif // HAS_HEATED_BED
|
||||
|
||||
#if HAS_TEMP_CHAMBER
|
||||
@@ -403,15 +397,11 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||
bool heated = false;
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_FAN
|
||||
next_auto_fan_check_ms = next_temp_ms + 2500UL;
|
||||
#endif
|
||||
TERN_(HAS_AUTO_FAN, next_auto_fan_check_ms = next_temp_ms + 2500UL);
|
||||
|
||||
if (target > GHV(BED_MAXTEMP - 10, temp_range[heater].maxtemp - 15)) {
|
||||
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -427,9 +417,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||
LEDColor color = ONHEATINGSTART();
|
||||
#endif
|
||||
|
||||
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
|
||||
adaptive_fan_slowing = false;
|
||||
#endif
|
||||
TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = false);
|
||||
|
||||
// PID Tuning loop
|
||||
while (wait_for_heatup) {
|
||||
@@ -525,9 +513,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||
#endif
|
||||
if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
|
||||
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -562,9 +548,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
|
||||
#endif
|
||||
if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
|
||||
SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
|
||||
break;
|
||||
}
|
||||
@@ -610,12 +594,9 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
printerEventLEDs.onPidTuningDone(color);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_DONE);
|
||||
#endif
|
||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
||||
|
||||
goto EXIT_M303;
|
||||
}
|
||||
@@ -624,17 +605,12 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||
|
||||
disable_all_heaters();
|
||||
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
printerEventLEDs.onPidTuningDone(color);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_DONE);
|
||||
#endif
|
||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
||||
|
||||
EXIT_M303:
|
||||
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
|
||||
adaptive_fan_slowing = true;
|
||||
#endif
|
||||
TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -653,11 +629,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
|
||||
case H_CHAMBER: return temp_chamber.soft_pwm_amount;
|
||||
#endif
|
||||
default:
|
||||
return (0
|
||||
#if HAS_HOTEND
|
||||
+ temp_hotend[heater_id].soft_pwm_amount
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[heater_id].soft_pwm_amount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,19 +743,16 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg,
|
||||
|
||||
static uint8_t killed = 0;
|
||||
|
||||
if (IsRunning()
|
||||
#if BOGUS_TEMPERATURE_GRACE_PERIOD
|
||||
&& killed == 2
|
||||
#endif
|
||||
) {
|
||||
if (IsRunning() && TERN1(BOGUS_TEMPERATURE_GRACE_PERIOD, killed == 2)) {
|
||||
SERIAL_ERROR_START();
|
||||
serialprintPGM(serial_msg);
|
||||
SERIAL_ECHOPGM(STR_STOPPED_HEATER);
|
||||
if (heater >= 0) SERIAL_ECHO((int)heater);
|
||||
#if HAS_HEATED_CHAMBER
|
||||
else if (heater == H_CHAMBER) SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
|
||||
#endif
|
||||
else SERIAL_ECHOPGM(STR_HEATER_BED);
|
||||
if (heater >= 0)
|
||||
SERIAL_ECHO((int)heater);
|
||||
else if (TERN0(HAS_HEATED_CHAMBER, heater == H_CHAMBER))
|
||||
SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
|
||||
else
|
||||
SERIAL_ECHOPGM(STR_HEATER_BED);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -839,9 +808,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
||||
|
||||
if (temp_hotend[ee].target == 0
|
||||
|| pid_error < -(PID_FUNCTIONAL_RANGE)
|
||||
#if HEATER_IDLE_HANDLER
|
||||
|| hotend_idle[ee].timed_out
|
||||
#endif
|
||||
|| TERN0(HEATER_IDLE_HANDLER, hotend_idle[ee].timed_out)
|
||||
) {
|
||||
pid_output = 0;
|
||||
pid_reset[ee] = true;
|
||||
@@ -1015,9 +982,8 @@ void Temperature::manage_heater() {
|
||||
if (!inited) return watchdog_refresh();
|
||||
#endif
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
if (emergency_parser.killed_by_M112) kill(M112_KILL_STR, nullptr, true);
|
||||
#endif
|
||||
if (TERN0(EMERGENCY_PARSER, emergency_parser.killed_by_M112))
|
||||
kill(M112_KILL_STR, nullptr, true);
|
||||
|
||||
if (!raw_temps_ready) return;
|
||||
|
||||
@@ -1043,9 +1009,7 @@ void Temperature::manage_heater() {
|
||||
_temp_error((heater_ind_t)e, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
|
||||
#endif
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
hotend_idle[e].update(ms);
|
||||
#endif
|
||||
TERN_(HEATER_IDLE_HANDLER, hotend_idle[e].update(ms));
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
||||
// Check for thermal runaway
|
||||
@@ -1106,7 +1070,10 @@ void Temperature::manage_heater() {
|
||||
}
|
||||
#endif // WATCH_BED
|
||||
|
||||
#define PAUSE_CHANGE_REQD BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
|
||||
#if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
|
||||
#define PAUSE_CHANGE_REQD 1
|
||||
#endif
|
||||
|
||||
#if PAUSE_CHANGE_REQD
|
||||
static bool last_pause_state;
|
||||
#endif
|
||||
@@ -1115,23 +1082,15 @@ void Temperature::manage_heater() {
|
||||
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
if (PENDING(ms, next_bed_check_ms)
|
||||
#if PAUSE_CHANGE_REQD
|
||||
&& paused == last_pause_state
|
||||
#endif
|
||||
&& TERN1(PAUSE_CHANGE_REQD, paused == last_pause_state)
|
||||
) break;
|
||||
next_bed_check_ms = ms + BED_CHECK_INTERVAL;
|
||||
#if PAUSE_CHANGE_REQD
|
||||
last_pause_state = paused;
|
||||
#endif
|
||||
TERN_(PAUSE_CHANGE_REQD, last_pause_state = paused);
|
||||
#endif
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
bed_idle.update(ms);
|
||||
#endif
|
||||
TERN_(HEATER_IDLE_HANDLER, bed_idle.update(ms));
|
||||
|
||||
#if HAS_THERMALLY_PROTECTED_BED
|
||||
thermal_runaway_protection(tr_state_machine_bed, temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
|
||||
#endif
|
||||
TERN_(HAS_THERMALLY_PROTECTED_BED, thermal_runaway_protection(tr_state_machine_bed, temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS));
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
if (bed_idle.timed_out) {
|
||||
@@ -1207,9 +1166,7 @@ void Temperature::manage_heater() {
|
||||
WRITE_HEATER_CHAMBER(LOW);
|
||||
}
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
|
||||
thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS);
|
||||
#endif
|
||||
TERN_(THERMAL_PROTECTION_CHAMBER, thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS));
|
||||
}
|
||||
|
||||
// TODO: Implement true PID pwm
|
||||
@@ -1302,36 +1259,16 @@ void Temperature::manage_heater() {
|
||||
SERIAL_ECHOPAIR_F(" C", t.sh_c_coeff, 9);
|
||||
SERIAL_ECHOPGM(" ; ");
|
||||
serialprintPGM(
|
||||
#if ENABLED(HEATER_0_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_0 ? PSTR("HOTEND 0") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_1_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_1 ? PSTR("HOTEND 1") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_2_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_2 ? PSTR("HOTEND 2") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_3_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_3 ? PSTR("HOTEND 3") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_4_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_4 ? PSTR("HOTEND 4") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_5_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_5 ? PSTR("HOTEND 5") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_6_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_6 ? PSTR("HOTEND 6") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_7_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_7 ? PSTR("HOTEND 7") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_BED_USER_THERMISTOR)
|
||||
t_index == CTI_BED ? PSTR("BED") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_CHAMBER_USER_THERMISTOR)
|
||||
t_index == CTI_CHAMBER ? PSTR("CHAMBER") :
|
||||
#endif
|
||||
TERN_(HEATER_0_USER_THERMISTOR, t_index == CTI_HOTEND_0 ? PSTR("HOTEND 0") :)
|
||||
TERN_(HEATER_1_USER_THERMISTOR, t_index == CTI_HOTEND_1 ? PSTR("HOTEND 1") :)
|
||||
TERN_(HEATER_2_USER_THERMISTOR, t_index == CTI_HOTEND_2 ? PSTR("HOTEND 2") :)
|
||||
TERN_(HEATER_3_USER_THERMISTOR, t_index == CTI_HOTEND_3 ? PSTR("HOTEND 3") :)
|
||||
TERN_(HEATER_4_USER_THERMISTOR, t_index == CTI_HOTEND_4 ? PSTR("HOTEND 4") :)
|
||||
TERN_(HEATER_5_USER_THERMISTOR, t_index == CTI_HOTEND_5 ? PSTR("HOTEND 5") :)
|
||||
TERN_(HEATER_6_USER_THERMISTOR, t_index == CTI_HOTEND_6 ? PSTR("HOTEND 6") :)
|
||||
TERN_(HEATER_7_USER_THERMISTOR, t_index == CTI_HOTEND_7 ? PSTR("HOTEND 7") :)
|
||||
TERN_(HEATER_BED_USER_THERMISTOR, t_index == CTI_BED ? PSTR("BED") :)
|
||||
TERN_(HEATER_CHAMBER_USER_THERMISTOR, t_index == CTI_CHAMBER ? PSTR("CHAMBER") :)
|
||||
nullptr
|
||||
);
|
||||
SERIAL_EOL();
|
||||
@@ -1387,12 +1324,7 @@ void Temperature::manage_heater() {
|
||||
// Derived from RepRap FiveD extruder::getTemperature()
|
||||
// For hot end temperature measurement.
|
||||
float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
if (e > HOTENDS)
|
||||
#else
|
||||
if (e >= HOTENDS)
|
||||
#endif
|
||||
{
|
||||
if (e > HOTENDS - DISABLED(TEMP_SENSOR_1_AS_REDUNDANT)) {
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ECHO((int)e);
|
||||
SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
|
||||
@@ -1577,21 +1509,11 @@ void Temperature::updateTemperaturesFromRawValues() {
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw);
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw);
|
||||
#endif
|
||||
#if HAS_TEMP_PROBE
|
||||
temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw);
|
||||
#endif
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1);
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
filwidth.update_measured_mm();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw));
|
||||
TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw));
|
||||
TERN_(HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw));
|
||||
TERN_(TEMP_SENSOR_1_AS_REDUNDANT, redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1));
|
||||
TERN_(FILAMENT_WIDTH_SENSOR, filwidth.update_measured_mm());
|
||||
|
||||
// Reset the watchdog on good temperature measurement
|
||||
watchdog_refresh();
|
||||
@@ -1637,9 +1559,7 @@ void Temperature::updateTemperaturesFromRawValues() {
|
||||
*/
|
||||
void Temperature::init() {
|
||||
|
||||
#if ENABLED(MAX6675_IS_MAX31865)
|
||||
max31865.begin(MAX31865_2WIRE); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
|
||||
#endif
|
||||
TERN_(MAX6675_IS_MAX31865, max31865.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
|
||||
|
||||
#if EARLY_WATCHDOG
|
||||
// Flag that the thermalManager should be running
|
||||
@@ -1931,9 +1851,7 @@ void Temperature::init() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
paused = false;
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, paused = false);
|
||||
}
|
||||
|
||||
#if WATCH_HOTENDS
|
||||
@@ -2004,9 +1922,7 @@ void Temperature::init() {
|
||||
#if HEATER_IDLE_HANDLER
|
||||
// If the heater idle timeout expires, restart
|
||||
if ((heater_id >= 0 && hotend_idle[heater_id].timed_out)
|
||||
#if HAS_HEATED_BED
|
||||
|| (heater_id < 0 && bed_idle.timed_out)
|
||||
#endif
|
||||
|| TERN0(HAS_HEATED_BED, (heater_id < 0 && bed_idle.timed_out))
|
||||
) {
|
||||
sm.state = TRInactive;
|
||||
tr_target_temperature[heater_index] = 0;
|
||||
@@ -2065,26 +1981,16 @@ void Temperature::init() {
|
||||
|
||||
void Temperature::disable_all_heaters() {
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
planner.autotemp_enabled = false;
|
||||
#endif
|
||||
TERN_(AUTOTEMP, planner.autotemp_enabled = false);
|
||||
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() setTargetHotend(0, e);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
setTargetBed(0);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
setTargetChamber(0);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, setTargetBed(0));
|
||||
TERN_(HAS_HEATED_CHAMBER, setTargetChamber(0));
|
||||
|
||||
// Unpause and reset everything
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
pause(false);
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, pause(false));
|
||||
|
||||
#define DISABLE_HEATER(N) { \
|
||||
setTargetHotend(0, N); \
|
||||
@@ -2115,13 +2021,8 @@ void Temperature::disable_all_heaters() {
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() if (degTargetHotend(e) > (EXTRUDE_MINTEMP) / 2) return true;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
if (degTargetBed() > BED_MINTEMP) return true;
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
if (degTargetChamber() > CHAMBER_MINTEMP) return true;
|
||||
#endif
|
||||
return false;
|
||||
return TERN0(HAS_HEATED_BED, degTargetBed() > BED_MINTEMP)
|
||||
|| TERN0(HAS_HEATED_CHAMBER, degTargetChamber() > CHAMBER_MINTEMP);
|
||||
}
|
||||
|
||||
void Temperature::check_timer_autostart(const bool can_start, const bool can_stop) {
|
||||
@@ -2143,16 +2044,12 @@ void Temperature::disable_all_heaters() {
|
||||
if (p != paused) {
|
||||
paused = p;
|
||||
if (p) {
|
||||
HOTEND_LOOP() hotend_idle[e].expire(); // timeout immediately
|
||||
#if HAS_HEATED_BED
|
||||
bed_idle.expire(); // timeout immediately
|
||||
#endif
|
||||
HOTEND_LOOP() hotend_idle[e].expire(); // Timeout immediately
|
||||
TERN_(HAS_HEATED_BED, bed_idle.expire()); // Timeout immediately
|
||||
}
|
||||
else {
|
||||
HOTEND_LOOP() reset_hotend_idle_timer(e);
|
||||
#if HAS_HEATED_BED
|
||||
reset_bed_idle_timer();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, reset_bed_idle_timer());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2303,46 +2200,19 @@ void Temperature::update_raw_temperatures() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_ADC_2
|
||||
temp_hotend[2].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_3
|
||||
temp_hotend[3].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_4
|
||||
temp_hotend[4].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_5
|
||||
temp_hotend[5].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
temp_hotend[6].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
temp_hotend[7].update();
|
||||
#endif
|
||||
TERN_(HAS_TEMP_ADC_2, temp_hotend[2].update());
|
||||
TERN_(HAS_TEMP_ADC_3, temp_hotend[3].update());
|
||||
TERN_(HAS_TEMP_ADC_4, temp_hotend[4].update());
|
||||
TERN_(HAS_TEMP_ADC_5, temp_hotend[5].update());
|
||||
TERN_(HAS_TEMP_ADC_6, temp_hotend[6].update());
|
||||
TERN_(HAS_TEMP_ADC_7, temp_hotend[7].update());
|
||||
TERN_(HAS_HEATED_BED, temp_bed.update());
|
||||
TERN_(HAS_TEMP_CHAMBER, temp_chamber.update());
|
||||
TERN_(HAS_TEMP_PROBE, temp_probe.update());
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
temp_bed.update();
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_CHAMBER
|
||||
temp_chamber.update();
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_PROBE
|
||||
temp_probe.update();
|
||||
#endif
|
||||
|
||||
#if HAS_JOY_ADC_X
|
||||
joystick.x.update();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
joystick.y.update();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
joystick.z.update();
|
||||
#endif
|
||||
TERN_(HAS_JOY_ADC_X, joystick.x.update());
|
||||
TERN_(HAS_JOY_ADC_Y, joystick.y.update());
|
||||
TERN_(HAS_JOY_ADC_Z, joystick.z.update());
|
||||
|
||||
raw_temps_ready = true;
|
||||
}
|
||||
@@ -2353,38 +2223,20 @@ void Temperature::readings_ready() {
|
||||
if (!raw_temps_ready) update_raw_temperatures();
|
||||
|
||||
// Filament Sensor - can be read any time since IIR filtering is used
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
filwidth.reading_ready();
|
||||
#endif
|
||||
TERN_(FILAMENT_WIDTH_SENSOR, filwidth.reading_ready());
|
||||
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() temp_hotend[e].reset();
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
temp_hotend[1].reset();
|
||||
#endif
|
||||
TERN_(TEMP_SENSOR_1_AS_REDUNDANT, temp_hotend[1].reset());
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
temp_bed.reset();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, temp_bed.reset());
|
||||
TERN_(HAS_TEMP_CHAMBER, temp_chamber.reset());
|
||||
TERN_(HAS_TEMP_PROBE, temp_probe.reset());
|
||||
|
||||
#if HAS_TEMP_CHAMBER
|
||||
temp_chamber.reset();
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_PROBE
|
||||
temp_probe.reset();
|
||||
#endif
|
||||
|
||||
#if HAS_JOY_ADC_X
|
||||
joystick.x.reset();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
joystick.y.reset();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
joystick.z.reset();
|
||||
#endif
|
||||
TERN_(HAS_JOY_ADC_X, joystick.x.reset());
|
||||
TERN_(HAS_JOY_ADC_Y, joystick.y.reset());
|
||||
TERN_(HAS_JOY_ADC_Z, joystick.z.reset());
|
||||
|
||||
#if HAS_HOTEND
|
||||
|
||||
@@ -2412,9 +2264,7 @@ void Temperature::readings_ready() {
|
||||
if (tdir) {
|
||||
const int16_t rawtemp = temp_hotend[e].raw * tdir; // normal direction, +rawtemp, else -rawtemp
|
||||
const bool heater_on = (temp_hotend[e].target > 0
|
||||
#if ENABLED(PIDTEMP)
|
||||
|| temp_hotend[e].soft_pwm_amount > 0
|
||||
#endif
|
||||
|| TERN0(PIDTEMP, temp_hotend[e].soft_pwm_amount) > 0
|
||||
);
|
||||
if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error((heater_ind_t)e);
|
||||
if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) {
|
||||
@@ -2438,10 +2288,8 @@ void Temperature::readings_ready() {
|
||||
#else
|
||||
#define BEDCMP(A,B) ((A)>=(B))
|
||||
#endif
|
||||
const bool bed_on = (temp_bed.target > 0)
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
|| (temp_bed.soft_pwm_amount > 0)
|
||||
#endif
|
||||
const bool bed_on = temp_bed.target > 0
|
||||
|| TERN0(PIDTEMPBED, temp_bed.soft_pwm_amount) > 0
|
||||
;
|
||||
if (BEDCMP(temp_bed.raw, maxtemp_raw_BED)) max_temp_error(H_BED);
|
||||
if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED);
|
||||
@@ -2774,10 +2622,8 @@ void Temperature::tick() {
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() soft_pwm_hotend[e].dec();
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
soft_pwm_bed.dec();
|
||||
#endif
|
||||
} // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
|
||||
TERN_(HAS_HEATED_BED, soft_pwm_bed.dec());
|
||||
}
|
||||
|
||||
#endif // SLOW_PWM_HEATERS
|
||||
|
||||
@@ -3218,9 +3064,7 @@ void Temperature::tick() {
|
||||
|
||||
if (wait_for_heatup) {
|
||||
ui.reset_status();
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
printerEventLEDs.onHeatingDone();
|
||||
#endif
|
||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onHeatingDone());
|
||||
}
|
||||
|
||||
return wait_for_heatup;
|
||||
|
@@ -173,7 +173,9 @@ enum ADCSensorState : char {
|
||||
#define unscalePID_d(d) ( float(d) * PID_dT )
|
||||
#endif
|
||||
|
||||
#define G26_CLICK_CAN_CANCEL (HAS_LCD_MENU && ENABLED(G26_MESH_VALIDATION))
|
||||
#if BOTH(HAS_LCD_MENU, G26_MESH_VALIDATION)
|
||||
#define G26_CLICK_CAN_CANCEL 1
|
||||
#endif
|
||||
|
||||
// A temperature sensor
|
||||
typedef struct TempInfo {
|
||||
@@ -317,30 +319,16 @@ class Temperature {
|
||||
|
||||
public:
|
||||
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
#define HOTEND_TEMPS (HOTENDS + 1)
|
||||
#else
|
||||
#define HOTEND_TEMPS HOTENDS
|
||||
#endif
|
||||
#if HAS_HOTEND
|
||||
#define HOTEND_TEMPS (HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT))
|
||||
static hotend_info_t temp_hotend[HOTEND_TEMPS];
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
static bed_info_t temp_bed;
|
||||
#endif
|
||||
#if HAS_TEMP_PROBE
|
||||
static probe_info_t temp_probe;
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
static chamber_info_t temp_chamber;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, static bed_info_t temp_bed);
|
||||
TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe);
|
||||
TERN_(HAS_TEMP_CHAMBER, static chamber_info_t temp_chamber);
|
||||
|
||||
#if ENABLED(AUTO_POWER_E_FANS)
|
||||
static uint8_t autofan_speed[HOTENDS];
|
||||
#endif
|
||||
#if ENABLED(AUTO_POWER_CHAMBER_FAN)
|
||||
static uint8_t chamberfan_speed;
|
||||
#endif
|
||||
TERN_(AUTO_POWER_E_FANS, static uint8_t autofan_speed[HOTENDS]);
|
||||
TERN_(AUTO_POWER_CHAMBER_FAN, static uint8_t chamberfan_speed);
|
||||
|
||||
#if ENABLED(FAN_SOFT_PWM)
|
||||
static uint8_t soft_pwm_amount_fan[FAN_COUNT],
|
||||
@@ -367,25 +355,17 @@ class Temperature {
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
static hotend_idle_t hotend_idle[HOTENDS];
|
||||
#if HAS_HEATED_BED
|
||||
static hotend_idle_t bed_idle;
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static hotend_idle_t chamber_idle;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, static hotend_idle_t bed_idle);
|
||||
TERN_(HAS_HEATED_CHAMBER, static hotend_idle_t chamber_idle);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
#if EARLY_WATCHDOG
|
||||
static bool inited; // If temperature controller is running
|
||||
#endif
|
||||
TERN_(EARLY_WATCHDOG, static bool inited); // If temperature controller is running
|
||||
|
||||
static volatile bool raw_temps_ready;
|
||||
|
||||
#if WATCH_HOTENDS
|
||||
static hotend_watch_t watch_hotend[HOTENDS];
|
||||
#endif
|
||||
TERN_(WATCH_HOTENDS, static hotend_watch_t watch_hotend[HOTENDS]);
|
||||
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
static uint16_t redundant_temperature_raw;
|
||||
@@ -397,17 +377,11 @@ class Temperature {
|
||||
static lpq_ptr_t lpq_ptr;
|
||||
#endif
|
||||
|
||||
#if HOTENDS
|
||||
static temp_range_t temp_range[HOTENDS];
|
||||
#endif
|
||||
TERN_(HAS_HOTEND, static temp_range_t temp_range[HOTENDS]);
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
#if WATCH_BED
|
||||
static bed_watch_t watch_bed;
|
||||
#endif
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
static millis_t next_bed_check_ms;
|
||||
#endif
|
||||
TERN_(WATCH_BED, static bed_watch_t watch_bed);
|
||||
TERN(PIDTEMPBED,,static millis_t next_bed_check_ms);
|
||||
#ifdef BED_MINTEMP
|
||||
static int16_t mintemp_raw_BED;
|
||||
#endif
|
||||
@@ -417,9 +391,7 @@ class Temperature {
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
#if WATCH_CHAMBER
|
||||
static chamber_watch_t watch_chamber;
|
||||
#endif
|
||||
TERN_(WATCH_CHAMBER, static chamber_watch_t watch_chamber);
|
||||
static millis_t next_chamber_check_ms;
|
||||
#ifdef CHAMBER_MINTEMP
|
||||
static int16_t mintemp_raw_CHAMBER;
|
||||
@@ -437,13 +409,9 @@ class Temperature {
|
||||
static millis_t preheat_end_time[HOTENDS];
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_FAN
|
||||
static millis_t next_auto_fan_check_ms;
|
||||
#endif
|
||||
TERN_(HAS_AUTO_FAN, static millis_t next_auto_fan_check_ms);
|
||||
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
static bool paused;
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, static bool paused);
|
||||
|
||||
public:
|
||||
#if HAS_ADC_BUTTONS
|
||||
@@ -451,9 +419,7 @@ class Temperature {
|
||||
static uint8_t ADCKey_count;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
static int16_t lpq_len;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, static int16_t lpq_len);
|
||||
|
||||
/**
|
||||
* Instance Methods
|
||||
@@ -524,9 +490,7 @@ class Temperature {
|
||||
|
||||
static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); }
|
||||
|
||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||
static uint8_t fan_speed_scaler[FAN_COUNT];
|
||||
#endif
|
||||
TERN_(ADAPTIVE_FAN_SLOWING, static uint8_t fan_speed_scaler[FAN_COUNT]);
|
||||
|
||||
static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) {
|
||||
UNUSED(target); // Potentially unused!
|
||||
@@ -593,29 +557,17 @@ class Temperature {
|
||||
//deg=degreeCelsius
|
||||
|
||||
FORCE_INLINE static float degHotend(const uint8_t E_NAME) {
|
||||
return (0
|
||||
#if HOTENDS
|
||||
+ temp_hotend[HOTEND_INDEX].celsius
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
FORCE_INLINE static int16_t rawHotendTemp(const uint8_t E_NAME) {
|
||||
return (0
|
||||
#if HOTENDS
|
||||
+ temp_hotend[HOTEND_INDEX].raw
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
|
||||
}
|
||||
#endif
|
||||
|
||||
FORCE_INLINE static int16_t degTargetHotend(const uint8_t E_NAME) {
|
||||
return (0
|
||||
#if HOTENDS
|
||||
+ temp_hotend[HOTEND_INDEX].target
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].target);
|
||||
}
|
||||
|
||||
#if WATCH_HOTENDS
|
||||
@@ -634,9 +586,7 @@ class Temperature {
|
||||
else if (temp_hotend[ee].target == 0)
|
||||
start_preheat_time(ee);
|
||||
#endif
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
temp_hotend[ee].target = _MIN(celsius, temp_range[ee].maxtemp - 15);
|
||||
start_watching_hotend(ee);
|
||||
}
|
||||
@@ -680,9 +630,7 @@ class Temperature {
|
||||
#endif
|
||||
|
||||
static void setTargetBed(const int16_t celsius) {
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
temp_bed.target =
|
||||
#ifdef BED_MAXTEMP
|
||||
_MIN(celsius, BED_MAXTEMP - 10)
|
||||
@@ -784,9 +732,7 @@ class Temperature {
|
||||
*/
|
||||
#if ENABLED(PIDTEMP)
|
||||
FORCE_INLINE static void updatePID() {
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
last_e_position = 0;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, last_e_position = 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -831,9 +777,7 @@ class Temperature {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
static void set_heating_message(const uint8_t e);
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e));
|
||||
|
||||
private:
|
||||
static void update_raw_temperatures();
|
||||
@@ -862,13 +806,9 @@ class Temperature {
|
||||
|
||||
static float get_pid_output_hotend(const uint8_t e);
|
||||
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
static float get_pid_output_bed();
|
||||
#endif
|
||||
TERN_(PIDTEMPBED, static float get_pid_output_bed());
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static float get_pid_output_chamber();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_CHAMBER, static float get_pid_output_chamber());
|
||||
|
||||
static void _temp_error(const heater_ind_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
|
||||
static void min_temp_error(const heater_ind_t e);
|
||||
@@ -885,15 +825,9 @@ class Temperature {
|
||||
TRState state = TRInactive;
|
||||
} tr_state_machine_t;
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
||||
static tr_state_machine_t tr_state_machine[HOTENDS];
|
||||
#endif
|
||||
#if HAS_THERMALLY_PROTECTED_BED
|
||||
static tr_state_machine_t tr_state_machine_bed;
|
||||
#endif
|
||||
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
|
||||
static tr_state_machine_t tr_state_machine_chamber;
|
||||
#endif
|
||||
TERN_(THERMAL_PROTECTION_HOTENDS, static tr_state_machine_t tr_state_machine[HOTENDS]);
|
||||
TERN_(HAS_THERMALLY_PROTECTED_BED, static tr_state_machine_t tr_state_machine_bed);
|
||||
TERN_(THERMAL_PROTECTION_CHAMBER, static tr_state_machine_t tr_state_machine_chamber);
|
||||
|
||||
static void thermal_runaway_protection(tr_state_machine_t &state, const float ¤t, const float &target, const heater_ind_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
|
||||
|
||||
|
@@ -152,11 +152,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
|
||||
const float oldx = current_position.x,
|
||||
grabpos = mpe_settings.parking_xpos[new_tool] + (new_tool ? mpe_settings.grab_distance : -mpe_settings.grab_distance),
|
||||
offsetcompensation = (0
|
||||
#if HAS_HOTEND_OFFSET
|
||||
+ hotend_offset[active_extruder].x * mpe_settings.compensation_factor
|
||||
#endif
|
||||
);
|
||||
offsetcompensation = TERN0(HAS_HOTEND_OFFSET, hotend_offset[active_extruder].x * mpe_settings.compensation_factor);
|
||||
|
||||
if (axis_unhomed_error(_BV(X_AXIS))) return;
|
||||
|
||||
@@ -322,9 +318,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
|
||||
planner.synchronize();
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Engage magnetic field");
|
||||
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
||||
pe_activate_solenoid(active_extruder); // Just save power for inverted magnets
|
||||
#endif
|
||||
// Just save power for inverted magnets
|
||||
TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid(active_extruder));
|
||||
pe_activate_solenoid(new_tool);
|
||||
|
||||
// STEP 5
|
||||
@@ -341,11 +336,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
|
||||
// STEP 6
|
||||
|
||||
current_position.x = midpos
|
||||
#if HAS_HOTEND_OFFSET
|
||||
- hotend_offset[new_tool].x
|
||||
#endif
|
||||
;
|
||||
current_position.x = midpos - TERN0(HAS_HOTEND_OFFSET, hotend_offset[new_tool].x);
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
planner.synchronize();
|
||||
DEBUG_POS("(6) Move midway between hotends", current_position);
|
||||
@@ -358,9 +349,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
else { // nomove == true
|
||||
// Only engage magnetic field for new extruder
|
||||
pe_activate_solenoid(new_tool);
|
||||
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
||||
pe_activate_solenoid(active_extruder); // Just save power for inverted magnets
|
||||
#endif
|
||||
// Just save power for inverted magnets
|
||||
TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid(active_extruder));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,9 +765,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
*/
|
||||
void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
|
||||
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
|
||||
if (new_tool == active_extruder) return;
|
||||
#endif
|
||||
if (TERN0(MAGNETIC_SWITCHING_TOOLHEAD, new_tool == active_extruder))
|
||||
return;
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
|
||||
@@ -826,9 +815,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("No move (not homed)");
|
||||
}
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (!no_move) ui.return_to_status();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, if (!no_move) ui.return_to_status());
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const bool idex_full_control = dual_x_carriage_mode == DXC_FULL_CONTROL_MODE;
|
||||
@@ -873,9 +860,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
|
||||
if (new_tool != old_tool) {
|
||||
|
||||
#if SWITCHING_NOZZLE_TWO_SERVOS
|
||||
raise_nozzle(old_tool);
|
||||
#endif
|
||||
TERN_(SWITCHING_NOZZLE_TWO_SERVOS, raise_nozzle(old_tool));
|
||||
|
||||
REMEMBER(fr, feedrate_mm_s, XY_PROBE_FEEDRATE_MM_S);
|
||||
|
||||
@@ -902,9 +887,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
NOMORE(current_position.z, soft_endstop.max.z);
|
||||
#endif
|
||||
fast_line_to_current(Z_AXIS);
|
||||
#if ENABLED(TOOLCHANGE_PARK)
|
||||
current_position = toolchange_settings.change_point;
|
||||
#endif
|
||||
TERN_(TOOLCHANGE_PARK, current_position = toolchange_settings.change_point);
|
||||
planner.buffer_line(current_position, feedrate_mm_s, old_tool);
|
||||
planner.synchronize();
|
||||
}
|
||||
@@ -912,9 +895,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
xyz_pos_t diff = hotend_offset[new_tool] - hotend_offset[old_tool];
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
diff.x = 0;
|
||||
#endif
|
||||
TERN_(DUAL_X_CARRIAGE, diff.x = 0);
|
||||
#else
|
||||
constexpr xyz_pos_t diff{0};
|
||||
#endif
|
||||
@@ -981,9 +962,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
singlenozzle_temp[old_tool] = thermalManager.temp_hotend[0].target;
|
||||
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
|
||||
thermalManager.setTargetHotend(singlenozzle_temp[new_tool], 0);
|
||||
#if HAS_DISPLAY
|
||||
thermalManager.set_heating_message(0);
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
|
||||
(void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling
|
||||
}
|
||||
#endif
|
||||
@@ -1030,9 +1009,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
}
|
||||
else if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move back skipped");
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
active_extruder_parked = false;
|
||||
#endif
|
||||
TERN_(DUAL_X_CARRIAGE, active_extruder_parked = false);
|
||||
}
|
||||
#if ENABLED(SWITCHING_NOZZLE)
|
||||
else {
|
||||
@@ -1041,13 +1018,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
mmu2.tool_change(new_tool);
|
||||
#endif
|
||||
TERN_(PRUSA_MMU2, mmu2.tool_change(new_tool));
|
||||
|
||||
#if SWITCHING_NOZZLE_TWO_SERVOS
|
||||
lower_nozzle(new_tool);
|
||||
#endif
|
||||
TERN_(SWITCHING_NOZZLE_TWO_SERVOS, lower_nozzle(new_tool));
|
||||
|
||||
} // (new_tool != old_tool)
|
||||
|
||||
@@ -1068,9 +1041,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
move_extruder_servo(active_extruder);
|
||||
#endif
|
||||
|
||||
#if HAS_FANMUX
|
||||
fanmux_switch(active_extruder);
|
||||
#endif
|
||||
TERN_(HAS_FANMUX, fanmux_switch(active_extruder));
|
||||
|
||||
#ifdef EVENT_GCODE_AFTER_TOOLCHANGE
|
||||
if (!no_move && TERN1(DUAL_X_CARRIAGE, dual_x_carriage_mode == DXC_AUTO_PARK_MODE))
|
||||
|
@@ -31,9 +31,7 @@
|
||||
float swap_length, extra_prime;
|
||||
int16_t prime_speed, retract_speed;
|
||||
#endif
|
||||
#if ENABLED(TOOLCHANGE_PARK)
|
||||
xy_pos_t change_point;
|
||||
#endif
|
||||
TERN_(TOOLCHANGE_PARK, xy_pos_t change_point);
|
||||
float z_raise;
|
||||
} toolchange_settings_t;
|
||||
|
||||
@@ -93,13 +91,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
|
||||
void est_init();
|
||||
#endif
|
||||
TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());
|
||||
|
||||
#if ENABLED(SWITCHING_TOOLHEAD)
|
||||
void swt_init();
|
||||
#endif
|
||||
TERN_(SWITCHING_TOOLHEAD, void swt_init());
|
||||
|
||||
/**
|
||||
* Perform a tool-change, which may result in moving the
|
||||
|
Reference in New Issue
Block a user