|
|
@ -285,7 +285,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42 |
|
|
|
// Inactivity shutdown
|
|
|
|
millis_t previous_cmd_ms = 0; |
|
|
|
static millis_t max_inactive_time = 0; |
|
|
|
static millis_t stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000L; |
|
|
|
static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000L; |
|
|
|
millis_t print_job_start_ms = 0; ///< Print job start time
|
|
|
|
millis_t print_job_stop_ms = 0; ///< Print job stop time
|
|
|
|
static uint8_t target_extruder; |
|
|
@ -1638,13 +1638,13 @@ static void setup_for_endstop_move() { |
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
|
if (marlin_debug_flags & DEBUG_LEVELING) { |
|
|
|
SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - X_PROBE_OFFSET_FROM_EXTRUDER); |
|
|
|
SERIAL_ECHOPAIR(", ", y - Y_PROBE_OFFSET_FROM_EXTRUDER); |
|
|
|
SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - (X_PROBE_OFFSET_FROM_EXTRUDER)); |
|
|
|
SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER)); |
|
|
|
SERIAL_EOL; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
do_blocking_move_to_xy(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER); // this also updates current_position
|
|
|
|
do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER)); // this also updates current_position
|
|
|
|
|
|
|
|
#if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY) |
|
|
|
if (probe_action & ProbeDeploy) { |
|
|
@ -2281,7 +2281,7 @@ inline void gcode_G28() { |
|
|
|
sync_plan_position(); |
|
|
|
|
|
|
|
// Move all carriages up together until the first endstop is hit.
|
|
|
|
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * Z_MAX_LENGTH; |
|
|
|
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * (Z_MAX_LENGTH); |
|
|
|
feedrate = 1.732 * homing_feedrate[X_AXIS]; |
|
|
|
line_to_destination(); |
|
|
|
st_synchronize(); |
|
|
@ -2330,7 +2330,7 @@ inline void gcode_G28() { |
|
|
|
feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
|
if (marlin_debug_flags & DEBUG_LEVELING) { |
|
|
|
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)MIN_Z_HEIGHT_FOR_HOMING); |
|
|
|
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)(MIN_Z_HEIGHT_FOR_HOMING)); |
|
|
|
SERIAL_EOL; |
|
|
|
print_xyz("> (home_all_axis || homeZ) > current_position", current_position); |
|
|
|
print_xyz("> (home_all_axis || homeZ) > destination", destination); |
|
|
@ -2467,8 +2467,8 @@ inline void gcode_G28() { |
|
|
|
//
|
|
|
|
// Set the Z probe (or just the nozzle) destination to the safe homing point
|
|
|
|
//
|
|
|
|
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER); |
|
|
|
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER); |
|
|
|
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - (X_PROBE_OFFSET_FROM_EXTRUDER)); |
|
|
|
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - (Y_PROBE_OFFSET_FROM_EXTRUDER)); |
|
|
|
destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height
|
|
|
|
feedrate = XY_TRAVEL_SPEED; |
|
|
|
|
|
|
@ -2500,10 +2500,10 @@ inline void gcode_G28() { |
|
|
|
// Make sure the Z probe is within the physical limits
|
|
|
|
// NOTE: This doesn't necessarily ensure the Z probe is also within the bed!
|
|
|
|
float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS]; |
|
|
|
if ( cpx >= X_MIN_POS - X_PROBE_OFFSET_FROM_EXTRUDER |
|
|
|
&& cpx <= X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER |
|
|
|
&& cpy >= Y_MIN_POS - Y_PROBE_OFFSET_FROM_EXTRUDER |
|
|
|
&& cpy <= Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER) { |
|
|
|
if ( cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) |
|
|
|
&& cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) |
|
|
|
&& cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER) |
|
|
|
&& cpy <= Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)) { |
|
|
|
|
|
|
|
// Home the Z axis
|
|
|
|
HOMEAXIS(Z); |
|
|
@ -2669,8 +2669,8 @@ inline void gcode_G28() { |
|
|
|
} |
|
|
|
else { |
|
|
|
// For others, save the Z of the previous point, then raise Z again.
|
|
|
|
ix = (probe_point - 1) % MESH_NUM_X_POINTS; |
|
|
|
iy = (probe_point - 1) / MESH_NUM_X_POINTS; |
|
|
|
ix = (probe_point - 1) % (MESH_NUM_X_POINTS); |
|
|
|
iy = (probe_point - 1) / (MESH_NUM_X_POINTS); |
|
|
|
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag
|
|
|
|
mbl.set_z(ix, iy, current_position[Z_AXIS]); |
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; |
|
|
@ -2678,9 +2678,9 @@ inline void gcode_G28() { |
|
|
|
st_synchronize(); |
|
|
|
} |
|
|
|
// Is there another point to sample? Move there.
|
|
|
|
if (probe_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) { |
|
|
|
ix = probe_point % MESH_NUM_X_POINTS; |
|
|
|
iy = probe_point / MESH_NUM_X_POINTS; |
|
|
|
if (probe_point < (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) { |
|
|
|
ix = probe_point % (MESH_NUM_X_POINTS); |
|
|
|
iy = probe_point / (MESH_NUM_X_POINTS); |
|
|
|
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag
|
|
|
|
current_position[X_AXIS] = mbl.get_x(ix); |
|
|
|
current_position[Y_AXIS] = mbl.get_y(iy); |
|
|
@ -2832,18 +2832,18 @@ inline void gcode_G28() { |
|
|
|
back_probe_bed_position = code_seen('B') ? code_value_short() : BACK_PROBE_BED_POSITION; |
|
|
|
|
|
|
|
bool left_out_l = left_probe_bed_position < MIN_PROBE_X, |
|
|
|
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE, |
|
|
|
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE), |
|
|
|
right_out_r = right_probe_bed_position > MAX_PROBE_X, |
|
|
|
right_out = right_out_r || right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE, |
|
|
|
front_out_f = front_probe_bed_position < MIN_PROBE_Y, |
|
|
|
front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - MIN_PROBE_EDGE, |
|
|
|
front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - (MIN_PROBE_EDGE), |
|
|
|
back_out_b = back_probe_bed_position > MAX_PROBE_Y, |
|
|
|
back_out = back_out_b || back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE; |
|
|
|
|
|
|
|
if (left_out || right_out || front_out || back_out) { |
|
|
|
if (left_out) { |
|
|
|
out_of_range_error(PSTR("(L)eft")); |
|
|
|
left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - MIN_PROBE_EDGE; |
|
|
|
left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - (MIN_PROBE_EDGE); |
|
|
|
} |
|
|
|
if (right_out) { |
|
|
|
out_of_range_error(PSTR("(R)ight")); |
|
|
@ -2851,7 +2851,7 @@ inline void gcode_G28() { |
|
|
|
} |
|
|
|
if (front_out) { |
|
|
|
out_of_range_error(PSTR("(F)ront")); |
|
|
|
front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - MIN_PROBE_EDGE; |
|
|
|
front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - (MIN_PROBE_EDGE); |
|
|
|
} |
|
|
|
if (back_out) { |
|
|
|
out_of_range_error(PSTR("(B)ack")); |
|
|
@ -3597,7 +3597,7 @@ inline void gcode_M42() { |
|
|
|
bool deploy_probe_for_each_reading = code_seen('E'); |
|
|
|
|
|
|
|
if (code_seen('X')) { |
|
|
|
X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER; |
|
|
|
X_probe_location = code_value() - (X_PROBE_OFFSET_FROM_EXTRUDER); |
|
|
|
if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) { |
|
|
|
out_of_range_error(PSTR("X")); |
|
|
|
return; |
|
|
@ -3677,7 +3677,7 @@ inline void gcode_M42() { |
|
|
|
|
|
|
|
if (n_legs) { |
|
|
|
millis_t ms = millis(); |
|
|
|
double radius = ms % (X_MAX_LENGTH / 4), // limit how far out to go
|
|
|
|
double radius = ms % ((X_MAX_LENGTH) / 4), // limit how far out to go
|
|
|
|
theta = RADIANS(ms % 360L); |
|
|
|
float dir = (ms & 0x0001) ? 1 : -1; // clockwise or counter clockwise
|
|
|
|
|
|
|
@ -3832,7 +3832,7 @@ inline void gcode_M104() { |
|
|
|
#if HAS_TEMP_BED |
|
|
|
SERIAL_PROTOCOLPGM(" B@:"); |
|
|
|
#ifdef BED_WATTS |
|
|
|
SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1)) / 127); |
|
|
|
SERIAL_PROTOCOL(((BED_WATTS) * getHeaterPower(-1)) / 127); |
|
|
|
SERIAL_PROTOCOLCHAR('W'); |
|
|
|
#else |
|
|
|
SERIAL_PROTOCOL(getHeaterPower(-1)); |
|
|
@ -3840,7 +3840,7 @@ inline void gcode_M104() { |
|
|
|
#endif |
|
|
|
SERIAL_PROTOCOLPGM(" @:"); |
|
|
|
#ifdef EXTRUDER_WATTS |
|
|
|
SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder)) / 127); |
|
|
|
SERIAL_PROTOCOL(((EXTRUDER_WATTS) * getHeaterPower(target_extruder)) / 127); |
|
|
|
SERIAL_PROTOCOLCHAR('W'); |
|
|
|
#else |
|
|
|
SERIAL_PROTOCOL(getHeaterPower(target_extruder)); |
|
|
@ -3851,7 +3851,7 @@ inline void gcode_M104() { |
|
|
|
SERIAL_PROTOCOL(e); |
|
|
|
SERIAL_PROTOCOLCHAR(':'); |
|
|
|
#ifdef EXTRUDER_WATTS |
|
|
|
SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(e)) / 127); |
|
|
|
SERIAL_PROTOCOL(((EXTRUDER_WATTS) * getHeaterPower(e)) / 127); |
|
|
|
SERIAL_PROTOCOLCHAR('W'); |
|
|
|
#else |
|
|
|
SERIAL_PROTOCOL(getHeaterPower(e)); |
|
|
@ -3943,7 +3943,7 @@ inline void gcode_M109() { |
|
|
|
#ifdef TEMP_RESIDENCY_TIME |
|
|
|
long residency_start_ms = -1; |
|
|
|
// Loop until the temperature has stabilized
|
|
|
|
#define TEMP_CONDITIONS (residency_start_ms < 0 || now < residency_start_ms + TEMP_RESIDENCY_TIME * 1000UL) |
|
|
|
#define TEMP_CONDITIONS (residency_start_ms < 0 || now < residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL) |
|
|
|
#else |
|
|
|
// Loop until the temperature is very close target
|
|
|
|
#define TEMP_CONDITIONS (fabs(degHotend(target_extruder) - degTargetHotend(target_extruder)) < 0.75f) |
|
|
@ -3961,7 +3961,7 @@ inline void gcode_M109() { |
|
|
|
#ifdef TEMP_RESIDENCY_TIME |
|
|
|
SERIAL_PROTOCOLPGM(" W:"); |
|
|
|
if (residency_start_ms >= 0) { |
|
|
|
long rem = ((TEMP_RESIDENCY_TIME * 1000UL) - (now - residency_start_ms)) / 1000UL; |
|
|
|
long rem = (((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL; |
|
|
|
SERIAL_PROTOCOLLN(rem); |
|
|
|
} |
|
|
|
else { |
|
|
@ -5533,7 +5533,7 @@ inline void gcode_M907() { |
|
|
|
// this one uses actual amps in floating point
|
|
|
|
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) digipot_i2c_set_current(i, code_value()); |
|
|
|
// for each additional extruder (named B,C,D,E..., channels 4,5,6,7...)
|
|
|
|
for (int i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (code_seen('B' + i - NUM_AXIS)) digipot_i2c_set_current(i, code_value()); |
|
|
|
for (int i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (code_seen('B' + i - (NUM_AXIS))) digipot_i2c_set_current(i, code_value()); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
@ -6821,7 +6821,7 @@ void plan_arc( |
|
|
|
) { |
|
|
|
lastMotor = ms; //... set time to NOW so the fan will turn on
|
|
|
|
} |
|
|
|
uint8_t speed = (lastMotor == 0 || ms >= lastMotor + (CONTROLLERFAN_SECS * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; |
|
|
|
uint8_t speed = (lastMotor == 0 || ms >= lastMotor + ((CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; |
|
|
|
// allows digital or PWM fan output to be used (see M42 handling)
|
|
|
|
digitalWrite(CONTROLLERFAN_PIN, speed); |
|
|
|
analogWrite(CONTROLLERFAN_PIN, speed); |
|
|
@ -7054,7 +7054,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(EXTRUDER_RUNOUT_PREVENT) |
|
|
|
if (ms > previous_cmd_ms + EXTRUDER_RUNOUT_SECONDS * 1000) |
|
|
|
if (ms > previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000) |
|
|
|
if (degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) { |
|
|
|
bool oldstatus; |
|
|
|
switch (active_extruder) { |
|
|
@ -7083,8 +7083,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { |
|
|
|
} |
|
|
|
float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS]; |
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], |
|
|
|
destination[E_AXIS] + EXTRUDER_RUNOUT_EXTRUDE * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], |
|
|
|
EXTRUDER_RUNOUT_SPEED / 60. * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], active_extruder); |
|
|
|
destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS], |
|
|
|
(EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS], active_extruder); |
|
|
|
current_position[E_AXIS] = oldepos; |
|
|
|
destination[E_AXIS] = oldedes; |
|
|
|
plan_set_e_position(oldepos); |
|
|
|