|
@ -440,7 +440,7 @@ float soft_endstop_min[XYZ] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }, |
|
|
soft_endstop_max[XYZ] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; |
|
|
soft_endstop_max[XYZ] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; |
|
|
|
|
|
|
|
|
#if FAN_COUNT > 0 |
|
|
#if FAN_COUNT > 0 |
|
|
int fanSpeeds[FAN_COUNT] = { 0 }; |
|
|
int16_t fanSpeeds[FAN_COUNT] = { 0 }; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
// The active extruder (tool). Set with T<extruder> command.
|
|
|
// The active extruder (tool). Set with T<extruder> command.
|
|
@ -1292,32 +1292,24 @@ inline bool code_value_bool() { return !code_has_value() || code_value_byte() > |
|
|
inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; } |
|
|
inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; } |
|
|
inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); } |
|
|
inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); } |
|
|
inline float code_value_per_axis_unit(const AxisEnum axis) { return code_value_float() / axis_unit_factor(axis); } |
|
|
inline float code_value_per_axis_unit(const AxisEnum axis) { return code_value_float() / axis_unit_factor(axis); } |
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
|
|
|
|
#define code_value_linear_units() code_value_float() |
|
|
|
|
|
#define code_value_axis_units(A) code_value_float() |
|
|
|
|
|
#define code_value_per_axis_unit(A) code_value_float() |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(TEMPERATURE_UNITS_SUPPORT) |
|
|
#if ENABLED(TEMPERATURE_UNITS_SUPPORT) |
|
|
inline void set_input_temp_units(TempUnit units) { input_temp_units = units; } |
|
|
inline void set_input_temp_units(TempUnit units) { input_temp_units = units; } |
|
|
|
|
|
|
|
|
float code_value_temp_abs() { |
|
|
int16_t code_value_temp_abs() { |
|
|
switch (input_temp_units) { |
|
|
switch (input_temp_units) { |
|
|
case TEMPUNIT_C: |
|
|
|
|
|
return code_value_float(); |
|
|
|
|
|
case TEMPUNIT_F: |
|
|
case TEMPUNIT_F: |
|
|
return (code_value_float() - 32) * 0.5555555556; |
|
|
return (code_value_float() - 32) * 0.5555555556; |
|
|
case TEMPUNIT_K: |
|
|
case TEMPUNIT_K: |
|
|
return code_value_float() - 273.15; |
|
|
return code_value_float() - 273.15; |
|
|
|
|
|
case TEMPUNIT_C: |
|
|
default: |
|
|
default: |
|
|
return code_value_float(); |
|
|
return code_value_int(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
float code_value_temp_diff() { |
|
|
int16_t code_value_temp_diff() { |
|
|
switch (input_temp_units) { |
|
|
switch (input_temp_units) { |
|
|
case TEMPUNIT_C: |
|
|
case TEMPUNIT_C: |
|
|
case TEMPUNIT_K: |
|
|
case TEMPUNIT_K: |
|
@ -1329,8 +1321,8 @@ inline bool code_value_bool() { return !code_has_value() || code_value_byte() > |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
#else |
|
|
#else |
|
|
float code_value_temp_abs() { return code_value_float(); } |
|
|
int16_t code_value_temp_abs() { return code_value_int(); } |
|
|
float code_value_temp_diff() { return code_value_float(); } |
|
|
int16_t code_value_temp_diff() { return code_value_int(); } |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
FORCE_INLINE millis_t code_value_millis() { return code_value_ulong(); } |
|
|
FORCE_INLINE millis_t code_value_millis() { return code_value_ulong(); } |
|
@ -1391,7 +1383,7 @@ bool get_target_extruder_from_command(int code) { |
|
|
static float raised_parked_position[XYZE]; // used in mode 1
|
|
|
static float raised_parked_position[XYZE]; // used in mode 1
|
|
|
static millis_t delayed_move_time = 0; // used in mode 1
|
|
|
static millis_t delayed_move_time = 0; // used in mode 1
|
|
|
static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
|
|
|
static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
|
|
|
static float duplicate_extruder_temp_offset = 0; // used in mode 2
|
|
|
static int16_t duplicate_extruder_temp_offset = 0; // used in mode 2
|
|
|
|
|
|
|
|
|
#endif // DUAL_X_CARRIAGE
|
|
|
#endif // DUAL_X_CARRIAGE
|
|
|
|
|
|
|
|
@ -2080,10 +2072,10 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
void set_heaters_for_bltouch(const bool deploy) { |
|
|
void set_heaters_for_bltouch(const bool deploy) { |
|
|
static bool heaters_were_disabled = false; |
|
|
static bool heaters_were_disabled = false; |
|
|
static millis_t next_emi_protection = 0; |
|
|
static millis_t next_emi_protection = 0; |
|
|
static float temps_at_entry[HOTENDS]; |
|
|
static int16_t temps_at_entry[HOTENDS]; |
|
|
|
|
|
|
|
|
#if HAS_TEMP_BED |
|
|
#if HAS_TEMP_BED |
|
|
static float bed_temp_at_entry; |
|
|
static int16_t bed_temp_at_entry; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
// If called out of order or far apart something is seriously wrong
|
|
|
// If called out of order or far apart something is seriously wrong
|
|
@ -2588,7 +2580,7 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
/**
|
|
|
/**
|
|
|
* Extrapolate a single point from its neighbors |
|
|
* Extrapolate a single point from its neighbors |
|
|
*/ |
|
|
*/ |
|
|
static void extrapolate_one_point(uint8_t x, uint8_t y, int8_t xdir, int8_t ydir) { |
|
|
static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) { |
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
if (DEBUGGING(LEVELING)) { |
|
|
if (DEBUGGING(LEVELING)) { |
|
|
SERIAL_ECHOPGM("Extrapolate ["); |
|
|
SERIAL_ECHOPGM("Extrapolate ["); |
|
@ -2611,9 +2603,10 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
SERIAL_EOL; |
|
|
SERIAL_EOL; |
|
|
|
|
|
|
|
|
// Get X neighbors, Y neighbors, and XY neighbors
|
|
|
// Get X neighbors, Y neighbors, and XY neighbors
|
|
|
float a1 = z_values[x + xdir][y], a2 = z_values[x + xdir * 2][y], |
|
|
const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir; |
|
|
b1 = z_values[x][y + ydir], b2 = z_values[x][y + ydir * 2], |
|
|
float a1 = z_values[x1][y ], a2 = z_values[x2][y ], |
|
|
c1 = z_values[x + xdir][y + ydir], c2 = z_values[x + xdir * 2][y + ydir * 2]; |
|
|
b1 = z_values[x ][y1], b2 = z_values[x ][y2], |
|
|
|
|
|
c1 = z_values[x1][y1], c2 = z_values[x2][y2]; |
|
|
|
|
|
|
|
|
// Treat far unprobed points as zero, near as equal to far
|
|
|
// Treat far unprobed points as zero, near as equal to far
|
|
|
if (isnan(a2)) a2 = 0.0; if (isnan(a1)) a1 = a2; |
|
|
if (isnan(a2)) a2 = 0.0; if (isnan(a1)) a1 = a2; |
|
@ -2647,19 +2640,19 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
*/ |
|
|
*/ |
|
|
static void extrapolate_unprobed_bed_level() { |
|
|
static void extrapolate_unprobed_bed_level() { |
|
|
#ifdef HALF_IN_X |
|
|
#ifdef HALF_IN_X |
|
|
const uint8_t ctrx2 = 0, xlen = GRID_MAX_POINTS_X - 1; |
|
|
constexpr uint8_t ctrx2 = 0, xlen = GRID_MAX_POINTS_X - 1; |
|
|
#else |
|
|
#else |
|
|
const uint8_t ctrx1 = (GRID_MAX_POINTS_X - 1) / 2, // left-of-center
|
|
|
constexpr uint8_t ctrx1 = (GRID_MAX_POINTS_X - 1) / 2, // left-of-center
|
|
|
ctrx2 = GRID_MAX_POINTS_X / 2, // right-of-center
|
|
|
ctrx2 = (GRID_MAX_POINTS_X) / 2, // right-of-center
|
|
|
xlen = ctrx1; |
|
|
xlen = ctrx1; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef HALF_IN_Y |
|
|
#ifdef HALF_IN_Y |
|
|
const uint8_t ctry2 = 0, ylen = GRID_MAX_POINTS_Y - 1; |
|
|
constexpr uint8_t ctry2 = 0, ylen = GRID_MAX_POINTS_Y - 1; |
|
|
#else |
|
|
#else |
|
|
const uint8_t ctry1 = (GRID_MAX_POINTS_Y - 1) / 2, // top-of-center
|
|
|
constexpr uint8_t ctry1 = (GRID_MAX_POINTS_Y - 1) / 2, // top-of-center
|
|
|
ctry2 = GRID_MAX_POINTS_Y / 2, // bottom-of-center
|
|
|
ctry2 = (GRID_MAX_POINTS_Y) / 2, // bottom-of-center
|
|
|
ylen = ctry1; |
|
|
ylen = ctry1; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
for (uint8_t xo = 0; xo <= xlen; xo++) |
|
|
for (uint8_t xo = 0; xo <= xlen; xo++) |
|
@ -6477,10 +6470,11 @@ inline void gcode_M104() { |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
if (code_seen('S')) { |
|
|
if (code_seen('S')) { |
|
|
thermalManager.setTargetHotend(code_value_temp_abs(), target_extruder); |
|
|
const int16_t temp = code_value_temp_abs(); |
|
|
|
|
|
thermalManager.setTargetHotend(temp, target_extruder); |
|
|
#if ENABLED(DUAL_X_CARRIAGE) |
|
|
#if ENABLED(DUAL_X_CARRIAGE) |
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) |
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) |
|
|
thermalManager.setTargetHotend(code_value_temp_abs() == 0.0 ? 0.0 : code_value_temp_abs() + duplicate_extruder_temp_offset, 1); |
|
|
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART) |
|
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART) |
|
@ -6490,7 +6484,7 @@ inline void gcode_M104() { |
|
|
* standby mode, for instance in a dual extruder setup, without affecting |
|
|
* standby mode, for instance in a dual extruder setup, without affecting |
|
|
* the running print timer. |
|
|
* the running print timer. |
|
|
*/ |
|
|
*/ |
|
|
if (code_value_temp_abs() <= (EXTRUDE_MINTEMP)/2) { |
|
|
if (code_value_temp_abs() <= (EXTRUDE_MINTEMP) / 2) { |
|
|
print_job_timer.stop(); |
|
|
print_job_timer.stop(); |
|
|
LCD_MESSAGEPGM(WELCOME_MSG); |
|
|
LCD_MESSAGEPGM(WELCOME_MSG); |
|
|
} |
|
|
} |
|
@ -6513,7 +6507,7 @@ inline void gcode_M104() { |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(target_extruder), 1); |
|
|
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(target_extruder), 1); |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_raw[target_extruder] / OVERSAMPLENR); |
|
|
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(target_extruder) / OVERSAMPLENR); |
|
|
SERIAL_PROTOCOLCHAR(')'); |
|
|
SERIAL_PROTOCOLCHAR(')'); |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
@ -6523,7 +6517,7 @@ inline void gcode_M104() { |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOL_F(thermalManager.degTargetBed(), 1); |
|
|
SERIAL_PROTOCOL_F(thermalManager.degTargetBed(), 1); |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_bed_raw / OVERSAMPLENR); |
|
|
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawBedTemp() / OVERSAMPLENR); |
|
|
SERIAL_PROTOCOLCHAR(')'); |
|
|
SERIAL_PROTOCOLCHAR(')'); |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
@ -6535,7 +6529,7 @@ inline void gcode_M104() { |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(e), 1); |
|
|
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(e), 1); |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
#if ENABLED(SHOW_TEMP_ADC_VALUES) |
|
|
SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_raw[e] / OVERSAMPLENR); |
|
|
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(e) / OVERSAMPLENR); |
|
|
SERIAL_PROTOCOLCHAR(')'); |
|
|
SERIAL_PROTOCOLCHAR(')'); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
@ -6671,10 +6665,11 @@ inline void gcode_M109() { |
|
|
|
|
|
|
|
|
const bool no_wait_for_cooling = code_seen('S'); |
|
|
const bool no_wait_for_cooling = code_seen('S'); |
|
|
if (no_wait_for_cooling || code_seen('R')) { |
|
|
if (no_wait_for_cooling || code_seen('R')) { |
|
|
thermalManager.setTargetHotend(code_value_temp_abs(), target_extruder); |
|
|
const int16_t temp = code_value_temp_abs(); |
|
|
|
|
|
thermalManager.setTargetHotend(temp, target_extruder); |
|
|
#if ENABLED(DUAL_X_CARRIAGE) |
|
|
#if ENABLED(DUAL_X_CARRIAGE) |
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) |
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) |
|
|
thermalManager.setTargetHotend(code_value_temp_abs() == 0.0 ? 0.0 : code_value_temp_abs() + duplicate_extruder_temp_offset, 1); |
|
|
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART) |
|
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART) |
|
@ -7202,7 +7197,7 @@ inline void gcode_M92() { |
|
|
LOOP_XYZE(i) { |
|
|
LOOP_XYZE(i) { |
|
|
if (code_seen(axis_codes[i])) { |
|
|
if (code_seen(axis_codes[i])) { |
|
|
if (i == E_AXIS) { |
|
|
if (i == E_AXIS) { |
|
|
const float value = code_value_per_axis_unit(E_AXIS + TARGET_EXTRUDER); |
|
|
const float value = code_value_per_axis_unit((AxisEnum)(E_AXIS + TARGET_EXTRUDER)); |
|
|
if (value < 20.0) { |
|
|
if (value < 20.0) { |
|
|
float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
|
|
|
float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
|
|
|
planner.max_jerk[E_AXIS] *= factor; |
|
|
planner.max_jerk[E_AXIS] *= factor; |
|
@ -7212,7 +7207,7 @@ inline void gcode_M92() { |
|
|
planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] = value; |
|
|
planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] = value; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
planner.axis_steps_per_mm[i] = code_value_per_axis_unit(i); |
|
|
planner.axis_steps_per_mm[i] = code_value_per_axis_unit((AxisEnum)i); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -8106,11 +8101,11 @@ inline void gcode_M226() { |
|
|
*/ |
|
|
*/ |
|
|
inline void gcode_M303() { |
|
|
inline void gcode_M303() { |
|
|
#if HAS_PID_HEATING |
|
|
#if HAS_PID_HEATING |
|
|
int e = code_seen('E') ? code_value_int() : 0; |
|
|
const int e = code_seen('E') ? code_value_int() : 0, |
|
|
int c = code_seen('C') ? code_value_int() : 5; |
|
|
c = code_seen('C') ? code_value_int() : 5; |
|
|
bool u = code_seen('U') && code_value_bool(); |
|
|
const bool u = code_seen('U') && code_value_bool(); |
|
|
|
|
|
|
|
|
float temp = code_seen('S') ? code_value_temp_abs() : (e < 0 ? 70.0 : 150.0); |
|
|
int16_t temp = code_seen('S') ? code_value_temp_abs() : (e < 0 ? 70 : 150); |
|
|
|
|
|
|
|
|
if (WITHIN(e, 0, HOTENDS - 1)) |
|
|
if (WITHIN(e, 0, HOTENDS - 1)) |
|
|
target_extruder = e; |
|
|
target_extruder = e; |
|
@ -8747,7 +8742,6 @@ inline void gcode_M503() { |
|
|
|
|
|
|
|
|
const millis_t nozzle_timeout = millis() + (millis_t)(FILAMENT_CHANGE_NOZZLE_TIMEOUT) * 1000UL; |
|
|
const millis_t nozzle_timeout = millis() + (millis_t)(FILAMENT_CHANGE_NOZZLE_TIMEOUT) * 1000UL; |
|
|
bool nozzle_timed_out = false; |
|
|
bool nozzle_timed_out = false; |
|
|
float temps[4]; |
|
|
|
|
|
|
|
|
|
|
|
// Wait for filament insert by user and press button
|
|
|
// Wait for filament insert by user and press button
|
|
|
lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT); |
|
|
lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT); |
|
@ -8758,6 +8752,7 @@ inline void gcode_M503() { |
|
|
|
|
|
|
|
|
idle(); |
|
|
idle(); |
|
|
|
|
|
|
|
|
|
|
|
int16_t temps[HOTENDS]; |
|
|
HOTEND_LOOP() temps[e] = thermalManager.target_temperature[e]; // Save nozzle temps
|
|
|
HOTEND_LOOP() temps[e] = thermalManager.target_temperature[e]; // Save nozzle temps
|
|
|
|
|
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER); |
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER); |
|
|