Merge remote-tracking branch 'MarlinFirmware/Development' into Development
Conflicts: Marlin/Marlin_main.cpp Marlin/stepper.cpp
This commit is contained in:
commit
cba5692673
|
@ -229,7 +229,6 @@ void refresh_cmd_timeout(void);
|
||||||
extern float homing_feedrate[];
|
extern float homing_feedrate[];
|
||||||
extern bool axis_relative_modes[];
|
extern bool axis_relative_modes[];
|
||||||
extern int feedmultiply;
|
extern int feedmultiply;
|
||||||
extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
|
|
||||||
extern bool volumetric_enabled;
|
extern bool volumetric_enabled;
|
||||||
extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
|
extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
|
||||||
extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
|
extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
// G4 - Dwell S<seconds> or P<milliseconds>
|
// G4 - Dwell S<seconds> or P<milliseconds>
|
||||||
// G10 - retract filament according to settings of M207
|
// G10 - retract filament according to settings of M207
|
||||||
// G11 - retract recover filament according to settings of M208
|
// G11 - retract recover filament according to settings of M208
|
||||||
// G28 - Home all Axis
|
// G28 - Home one or more axes
|
||||||
// G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
|
// G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
|
||||||
// G30 - Single Z Probe, probes bed at current XY location.
|
// G30 - Single Z Probe, probes bed at current XY location.
|
||||||
// G31 - Dock sled (Z_PROBE_SLED only)
|
// G31 - Dock sled (Z_PROBE_SLED only)
|
||||||
|
@ -210,7 +210,6 @@ int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
||||||
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
||||||
int feedmultiply = 100; //100->1 200->2
|
int feedmultiply = 100; //100->1 200->2
|
||||||
int saved_feedmultiply;
|
int saved_feedmultiply;
|
||||||
int extrudemultiply = 100; //100->1 200->2
|
|
||||||
int extruder_multiply[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100, 100, 100, 100);
|
int extruder_multiply[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100, 100, 100, 100);
|
||||||
bool volumetric_enabled = false;
|
bool volumetric_enabled = false;
|
||||||
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA);
|
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA);
|
||||||
|
@ -477,8 +476,6 @@ bool enquecommand(const char *cmd)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setup_killpin()
|
void setup_killpin()
|
||||||
{
|
{
|
||||||
#if defined(KILL_PIN) && KILL_PIN > -1
|
#if defined(KILL_PIN) && KILL_PIN > -1
|
||||||
|
@ -966,10 +963,10 @@ static void axis_is_at_home(int axis) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
||||||
current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
|
float xoff = home_offset[X_AXIS];
|
||||||
min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS];
|
current_position[X_AXIS] = base_home_pos(X_AXIS) + xoff;
|
||||||
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
|
min_pos[X_AXIS] = base_min_pos(X_AXIS) + xoff;
|
||||||
max(extruder_offset[1][X_AXIS], X2_MAX_POS) - duplicate_extruder_x_offset);
|
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(extruder_offset[1][X_AXIS], X2_MAX_POS) - duplicate_extruder_x_offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1023,16 +1020,27 @@ static void axis_is_at_home(int axis) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shorthand to tell the planner our current position (in mm).
|
* Some planner shorthand inline functions
|
||||||
*/
|
*/
|
||||||
|
inline void line_to_current_position() {
|
||||||
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder);
|
||||||
|
}
|
||||||
|
inline void line_to_z(float zPosition) {
|
||||||
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
||||||
|
}
|
||||||
|
inline void line_to_destination() {
|
||||||
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
||||||
|
}
|
||||||
inline void sync_plan_position() {
|
inline void sync_plan_position() {
|
||||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AUTO_BED_LEVELING
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
||||||
#ifdef AUTO_BED_LEVELING_GRID
|
|
||||||
|
|
||||||
#ifndef DELTA
|
#ifdef AUTO_BED_LEVELING_GRID
|
||||||
|
|
||||||
|
#ifndef DELTA
|
||||||
|
|
||||||
static void set_bed_level_equation_lsq(double *plane_equation_coefficients) {
|
static void set_bed_level_equation_lsq(double *plane_equation_coefficients) {
|
||||||
vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
||||||
planeNormal.debug("planeNormal");
|
planeNormal.debug("planeNormal");
|
||||||
|
@ -1051,11 +1059,12 @@ inline void sync_plan_position() {
|
||||||
|
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // not AUTO_BED_LEVELING_GRID
|
#endif // !DELTA
|
||||||
|
|
||||||
static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
#else // !AUTO_BED_LEVELING_GRID
|
||||||
|
|
||||||
|
static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
||||||
|
|
||||||
plan_bed_level_matrix.set_to_identity();
|
plan_bed_level_matrix.set_to_identity();
|
||||||
|
|
||||||
|
@ -1078,11 +1087,12 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float
|
||||||
current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z
|
current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z
|
||||||
|
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // AUTO_BED_LEVELING_GRID
|
#endif // !AUTO_BED_LEVELING_GRID
|
||||||
|
|
||||||
|
static void run_z_probe() {
|
||||||
|
|
||||||
static void run_z_probe() {
|
|
||||||
#ifdef DELTA
|
#ifdef DELTA
|
||||||
|
|
||||||
float start_z = current_position[Z_AXIS];
|
float start_z = current_position[Z_AXIS];
|
||||||
|
@ -1102,14 +1112,14 @@ static void run_z_probe() {
|
||||||
calculate_delta(current_position);
|
calculate_delta(current_position);
|
||||||
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
||||||
|
|
||||||
#else
|
#else // !DELTA
|
||||||
|
|
||||||
plan_bed_level_matrix.set_to_identity();
|
plan_bed_level_matrix.set_to_identity();
|
||||||
feedrate = homing_feedrate[Z_AXIS];
|
feedrate = homing_feedrate[Z_AXIS];
|
||||||
|
|
||||||
// move down until you find the bed
|
// move down until you find the bed
|
||||||
float zPosition = -10;
|
float zPosition = -10;
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
line_to_z(zPosition);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
// we have to let the planner know where we are right now as it is not where we said to go.
|
// we have to let the planner know where we are right now as it is not where we said to go.
|
||||||
|
@ -1118,21 +1128,20 @@ static void run_z_probe() {
|
||||||
|
|
||||||
// move up the retract distance
|
// move up the retract distance
|
||||||
zPosition += home_retract_mm(Z_AXIS);
|
zPosition += home_retract_mm(Z_AXIS);
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
line_to_z(zPosition);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
endstops_hit_on_purpose();
|
endstops_hit_on_purpose();
|
||||||
|
|
||||||
// move back down slowly to find bed
|
// move back down slowly to find bed
|
||||||
if (homing_bump_divisor[Z_AXIS] >= 1) {
|
if (homing_bump_divisor[Z_AXIS] >= 1)
|
||||||
feedrate = homing_feedrate[Z_AXIS]/homing_bump_divisor[Z_AXIS];
|
feedrate = homing_feedrate[Z_AXIS] / homing_bump_divisor[Z_AXIS];
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
feedrate = homing_feedrate[Z_AXIS]/10;
|
feedrate = homing_feedrate[Z_AXIS] / 10;
|
||||||
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1");
|
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less than 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
zPosition -= home_retract_mm(Z_AXIS) * 2;
|
zPosition -= home_retract_mm(Z_AXIS) * 2;
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
line_to_z(zPosition);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
endstops_hit_on_purpose();
|
endstops_hit_on_purpose();
|
||||||
|
|
||||||
|
@ -1140,13 +1149,13 @@ static void run_z_probe() {
|
||||||
// make sure the planner knows where we are as it may be a bit different than we last said to move to
|
// make sure the planner knows where we are as it may be a bit different than we last said to move to
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#endif
|
#endif // !DELTA
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_blocking_move_to(float x, float y, float z) {
|
static void do_blocking_move_to(float x, float y, float z) {
|
||||||
float oldFeedRate = feedrate;
|
float oldFeedRate = feedrate;
|
||||||
|
|
||||||
#ifdef DELTA
|
#ifdef DELTA
|
||||||
|
|
||||||
feedrate = XY_TRAVEL_SPEED;
|
feedrate = XY_TRAVEL_SPEED;
|
||||||
|
|
||||||
|
@ -1156,45 +1165,44 @@ static void do_blocking_move_to(float x, float y, float z) {
|
||||||
prepare_move_raw();
|
prepare_move_raw();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
feedrate = homing_feedrate[Z_AXIS];
|
feedrate = homing_feedrate[Z_AXIS];
|
||||||
|
|
||||||
current_position[Z_AXIS] = z;
|
current_position[Z_AXIS] = z;
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder);
|
line_to_current_position();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
feedrate = xy_travel_speed;
|
feedrate = xy_travel_speed;
|
||||||
|
|
||||||
current_position[X_AXIS] = x;
|
current_position[X_AXIS] = x;
|
||||||
current_position[Y_AXIS] = y;
|
current_position[Y_AXIS] = y;
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder);
|
line_to_current_position();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
feedrate = oldFeedRate;
|
feedrate = oldFeedRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_for_endstop_move() {
|
static void setup_for_endstop_move() {
|
||||||
saved_feedrate = feedrate;
|
saved_feedrate = feedrate;
|
||||||
saved_feedmultiply = feedmultiply;
|
saved_feedmultiply = feedmultiply;
|
||||||
feedmultiply = 100;
|
feedmultiply = 100;
|
||||||
previous_millis_cmd = millis();
|
previous_millis_cmd = millis();
|
||||||
|
|
||||||
enable_endstops(true);
|
enable_endstops(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clean_up_after_endstop_move() {
|
static void clean_up_after_endstop_move() {
|
||||||
#ifdef ENDSTOPS_ONLY_FOR_HOMING
|
#ifdef ENDSTOPS_ONLY_FOR_HOMING
|
||||||
enable_endstops(false);
|
enable_endstops(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
feedrate = saved_feedrate;
|
feedrate = saved_feedrate;
|
||||||
feedmultiply = saved_feedmultiply;
|
feedmultiply = saved_feedmultiply;
|
||||||
previous_millis_cmd = millis();
|
previous_millis_cmd = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
static void engage_z_probe() {
|
static void engage_z_probe() {
|
||||||
// Engage Z Servo endstop if enabled
|
// Engage Z Servo endstop if enabled
|
||||||
#ifdef SERVO_ENDSTOPS
|
#ifdef SERVO_ENDSTOPS
|
||||||
|
@ -1242,13 +1250,59 @@ static void engage_z_probe() {
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
|
SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
|
||||||
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
|
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
|
||||||
|
=======
|
||||||
|
static void engage_z_probe() {
|
||||||
|
|
||||||
|
#ifdef SERVO_ENDSTOPS
|
||||||
|
|
||||||
|
// Engage Z Servo endstop if enabled
|
||||||
|
if (servo_endstops[Z_AXIS] >= 0) {
|
||||||
|
#if SERVO_LEVELING
|
||||||
|
servos[servo_endstops[Z_AXIS]].attach(0);
|
||||||
|
#endif
|
||||||
|
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
|
||||||
|
#if SERVO_LEVELING
|
||||||
|
delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
||||||
|
servos[servo_endstops[Z_AXIS]].detach();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(Z_PROBE_ALLEN_KEY)
|
||||||
|
|
||||||
|
feedrate = homing_feedrate[X_AXIS];
|
||||||
|
|
||||||
|
// Move to the start position to initiate deployment
|
||||||
|
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_X;
|
||||||
|
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Y;
|
||||||
|
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Z;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
// Home X to touch the belt
|
||||||
|
feedrate = homing_feedrate[X_AXIS]/10;
|
||||||
|
destination[X_AXIS] = 0;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
// Home Y for safety
|
||||||
|
feedrate = homing_feedrate[X_AXIS]/2;
|
||||||
|
destination[Y_AXIS] = 0;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
st_synchronize();
|
||||||
|
|
||||||
|
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
||||||
|
if (z_min_endstop) {
|
||||||
|
if (!Stopped) {
|
||||||
|
SERIAL_ERROR_START;
|
||||||
|
SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
|
||||||
|
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
|
||||||
|
>>>>>>> MarlinFirmware/Development
|
||||||
}
|
}
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
#endif // Z_PROBE_ALLEN_KEY
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
static void retract_z_probe() {
|
static void retract_z_probe() {
|
||||||
// Retract Z Servo endstop if enabled
|
// Retract Z Servo endstop if enabled
|
||||||
#ifdef SERVO_ENDSTOPS
|
#ifdef SERVO_ENDSTOPS
|
||||||
|
@ -1311,22 +1365,88 @@ static void retract_z_probe() {
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
|
SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
|
||||||
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
|
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
|
||||||
|
=======
|
||||||
|
}
|
||||||
|
|
||||||
|
static void retract_z_probe(const float z_after=Z_RAISE_AFTER_PROBING) {
|
||||||
|
|
||||||
|
#ifdef SERVO_ENDSTOPS
|
||||||
|
|
||||||
|
// Retract Z Servo endstop if enabled
|
||||||
|
if (servo_endstops[Z_AXIS] >= 0) {
|
||||||
|
|
||||||
|
if (z_after > 0) {
|
||||||
|
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_after);
|
||||||
|
st_synchronize();
|
||||||
|
>>>>>>> MarlinFirmware/Development
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SERVO_LEVELING
|
||||||
|
servos[servo_endstops[Z_AXIS]].attach(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
|
||||||
|
|
||||||
|
#if SERVO_LEVELING
|
||||||
|
delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
||||||
|
servos[servo_endstops[Z_AXIS]].detach();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(Z_PROBE_ALLEN_KEY)
|
||||||
|
|
||||||
|
// Move up for safety
|
||||||
|
feedrate = homing_feedrate[X_AXIS];
|
||||||
|
destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
// Move to the start position to initiate retraction
|
||||||
|
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_X;
|
||||||
|
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_Y;
|
||||||
|
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_Z;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
// Move the nozzle down to push the probe into retracted position
|
||||||
|
feedrate = homing_feedrate[Z_AXIS]/10;
|
||||||
|
destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_RETRACT_DEPTH;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
// Move up for safety
|
||||||
|
feedrate = homing_feedrate[Z_AXIS]/2;
|
||||||
|
destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_RETRACT_DEPTH * 2;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
// Home XY for safety
|
||||||
|
feedrate = homing_feedrate[X_AXIS]/2;
|
||||||
|
destination[X_AXIS] = 0;
|
||||||
|
destination[Y_AXIS] = 0;
|
||||||
|
prepare_move_raw();
|
||||||
|
|
||||||
|
st_synchronize();
|
||||||
|
|
||||||
|
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
||||||
|
if (!z_min_endstop) {
|
||||||
|
if (!Stopped) {
|
||||||
|
SERIAL_ERROR_START;
|
||||||
|
SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
|
||||||
|
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
|
||||||
}
|
}
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ProbeAction {
|
enum ProbeAction {
|
||||||
ProbeStay = 0,
|
ProbeStay = 0,
|
||||||
ProbeEngage = BIT(0),
|
ProbeEngage = BIT(0),
|
||||||
ProbeRetract = BIT(1),
|
ProbeRetract = BIT(1),
|
||||||
ProbeEngageAndRetract = (ProbeEngage | ProbeRetract)
|
ProbeEngageAndRetract = (ProbeEngage | ProbeRetract)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Probe bed height at position (x,y), returns the measured z value
|
// Probe bed height at position (x,y), returns the measured z value
|
||||||
static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRetract, int verbose_level=1) {
|
static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRetract, int verbose_level=1) {
|
||||||
// move to right place
|
// move to right place
|
||||||
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
|
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
|
||||||
do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
|
do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
|
||||||
|
@ -1339,7 +1459,7 @@ static float probe_pt(float x, float y, float z_before, ProbeAction retract_acti
|
||||||
float measured_z = current_position[Z_AXIS];
|
float measured_z = current_position[Z_AXIS];
|
||||||
|
|
||||||
#if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY)
|
#if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY)
|
||||||
if (retract_action & ProbeRetract) retract_z_probe();
|
if (retract_action & ProbeRetract) retract_z_probe(z_before);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (verbose_level > 2) {
|
if (verbose_level > 2) {
|
||||||
|
@ -1353,10 +1473,15 @@ static float probe_pt(float x, float y, float z_before, ProbeAction retract_acti
|
||||||
SERIAL_EOL;
|
SERIAL_EOL;
|
||||||
}
|
}
|
||||||
return measured_z;
|
return measured_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DELTA
|
#ifdef DELTA
|
||||||
static void extrapolate_one_point(int x, int y, int xdir, int ydir) {
|
|
||||||
|
/**
|
||||||
|
* All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void extrapolate_one_point(int x, int y, int xdir, int ydir) {
|
||||||
if (bed_level[x][y] != 0.0) {
|
if (bed_level[x][y] != 0.0) {
|
||||||
return; // Don't overwrite good values.
|
return; // Don't overwrite good values.
|
||||||
}
|
}
|
||||||
|
@ -1372,11 +1497,11 @@ static void extrapolate_one_point(int x, int y, int xdir, int ydir) {
|
||||||
if (a < c) median = a;
|
if (a < c) median = a;
|
||||||
}
|
}
|
||||||
bed_level[x][y] = median;
|
bed_level[x][y] = median;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in the unprobed points (corners of circular print surface)
|
// Fill in the unprobed points (corners of circular print surface)
|
||||||
// using linear extrapolation, away from the center.
|
// using linear extrapolation, away from the center.
|
||||||
static void extrapolate_unprobed_bed_level() {
|
static void extrapolate_unprobed_bed_level() {
|
||||||
int half = (AUTO_BED_LEVELING_GRID_POINTS-1)/2;
|
int half = (AUTO_BED_LEVELING_GRID_POINTS-1)/2;
|
||||||
for (int y = 0; y <= half; y++) {
|
for (int y = 0; y <= half; y++) {
|
||||||
for (int x = 0; x <= half; x++) {
|
for (int x = 0; x <= half; x++) {
|
||||||
|
@ -1387,10 +1512,10 @@ static void extrapolate_unprobed_bed_level() {
|
||||||
extrapolate_one_point(half+x, half+y, x>1?-1:0, y>1?-1:0);
|
extrapolate_one_point(half+x, half+y, x>1?-1:0, y>1?-1:0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print calibration results for plotting or manual frame adjustment.
|
// Print calibration results for plotting or manual frame adjustment.
|
||||||
static void print_bed_level() {
|
static void print_bed_level() {
|
||||||
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
||||||
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
||||||
SERIAL_PROTOCOL_F(bed_level[x][y], 2);
|
SERIAL_PROTOCOL_F(bed_level[x][y], 2);
|
||||||
|
@ -1398,39 +1523,58 @@ static void print_bed_level() {
|
||||||
}
|
}
|
||||||
SERIAL_ECHOLN("");
|
SERIAL_ECHOLN("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset calibration results to zero.
|
// Reset calibration results to zero.
|
||||||
void reset_bed_level() {
|
void reset_bed_level() {
|
||||||
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
||||||
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
||||||
bed_level[x][y] = 0.0;
|
bed_level[x][y] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DELTA
|
#endif // DELTA
|
||||||
|
|
||||||
#endif // ENABLE_AUTO_BED_LEVELING
|
#endif // ENABLE_AUTO_BED_LEVELING
|
||||||
|
|
||||||
static void homeaxis(int axis) {
|
static void homeaxis(int axis) {
|
||||||
#define HOMEAXIS_DO(LETTER) \
|
#define HOMEAXIS_DO(LETTER) \
|
||||||
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
||||||
|
|
||||||
if (axis==X_AXIS ? HOMEAXIS_DO(X) :
|
if (axis == X_AXIS ? HOMEAXIS_DO(X) :
|
||||||
axis==Y_AXIS ? HOMEAXIS_DO(Y) :
|
axis == Y_AXIS ? HOMEAXIS_DO(Y) :
|
||||||
axis==Z_AXIS ? HOMEAXIS_DO(Z) :
|
axis == Z_AXIS ? HOMEAXIS_DO(Z) : 0) {
|
||||||
0) {
|
|
||||||
int axis_home_dir = home_dir(axis);
|
int axis_home_dir;
|
||||||
#ifdef DUAL_X_CARRIAGE
|
|
||||||
if (axis == X_AXIS)
|
#ifdef DUAL_X_CARRIAGE
|
||||||
axis_home_dir = x_home_dir(active_extruder);
|
if (axis == X_AXIS) axis_home_dir = x_home_dir(active_extruder);
|
||||||
#endif
|
#else
|
||||||
|
axis_home_dir = home_dir(axis);
|
||||||
|
#endif
|
||||||
|
|
||||||
current_position[axis] = 0;
|
current_position[axis] = 0;
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
|
#ifndef Z_PROBE_SLED
|
||||||
|
// Engage Servo endstop if enabled
|
||||||
|
#ifdef SERVO_ENDSTOPS
|
||||||
|
#if SERVO_LEVELING
|
||||||
|
if (axis == Z_AXIS) {
|
||||||
|
engage_z_probe();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif // SERVO_LEVELING
|
||||||
|
|
||||||
|
if (servo_endstops[axis] > -1)
|
||||||
|
servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
|
||||||
|
|
||||||
|
#endif // SERVO_ENDSTOPS
|
||||||
|
|
||||||
|
#endif // Z_PROBE_SLED
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
#ifndef Z_PROBE_SLED
|
#ifndef Z_PROBE_SLED
|
||||||
// Engage Servo endstop if enabled and we are not using Z_PROBE_AND_ENDSTOP unless we are using Z_SAFE_HOMING
|
// Engage Servo endstop if enabled and we are not using Z_PROBE_AND_ENDSTOP unless we are using Z_SAFE_HOMING
|
||||||
#ifdef SERVO_ENDSTOPS && (defined (Z_SAFE_HOMING) || ! defined (Z_PROBE_AND_ENDSTOP))
|
#ifdef SERVO_ENDSTOPS && (defined (Z_SAFE_HOMING) || ! defined (Z_PROBE_AND_ENDSTOP))
|
||||||
|
@ -1445,33 +1589,33 @@ static void homeaxis(int axis) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif // Z_PROBE_SLED
|
#endif // Z_PROBE_SLED
|
||||||
|
=======
|
||||||
|
>>>>>>> MarlinFirmware/Development
|
||||||
#ifdef Z_DUAL_ENDSTOPS
|
#ifdef Z_DUAL_ENDSTOPS
|
||||||
if (axis==Z_AXIS) In_Homing_Process(true);
|
if (axis == Z_AXIS) In_Homing_Process(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
||||||
feedrate = homing_feedrate[axis];
|
feedrate = homing_feedrate[axis];
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
current_position[axis] = 0;
|
current_position[axis] = 0;
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
destination[axis] = -home_retract_mm(axis) * axis_home_dir;
|
destination[axis] = -home_retract_mm(axis) * axis_home_dir;
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
|
destination[axis] = 2 * home_retract_mm(axis) * axis_home_dir;
|
||||||
|
|
||||||
if (homing_bump_divisor[axis] >= 1)
|
if (homing_bump_divisor[axis] >= 1)
|
||||||
{
|
feedrate = homing_feedrate[axis] / homing_bump_divisor[axis];
|
||||||
feedrate = homing_feedrate[axis]/homing_bump_divisor[axis];
|
else {
|
||||||
}
|
feedrate = homing_feedrate[axis] / 10;
|
||||||
else
|
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less than 1");
|
||||||
{
|
|
||||||
feedrate = homing_feedrate[axis]/10;
|
|
||||||
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
#ifdef Z_DUAL_ENDSTOPS
|
#ifdef Z_DUAL_ENDSTOPS
|
||||||
if (axis==Z_AXIS)
|
if (axis==Z_AXIS)
|
||||||
|
@ -1486,7 +1630,7 @@ static void homeaxis(int axis) {
|
||||||
destination[axis] = fabs(z_endstop_adj);
|
destination[axis] = fabs(z_endstop_adj);
|
||||||
if (z_endstop_adj < 0) Lock_z_motor(true); else Lock_z2_motor(true);
|
if (z_endstop_adj < 0) Lock_z_motor(true); else Lock_z2_motor(true);
|
||||||
}
|
}
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
Lock_z_motor(false);
|
Lock_z_motor(false);
|
||||||
Lock_z2_motor(false);
|
Lock_z2_motor(false);
|
||||||
|
@ -1499,7 +1643,7 @@ static void homeaxis(int axis) {
|
||||||
if (endstop_adj[axis] * axis_home_dir < 0) {
|
if (endstop_adj[axis] * axis_home_dir < 0) {
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
destination[axis] = endstop_adj[axis];
|
destination[axis] = endstop_adj[axis];
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1544,7 +1688,7 @@ void refresh_cmd_timeout(void)
|
||||||
}
|
}
|
||||||
plan_set_e_position(current_position[E_AXIS]);
|
plan_set_e_position(current_position[E_AXIS]);
|
||||||
float oldFeedrate = feedrate;
|
float oldFeedrate = feedrate;
|
||||||
feedrate=retract_feedrate*60;
|
feedrate = retract_feedrate * 60;
|
||||||
retracted[active_extruder]=true;
|
retracted[active_extruder]=true;
|
||||||
prepare_move();
|
prepare_move();
|
||||||
if(retract_zlift > 0.01) {
|
if(retract_zlift > 0.01) {
|
||||||
|
@ -1580,8 +1724,8 @@ void refresh_cmd_timeout(void)
|
||||||
}
|
}
|
||||||
plan_set_e_position(current_position[E_AXIS]);
|
plan_set_e_position(current_position[E_AXIS]);
|
||||||
float oldFeedrate = feedrate;
|
float oldFeedrate = feedrate;
|
||||||
feedrate=retract_recover_feedrate*60;
|
feedrate = retract_recover_feedrate * 60;
|
||||||
retracted[active_extruder]=false;
|
retracted[active_extruder] = false;
|
||||||
prepare_move();
|
prepare_move();
|
||||||
feedrate = oldFeedrate;
|
feedrate = oldFeedrate;
|
||||||
}
|
}
|
||||||
|
@ -1735,17 +1879,16 @@ inline void gcode_G4() {
|
||||||
*/
|
*/
|
||||||
inline void gcode_G28() {
|
inline void gcode_G28() {
|
||||||
#ifdef ENABLE_AUTO_BED_LEVELING
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
||||||
|
plan_bed_level_matrix.set_to_identity(); //Reset the plane ("erase" all leveling data)
|
||||||
#ifdef DELTA
|
#ifdef DELTA
|
||||||
reset_bed_level();
|
reset_bed_level();
|
||||||
#else
|
|
||||||
plan_bed_level_matrix.set_to_identity(); //Reset the plane ("erase" all leveling data)
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MESH_BED_LEVELING)
|
#if defined(MESH_BED_LEVELING)
|
||||||
uint8_t mbl_was_active = mbl.active;
|
uint8_t mbl_was_active = mbl.active;
|
||||||
mbl.active = 0;
|
mbl.active = 0;
|
||||||
#endif // MESH_BED_LEVELING
|
#endif
|
||||||
|
|
||||||
saved_feedrate = feedrate;
|
saved_feedrate = feedrate;
|
||||||
saved_feedmultiply = feedmultiply;
|
saved_feedmultiply = feedmultiply;
|
||||||
|
@ -1768,7 +1911,7 @@ inline void gcode_G28() {
|
||||||
|
|
||||||
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];
|
feedrate = 1.732 * homing_feedrate[X_AXIS];
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
endstops_hit_on_purpose();
|
endstops_hit_on_purpose();
|
||||||
|
|
||||||
|
@ -1816,7 +1959,7 @@ inline void gcode_G28() {
|
||||||
} else {
|
} else {
|
||||||
feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1);
|
feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1);
|
||||||
}
|
}
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
axis_is_at_home(X_AXIS);
|
axis_is_at_home(X_AXIS);
|
||||||
|
@ -1824,7 +1967,7 @@ inline void gcode_G28() {
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
destination[X_AXIS] = current_position[X_AXIS];
|
destination[X_AXIS] = current_position[X_AXIS];
|
||||||
destination[Y_AXIS] = current_position[Y_AXIS];
|
destination[Y_AXIS] = current_position[Y_AXIS];
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
feedrate = 0.0;
|
feedrate = 0.0;
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
endstops_hit_on_purpose();
|
endstops_hit_on_purpose();
|
||||||
|
@ -1892,7 +2035,7 @@ inline void gcode_G28() {
|
||||||
#ifndef Z_PROBE_AND_ENDSTOP
|
#ifndef Z_PROBE_AND_ENDSTOP
|
||||||
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
||||||
feedrate = max_feedrate[Z_AXIS];
|
feedrate = max_feedrate[Z_AXIS];
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -1905,11 +2048,11 @@ inline void gcode_G28() {
|
||||||
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_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[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER);
|
||||||
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
||||||
feedrate = XY_TRAVEL_SPEED / 60;
|
feedrate = XY_TRAVEL_SPEED;
|
||||||
current_position[Z_AXIS] = 0;
|
current_position[Z_AXIS] = 0;
|
||||||
|
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
current_position[X_AXIS] = destination[X_AXIS];
|
current_position[X_AXIS] = destination[X_AXIS];
|
||||||
current_position[Y_AXIS] = destination[Y_AXIS];
|
current_position[Y_AXIS] = destination[Y_AXIS];
|
||||||
|
@ -1931,7 +2074,7 @@ inline void gcode_G28() {
|
||||||
plan_set_position(cpx, cpy, current_position[Z_AXIS], current_position[E_AXIS]);
|
plan_set_position(cpx, cpy, current_position[Z_AXIS], current_position[E_AXIS]);
|
||||||
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
||||||
feedrate = max_feedrate[Z_AXIS];
|
feedrate = max_feedrate[Z_AXIS];
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
HOMEAXIS(Z);
|
HOMEAXIS(Z);
|
||||||
}
|
}
|
||||||
|
@ -1984,7 +2127,7 @@ inline void gcode_G28() {
|
||||||
destination[Z_AXIS] = current_position[Z_AXIS];
|
destination[Z_AXIS] = current_position[Z_AXIS];
|
||||||
destination[E_AXIS] = current_position[E_AXIS];
|
destination[E_AXIS] = current_position[E_AXIS];
|
||||||
feedrate = homing_feedrate[X_AXIS];
|
feedrate = homing_feedrate[X_AXIS];
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
@ -1998,6 +2141,19 @@ inline void gcode_G28() {
|
||||||
endstops_hit_on_purpose();
|
endstops_hit_on_purpose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MESH_BED_LEVELING) || defined(ENABLE_AUTO_BED_LEVELING)
|
||||||
|
|
||||||
|
// Check for known positions in X and Y
|
||||||
|
inline bool can_run_bed_leveling() {
|
||||||
|
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) return true;
|
||||||
|
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
||||||
|
SERIAL_ECHO_START;
|
||||||
|
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // MESH_BED_LEVELING || ENABLE_AUTO_BED_LEVELING
|
||||||
|
|
||||||
#ifdef MESH_BED_LEVELING
|
#ifdef MESH_BED_LEVELING
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2012,6 +2168,10 @@ inline void gcode_G28() {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
inline void gcode_G29() {
|
inline void gcode_G29() {
|
||||||
|
|
||||||
|
// Prevent leveling without first homing in X and Y
|
||||||
|
if (!can_run_bed_leveling()) return;
|
||||||
|
|
||||||
static int probe_point = -1;
|
static int probe_point = -1;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
if (code_seen('S') || code_seen('s')) {
|
if (code_seen('S') || code_seen('s')) {
|
||||||
|
@ -2128,13 +2288,8 @@ inline void gcode_G28() {
|
||||||
*/
|
*/
|
||||||
inline void gcode_G29() {
|
inline void gcode_G29() {
|
||||||
|
|
||||||
// Prevent user from running a G29 without first homing in X and Y
|
// Prevent leveling without first homing in X and Y
|
||||||
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
|
if (!can_run_bed_leveling()) return;
|
||||||
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int verbose_level = 1;
|
int verbose_level = 1;
|
||||||
|
|
||||||
|
@ -2216,16 +2371,15 @@ inline void gcode_G28() {
|
||||||
|
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
if (!dryrun)
|
if (!dryrun) {
|
||||||
{
|
// make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
|
||||||
|
plan_bed_level_matrix.set_to_identity();
|
||||||
|
|
||||||
#ifdef DELTA
|
#ifdef DELTA
|
||||||
reset_bed_level();
|
reset_bed_level();
|
||||||
#else //!DELTA
|
#else //!DELTA
|
||||||
|
|
||||||
// make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
|
|
||||||
//vector_3 corrected_position = plan_get_position_mm();
|
//vector_3 corrected_position = plan_get_position_mm();
|
||||||
//corrected_position.debug("position before G29");
|
//corrected_position.debug("position before G29");
|
||||||
plan_bed_level_matrix.set_to_identity();
|
|
||||||
vector_3 uncorrected_position = plan_get_position();
|
vector_3 uncorrected_position = plan_get_position();
|
||||||
//uncorrected_position.debug("position during G29");
|
//uncorrected_position.debug("position during G29");
|
||||||
current_position[X_AXIS] = uncorrected_position.x;
|
current_position[X_AXIS] = uncorrected_position.x;
|
||||||
|
@ -2233,7 +2387,7 @@ inline void gcode_G28() {
|
||||||
current_position[Z_AXIS] = uncorrected_position.z;
|
current_position[Z_AXIS] = uncorrected_position.z;
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#endif
|
#endif // !DELTA
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_for_endstop_move();
|
setup_for_endstop_move();
|
||||||
|
@ -2294,13 +2448,12 @@ inline void gcode_G28() {
|
||||||
|
|
||||||
// raise extruder
|
// raise extruder
|
||||||
float measured_z,
|
float measured_z,
|
||||||
z_before = probePointCounter == 0 ? Z_RAISE_BEFORE_PROBING : current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
|
z_before = Z_RAISE_BETWEEN_PROBINGS + (probePointCounter ? current_position[Z_AXIS] : 0);
|
||||||
|
|
||||||
#ifdef DELTA
|
#ifdef DELTA
|
||||||
// Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
|
// Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
|
||||||
float distance_from_center = sqrt(xProbe*xProbe + yProbe*yProbe);
|
float distance_from_center = sqrt(xProbe*xProbe + yProbe*yProbe);
|
||||||
if (distance_from_center > DELTA_PROBABLE_RADIUS)
|
if (distance_from_center > DELTA_PROBABLE_RADIUS) continue;
|
||||||
continue;
|
|
||||||
#endif //DELTA
|
#endif //DELTA
|
||||||
|
|
||||||
// Enhanced G29 - Do not retract servo between probes
|
// Enhanced G29 - Do not retract servo between probes
|
||||||
|
@ -2328,6 +2481,11 @@ inline void gcode_G28() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
probePointCounter++;
|
probePointCounter++;
|
||||||
|
|
||||||
|
manage_heater();
|
||||||
|
manage_inactivity();
|
||||||
|
lcd_update();
|
||||||
|
|
||||||
} //xProbe
|
} //xProbe
|
||||||
} //yProbe
|
} //yProbe
|
||||||
|
|
||||||
|
@ -2414,16 +2572,14 @@ inline void gcode_G28() {
|
||||||
if (verbose_level > 0)
|
if (verbose_level > 0)
|
||||||
plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
||||||
|
|
||||||
|
if (!dryrun) {
|
||||||
// Correct the Z height difference from z-probe position and hotend tip position.
|
// Correct the Z height difference from z-probe position and hotend tip position.
|
||||||
// The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
|
// The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
|
||||||
// When the bed is uneven, this height must be corrected.
|
// When the bed is uneven, this height must be corrected.
|
||||||
if (!dryrun)
|
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
||||||
{
|
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
||||||
float x_tmp, y_tmp, z_tmp, real_z;
|
z_tmp = current_position[Z_AXIS],
|
||||||
real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
|
real_z = (float)st_get_position(Z_AXIS) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
|
||||||
x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
||||||
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
|
||||||
z_tmp = current_position[Z_AXIS];
|
|
||||||
|
|
||||||
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
|
||||||
current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
|
current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
|
||||||
|
@ -3791,7 +3947,7 @@ inline void gcode_M221() {
|
||||||
extruder_multiply[tmp_extruder] = sval;
|
extruder_multiply[tmp_extruder] = sval;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
extrudemultiply = sval;
|
extruder_multiply[active_extruder] = sval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4228,7 +4384,7 @@ inline void gcode_M400() { st_synchronize(); }
|
||||||
//SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
|
//SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
|
||||||
//SERIAL_PROTOCOL(filament_width_meas);
|
//SERIAL_PROTOCOL(filament_width_meas);
|
||||||
//SERIAL_PROTOCOLPGM("Extrusion ratio(%):");
|
//SERIAL_PROTOCOLPGM("Extrusion ratio(%):");
|
||||||
//SERIAL_PROTOCOL(extrudemultiply);
|
//SERIAL_PROTOCOL(extruder_multiply[active_extruder]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4701,18 +4857,14 @@ void process_commands() {
|
||||||
gcode_G28();
|
gcode_G28();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(MESH_BED_LEVELING)
|
#if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING)
|
||||||
case 29: // G29 Handle mesh based leveling
|
case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points.
|
||||||
gcode_G29();
|
gcode_G29();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AUTO_BED_LEVELING
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
||||||
|
|
||||||
case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points.
|
|
||||||
gcode_G29();
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifndef Z_PROBE_SLED
|
#ifndef Z_PROBE_SLED
|
||||||
|
|
||||||
case 30: // G30 Single Z Probe
|
case 30: // G30 Single Z Probe
|
||||||
|
@ -5407,28 +5559,27 @@ void prepare_move()
|
||||||
|
|
||||||
#ifdef SCARA //for now same as delta-code
|
#ifdef SCARA //for now same as delta-code
|
||||||
|
|
||||||
float difference[NUM_AXIS];
|
float difference[NUM_AXIS];
|
||||||
for (int8_t i=0; i < NUM_AXIS; i++) {
|
for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i];
|
||||||
difference[i] = destination[i] - current_position[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
float cartesian_mm = sqrt( sq(difference[X_AXIS]) +
|
float cartesian_mm = sqrt( sq(difference[X_AXIS]) +
|
||||||
sq(difference[Y_AXIS]) +
|
sq(difference[Y_AXIS]) +
|
||||||
sq(difference[Z_AXIS]));
|
sq(difference[Z_AXIS]));
|
||||||
if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
|
if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
|
||||||
if (cartesian_mm < 0.000001) { return; }
|
if (cartesian_mm < 0.000001) { return; }
|
||||||
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
||||||
int steps = max(1, int(scara_segments_per_second * seconds));
|
int steps = max(1, int(scara_segments_per_second * seconds));
|
||||||
|
|
||||||
//SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
|
//SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
|
||||||
//SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
|
//SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
|
||||||
//SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
|
//SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
|
||||||
for (int s = 1; s <= steps; s++) {
|
|
||||||
|
for (int s = 1; s <= steps; s++) {
|
||||||
float fraction = float(s) / float(steps);
|
float fraction = float(s) / float(steps);
|
||||||
for(int8_t i=0; i < NUM_AXIS; i++) {
|
for(int8_t i = 0; i < NUM_AXIS; i++) {
|
||||||
destination[i] = current_position[i] + difference[i] * fraction;
|
destination[i] = current_position[i] + difference[i] * fraction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
calculate_delta(destination);
|
calculate_delta(destination);
|
||||||
//SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
|
//SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
|
||||||
//SERIAL_ECHOPGM("destination[Y_AXIS]="); SERIAL_ECHOLN(destination[Y_AXIS]);
|
//SERIAL_ECHOPGM("destination[Y_AXIS]="); SERIAL_ECHOLN(destination[Y_AXIS]);
|
||||||
|
@ -5440,36 +5591,40 @@ for (int s = 1; s <= steps; s++) {
|
||||||
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
||||||
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
||||||
active_extruder);
|
active_extruder);
|
||||||
}
|
|
||||||
#endif // SCARA
|
|
||||||
|
|
||||||
#ifdef DELTA
|
|
||||||
float difference[NUM_AXIS];
|
|
||||||
for (int8_t i=0; i < NUM_AXIS; i++) {
|
|
||||||
difference[i] = destination[i] - current_position[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // SCARA
|
||||||
|
|
||||||
|
#ifdef DELTA
|
||||||
|
|
||||||
|
float difference[NUM_AXIS];
|
||||||
|
for (int8_t i=0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i];
|
||||||
|
|
||||||
float cartesian_mm = sqrt(sq(difference[X_AXIS]) +
|
float cartesian_mm = sqrt(sq(difference[X_AXIS]) +
|
||||||
sq(difference[Y_AXIS]) +
|
sq(difference[Y_AXIS]) +
|
||||||
sq(difference[Z_AXIS]));
|
sq(difference[Z_AXIS]));
|
||||||
if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
|
if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]);
|
||||||
if (cartesian_mm < 0.000001) { return; }
|
if (cartesian_mm < 0.000001) return;
|
||||||
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
||||||
int steps = max(1, int(delta_segments_per_second * seconds));
|
int steps = max(1, int(delta_segments_per_second * seconds));
|
||||||
|
|
||||||
// SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
|
// SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
|
||||||
// SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
|
// SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
|
||||||
// SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
|
// SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
|
||||||
|
|
||||||
for (int s = 1; s <= steps; s++) {
|
for (int s = 1; s <= steps; s++) {
|
||||||
float fraction = float(s) / float(steps);
|
float fraction = float(s) / float(steps);
|
||||||
for(int8_t i=0; i < NUM_AXIS; i++) {
|
for (int8_t i = 0; i < NUM_AXIS; i++) destination[i] = current_position[i] + difference[i] * fraction;
|
||||||
destination[i] = current_position[i] + difference[i] * fraction;
|
|
||||||
}
|
|
||||||
calculate_delta(destination);
|
calculate_delta(destination);
|
||||||
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
||||||
|
adjust_delta(destination);
|
||||||
|
#endif
|
||||||
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
||||||
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
||||||
active_extruder);
|
active_extruder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DELTA
|
#endif // DELTA
|
||||||
|
|
||||||
#ifdef DUAL_X_CARRIAGE
|
#ifdef DUAL_X_CARRIAGE
|
||||||
if (active_extruder_parked)
|
if (active_extruder_parked)
|
||||||
|
@ -5515,13 +5670,13 @@ for (int s = 1; s <= steps; s++) {
|
||||||
#if ! (defined DELTA || defined SCARA)
|
#if ! (defined DELTA || defined SCARA)
|
||||||
// Do not use feedmultiply for E or Z only moves
|
// Do not use feedmultiply for E or Z only moves
|
||||||
if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
|
if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
line_to_destination();
|
||||||
} else {
|
} else {
|
||||||
#if defined(MESH_BED_LEVELING)
|
#if defined(MESH_BED_LEVELING)
|
||||||
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder);
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder);
|
||||||
#endif // MESH_BED_LEVELING
|
#endif // MESH_BED_LEVELING
|
||||||
}
|
}
|
||||||
#endif // !(DELTA || SCARA)
|
#endif // !(DELTA || SCARA)
|
||||||
|
|
|
@ -369,7 +369,7 @@ static void lcd_implementation_status_screen() {
|
||||||
lcd_printPGM(PSTR("dia:"));
|
lcd_printPGM(PSTR("dia:"));
|
||||||
lcd_print(ftostr12ns(filament_width_meas));
|
lcd_print(ftostr12ns(filament_width_meas));
|
||||||
lcd_printPGM(PSTR(" factor:"));
|
lcd_printPGM(PSTR(" factor:"));
|
||||||
lcd_print(itostr3(extrudemultiply));
|
lcd_print(itostr3(volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
|
||||||
lcd_print('%');
|
lcd_print('%');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -545,7 +545,7 @@ float junction_deviation = 0.1;
|
||||||
block->steps[Z_AXIS] = labs(dz);
|
block->steps[Z_AXIS] = labs(dz);
|
||||||
block->steps[E_AXIS] = labs(de);
|
block->steps[E_AXIS] = labs(de);
|
||||||
block->steps[E_AXIS] *= volumetric_multiplier[active_extruder];
|
block->steps[E_AXIS] *= volumetric_multiplier[active_extruder];
|
||||||
block->steps[E_AXIS] *= extrudemultiply;
|
block->steps[E_AXIS] *= extruder_multiply[active_extruder];
|
||||||
block->steps[E_AXIS] /= 100;
|
block->steps[E_AXIS] /= 100;
|
||||||
block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
|
block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ float junction_deviation = 0.1;
|
||||||
delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
|
delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
|
||||||
#endif
|
#endif
|
||||||
delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
|
delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
|
||||||
delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[active_extruder] * extrudemultiply / 100.0;
|
delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[active_extruder] * extruder_multiply[active_extruder] / 100.0;
|
||||||
|
|
||||||
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
|
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
|
||||||
block->millimeters = fabs(delta_mm[E_AXIS]);
|
block->millimeters = fabs(delta_mm[E_AXIS]);
|
||||||
|
|
|
@ -515,31 +515,36 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST(out_bits, Z_AXIS)) { // -direction
|
if (TEST(out_bits, Z_AXIS)) { // -direction
|
||||||
|
|
||||||
Z_APPLY_DIR(INVERT_Z_DIR,0);
|
Z_APPLY_DIR(INVERT_Z_DIR,0);
|
||||||
count_direction[Z_AXIS] = -1;
|
count_direction[Z_AXIS] = -1;
|
||||||
if (check_endstops)
|
|
||||||
{
|
if (check_endstops) {
|
||||||
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
|
|
||||||
#ifndef Z_DUAL_ENDSTOPS
|
#if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0
|
||||||
UPDATE_ENDSTOP(z, Z, min, MIN);
|
|
||||||
|
#ifdef Z_DUAL_ENDSTOPS
|
||||||
|
|
||||||
|
bool z_min_endstop = READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING,
|
||||||
|
z2_min_endstop =
|
||||||
|
#if defined(Z2_MIN_PIN) && Z2_MIN_PIN >= 0
|
||||||
|
READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING
|
||||||
#else
|
#else
|
||||||
bool z_min_endstop=(READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
z_min_endstop
|
||||||
#if defined(Z2_MIN_PIN) && Z2_MIN_PIN > -1
|
|
||||||
bool z2_min_endstop=(READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING);
|
|
||||||
#else
|
|
||||||
bool z2_min_endstop=z_min_endstop;
|
|
||||||
#endif
|
#endif
|
||||||
if(((z_min_endstop && old_z_min_endstop) || (z2_min_endstop && old_z2_min_endstop)) && (current_block->steps[Z_AXIS] > 0))
|
;
|
||||||
{
|
|
||||||
|
bool z_min_both = z_min_endstop && old_z_min_endstop,
|
||||||
|
z2_min_both = z2_min_endstop && old_z2_min_endstop;
|
||||||
|
if ((z_min_both || z2_min_both) && current_block->steps[Z_AXIS] > 0) {
|
||||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||||
endstop_z_hit=true;
|
endstop_z_hit = true;
|
||||||
if (!(performing_homing) || ((performing_homing)&&(z_min_endstop && old_z_min_endstop)&&(z2_min_endstop && old_z2_min_endstop))) //if not performing home or if both endstops were trigged during homing...
|
if (!performing_homing || (performing_homing && z_min_both && z2_min_both)) //if not performing home or if both endstops were trigged during homing...
|
||||||
{
|
|
||||||
step_events_completed = current_block->step_event_count;
|
step_events_completed = current_block->step_event_count;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
old_z_min_endstop = z_min_endstop;
|
old_z_min_endstop = z_min_endstop;
|
||||||
old_z2_min_endstop = z2_min_endstop;
|
old_z2_min_endstop = z2_min_endstop;
|
||||||
|
<<<<<<< HEAD
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -556,37 +561,55 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
old_z_probe_endstop = z_probe_endstop;
|
old_z_probe_endstop = z_probe_endstop;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
|
||||||
|
#else // !Z_DUAL_ENDSTOPS
|
||||||
|
|
||||||
|
UPDATE_ENDSTOP(z, Z, min, MIN);
|
||||||
|
|
||||||
|
#endif // !Z_DUAL_ENDSTOPS
|
||||||
|
|
||||||
|
#endif // Z_MIN_PIN
|
||||||
|
|
||||||
|
} // check_endstops
|
||||||
|
|
||||||
|
>>>>>>> MarlinFirmware/Development
|
||||||
}
|
}
|
||||||
else { // +direction
|
else { // +direction
|
||||||
|
|
||||||
Z_APPLY_DIR(!INVERT_Z_DIR,0);
|
Z_APPLY_DIR(!INVERT_Z_DIR,0);
|
||||||
count_direction[Z_AXIS] = 1;
|
count_direction[Z_AXIS] = 1;
|
||||||
|
|
||||||
if (check_endstops) {
|
if (check_endstops) {
|
||||||
|
|
||||||
#if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
|
#if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
|
||||||
#ifndef Z_DUAL_ENDSTOPS
|
|
||||||
UPDATE_ENDSTOP(z, Z, max, MAX);
|
#ifdef Z_DUAL_ENDSTOPS
|
||||||
|
|
||||||
|
bool z_max_endstop = READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING,
|
||||||
|
z2_max_endstop =
|
||||||
|
#if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0
|
||||||
|
READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING
|
||||||
#else
|
#else
|
||||||
bool z_max_endstop=(READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING);
|
z_max_endstop
|
||||||
#if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1
|
|
||||||
bool z2_max_endstop=(READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING);
|
|
||||||
#else
|
|
||||||
bool z2_max_endstop=z_max_endstop;
|
|
||||||
#endif
|
#endif
|
||||||
if(((z_max_endstop && old_z_max_endstop) || (z2_max_endstop && old_z2_max_endstop)) && (current_block->steps[Z_AXIS] > 0))
|
;
|
||||||
{
|
|
||||||
|
bool z_max_both = z_max_endstop && old_z_max_endstop,
|
||||||
|
z2_max_both = z2_max_endstop && old_z2_max_endstop;
|
||||||
|
if ((z_max_both || z2_max_both) && current_block->steps[Z_AXIS] > 0) {
|
||||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||||
endstop_z_hit=true;
|
endstop_z_hit = true;
|
||||||
|
|
||||||
// if (z_max_endstop && old_z_max_endstop) SERIAL_ECHOLN("z_max_endstop = true");
|
// if (z_max_both) SERIAL_ECHOLN("z_max_endstop = true");
|
||||||
// if (z2_max_endstop && old_z2_max_endstop) SERIAL_ECHOLN("z2_max_endstop = true");
|
// if (z2_max_both) SERIAL_ECHOLN("z2_max_endstop = true");
|
||||||
|
|
||||||
|
if (!performing_homing || (performing_homing && z_max_both && z2_max_both)) //if not performing home or if both endstops were trigged during homing...
|
||||||
if (!(performing_homing) || ((performing_homing)&&(z_max_endstop && old_z_max_endstop)&&(z2_max_endstop && old_z2_max_endstop))) //if not performing home or if both endstops were trigged during homing...
|
|
||||||
{
|
|
||||||
step_events_completed = current_block->step_event_count;
|
step_events_completed = current_block->step_event_count;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
old_z_max_endstop = z_max_endstop;
|
old_z_max_endstop = z_max_endstop;
|
||||||
old_z2_max_endstop = z2_max_endstop;
|
old_z2_max_endstop = z2_max_endstop;
|
||||||
|
<<<<<<< HEAD
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -603,20 +626,34 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
|
||||||
|
#else // !Z_DUAL_ENDSTOPS
|
||||||
|
|
||||||
|
UPDATE_ENDSTOP(z, Z, max, MAX);
|
||||||
|
|
||||||
|
#endif // !Z_DUAL_ENDSTOPS
|
||||||
|
|
||||||
|
#endif // Z_MAX_PIN
|
||||||
|
|
||||||
|
} // check_endstops
|
||||||
|
|
||||||
|
} // +direction
|
||||||
|
>>>>>>> MarlinFirmware/Development
|
||||||
|
|
||||||
#ifndef ADVANCE
|
#ifndef ADVANCE
|
||||||
if (TEST(out_bits, E_AXIS)) { // -direction
|
if (TEST(out_bits, E_AXIS)) { // -direction
|
||||||
REV_E_DIR();
|
REV_E_DIR();
|
||||||
count_direction[E_AXIS]=-1;
|
count_direction[E_AXIS] = -1;
|
||||||
}
|
}
|
||||||
else { // +direction
|
else { // +direction
|
||||||
NORM_E_DIR();
|
NORM_E_DIR();
|
||||||
count_direction[E_AXIS]=1;
|
count_direction[E_AXIS] = 1;
|
||||||
}
|
}
|
||||||
#endif //!ADVANCE
|
#endif //!ADVANCE
|
||||||
|
|
||||||
// Take multiple steps per interrupt (For high speed moves)
|
// Take multiple steps per interrupt (For high speed moves)
|
||||||
for (int8_t i=0; i < step_loops; i++) {
|
for (int8_t i = 0; i < step_loops; i++) {
|
||||||
#ifndef AT90USB
|
#ifndef AT90USB
|
||||||
MSerial.checkRx(); // Check for serial chars.
|
MSerial.checkRx(); // Check for serial chars.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -485,7 +485,7 @@ static void lcd_tune_menu() {
|
||||||
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
||||||
#endif
|
#endif
|
||||||
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
|
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
|
||||||
MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
|
MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiply[active_extruder], 10, 999);
|
||||||
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
|
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
|
||||||
#if TEMP_SENSOR_1 != 0
|
#if TEMP_SENSOR_1 != 0
|
||||||
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999);
|
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999);
|
||||||
|
|
|
@ -624,7 +624,7 @@ static void lcd_implementation_status_screen()
|
||||||
|
|
||||||
static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
|
static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
|
||||||
char c;
|
char c;
|
||||||
uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2);
|
uint8_t n = LCD_WIDTH - 2;
|
||||||
lcd.setCursor(0, row);
|
lcd.setCursor(0, row);
|
||||||
lcd.print(sel ? pre_char : ' ');
|
lcd.print(sel ? pre_char : ' ');
|
||||||
while ((c = pgm_read_byte(pstr)) && n > 0) {
|
while ((c = pgm_read_byte(pstr)) && n > 0) {
|
||||||
|
@ -633,12 +633,11 @@ static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const cha
|
||||||
}
|
}
|
||||||
while(n--) lcd.print(' ');
|
while(n--) lcd.print(' ');
|
||||||
lcd.print(post_char);
|
lcd.print(post_char);
|
||||||
lcd.print(' ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
|
static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
|
||||||
char c;
|
char c;
|
||||||
uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen(data);
|
uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data);
|
||||||
lcd.setCursor(0, row);
|
lcd.setCursor(0, row);
|
||||||
lcd.print(sel ? pre_char : ' ');
|
lcd.print(sel ? pre_char : ' ');
|
||||||
while ((c = pgm_read_byte(pstr)) && n > 0) {
|
while ((c = pgm_read_byte(pstr)) && n > 0) {
|
||||||
|
@ -651,7 +650,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t r
|
||||||
}
|
}
|
||||||
static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) {
|
static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) {
|
||||||
char c;
|
char c;
|
||||||
uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen_P(data);
|
uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data);
|
||||||
lcd.setCursor(0, row);
|
lcd.setCursor(0, row);
|
||||||
lcd.print(sel ? pre_char : ' ');
|
lcd.print(sel ? pre_char : ' ');
|
||||||
while ((c = pgm_read_byte(pstr)) && n > 0) {
|
while ((c = pgm_read_byte(pstr)) && n > 0) {
|
||||||
|
@ -688,11 +687,11 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
|
||||||
lcd.setCursor(1, 1);
|
lcd.setCursor(1, 1);
|
||||||
lcd_printPGM(pstr);
|
lcd_printPGM(pstr);
|
||||||
lcd.print(':');
|
lcd.print(':');
|
||||||
lcd.setCursor(LCD_WIDTH - (LCD_WIDTH < 20 ? 0 : 1) - lcd_strlen(value), 1);
|
lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
|
||||||
lcd_print(value);
|
lcd_print(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat) {
|
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) {
|
||||||
char c;
|
char c;
|
||||||
uint8_t n = LCD_WIDTH - concat;
|
uint8_t n = LCD_WIDTH - concat;
|
||||||
lcd.setCursor(0, row);
|
lcd.setCursor(0, row);
|
||||||
|
@ -706,14 +705,15 @@ static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* ps
|
||||||
filename++;
|
filename++;
|
||||||
}
|
}
|
||||||
while (n--) lcd.print(' ');
|
while (n--) lcd.print(' ');
|
||||||
|
lcd.print(post_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
||||||
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 1);
|
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
||||||
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2);
|
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
|
#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
|
||||||
|
|
Loading…
Reference in a new issue