|
|
@ -1394,7 +1394,7 @@ bool get_target_extruder_from_command(int code) {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Callers must sync the planner position after calling this!
|
|
|
|
* Callers must sync the planner position after calling this!
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void set_axis_is_at_home(AxisEnum axis) {
|
|
|
|
static void set_axis_is_at_home(const AxisEnum axis) {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]);
|
|
|
|
SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]);
|
|
|
@ -1496,7 +1496,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Some planner shorthand inline functions
|
|
|
|
* Some planner shorthand inline functions
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline float get_homing_bump_feedrate(AxisEnum axis) {
|
|
|
|
inline float get_homing_bump_feedrate(const AxisEnum axis) {
|
|
|
|
int constexpr homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
|
|
|
int constexpr homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
|
|
|
int hbd = homing_bump_divisor[axis];
|
|
|
|
int hbd = homing_bump_divisor[axis];
|
|
|
|
if (hbd < 1) {
|
|
|
|
if (hbd < 1) {
|
|
|
@ -1507,20 +1507,19 @@ inline float get_homing_bump_feedrate(AxisEnum axis) {
|
|
|
|
return homing_feedrate_mm_s[axis] / hbd;
|
|
|
|
return homing_feedrate_mm_s[axis] / hbd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
// line_to_current_position
|
|
|
|
* Move the planner to the current position from wherever it last moved
|
|
|
|
// Move the planner to the current position from wherever it last moved
|
|
|
|
* (or from wherever it has been told it is located).
|
|
|
|
// (or from wherever it has been told it is located).
|
|
|
|
*/
|
|
|
|
//
|
|
|
|
|
|
|
|
inline void line_to_current_position() {
|
|
|
|
inline void line_to_current_position() {
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder);
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
// line_to_destination
|
|
|
|
* Move the planner to the position stored in the destination array, which is
|
|
|
|
// Move the planner, not necessarily synced with current_position
|
|
|
|
* used by G0/G1/G2/G3/G5 and many other functions to set a destination.
|
|
|
|
//
|
|
|
|
*/
|
|
|
|
inline void line_to_destination(float fr_mm_s) {
|
|
|
|
inline void line_to_destination(const float fr_mm_s) {
|
|
|
|
planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], fr_mm_s, active_extruder);
|
|
|
|
planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], fr_mm_s, active_extruder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inline void line_to_destination() { line_to_destination(feedrate_mm_s); }
|
|
|
|
inline void line_to_destination() { line_to_destination(feedrate_mm_s); }
|
|
|
@ -2751,7 +2750,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Home an individual linear axis
|
|
|
|
* Home an individual linear axis
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void do_homing_move(const AxisEnum axis, float distance, float fr_mm_s=0.0) {
|
|
|
|
static void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm_s=0.0) {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
@ -4907,7 +4906,7 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
if ( NEAR(current_position[X_AXIS], xProbe - (X_PROBE_OFFSET_FROM_EXTRUDER))
|
|
|
|
if ( NEAR(current_position[X_AXIS], xProbe - (X_PROBE_OFFSET_FROM_EXTRUDER))
|
|
|
|
&& NEAR(current_position[Y_AXIS], yProbe - (Y_PROBE_OFFSET_FROM_EXTRUDER))
|
|
|
|
&& NEAR(current_position[Y_AXIS], yProbe - (Y_PROBE_OFFSET_FROM_EXTRUDER))
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
float simple_z = current_position[Z_AXIS] - measured_z;
|
|
|
|
const float simple_z = current_position[Z_AXIS] - measured_z;
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR("Z from Probe:", simple_z);
|
|
|
|
SERIAL_ECHOPAIR("Z from Probe:", simple_z);
|
|
|
@ -7667,45 +7666,32 @@ void report_current_position() {
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef M114_DETAIL
|
|
|
|
#ifdef M114_DETAIL
|
|
|
|
|
|
|
|
|
|
|
|
static const char axis_char[XYZE] = {'X','Y','Z','E'};
|
|
|
|
void report_xyze(const float pos[XYZE], const uint8_t n = 4, const uint8_t precision = 3) {
|
|
|
|
|
|
|
|
|
|
|
|
void report_xyze(const float pos[XYZE], uint8_t n = 4, uint8_t precision = 3) {
|
|
|
|
|
|
|
|
char str[12];
|
|
|
|
char str[12];
|
|
|
|
for (uint8_t i = 0; i < n; i++) {
|
|
|
|
for (uint8_t i = 0; i < n; i++) {
|
|
|
|
SERIAL_CHAR(' ');
|
|
|
|
SERIAL_CHAR(' ');
|
|
|
|
SERIAL_CHAR(axis_char[i]);
|
|
|
|
SERIAL_CHAR(axis_codes[i]);
|
|
|
|
SERIAL_CHAR(':');
|
|
|
|
SERIAL_CHAR(':');
|
|
|
|
SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str));
|
|
|
|
SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void report_xyz(const float pos[XYZ]) {
|
|
|
|
inline void report_xyz(const float pos[XYZ]) { report_xyze(pos, 3); }
|
|
|
|
report_xyze(pos,3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void report_current_position_detail() {
|
|
|
|
void report_current_position_detail() {
|
|
|
|
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_PROTOCOLPGM("\nLogical:");
|
|
|
|
SERIAL_PROTOCOLPGM("Logical:");
|
|
|
|
|
|
|
|
report_xyze(current_position);
|
|
|
|
report_xyze(current_position);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Raw: ");
|
|
|
|
SERIAL_PROTOCOLPGM("Raw: ");
|
|
|
|
const float raw[XYZ] = {
|
|
|
|
const float raw[XYZ] = { RAW_X_POSITION(current_position[X_AXIS]), RAW_Y_POSITION(current_position[Y_AXIS]), RAW_Z_POSITION(current_position[Z_AXIS]) };
|
|
|
|
RAW_X_POSITION(current_position[X_AXIS]),
|
|
|
|
|
|
|
|
RAW_Y_POSITION(current_position[Y_AXIS]),
|
|
|
|
|
|
|
|
RAW_Z_POSITION(current_position[Z_AXIS])
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
report_xyz(raw);
|
|
|
|
report_xyz(raw);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Leveled:");
|
|
|
|
SERIAL_PROTOCOLPGM("Leveled:");
|
|
|
|
float leveled[XYZ] = {
|
|
|
|
float leveled[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
|
|
|
|
current_position[X_AXIS],
|
|
|
|
|
|
|
|
current_position[Y_AXIS],
|
|
|
|
|
|
|
|
current_position[Z_AXIS]
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
planner.apply_leveling(leveled);
|
|
|
|
planner.apply_leveling(leveled);
|
|
|
|
report_xyz(leveled);
|
|
|
|
report_xyz(leveled);
|
|
|
|
|
|
|
|
|
|
|
@ -7725,12 +7711,7 @@ void report_current_position() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Stepper:");
|
|
|
|
SERIAL_PROTOCOLPGM("Stepper:");
|
|
|
|
const float step_count[XYZE] = {
|
|
|
|
const float step_count[XYZE] = { stepper.position(X_AXIS), stepper.position(Y_AXIS), stepper.position(Z_AXIS), stepper.position(E_AXIS) };
|
|
|
|
(float)stepper.position(X_AXIS),
|
|
|
|
|
|
|
|
(float)stepper.position(Y_AXIS),
|
|
|
|
|
|
|
|
(float)stepper.position(Z_AXIS),
|
|
|
|
|
|
|
|
(float)stepper.position(E_AXIS)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
report_xyze(step_count, 4, 0);
|
|
|
|
report_xyze(step_count, 4, 0);
|
|
|
|
|
|
|
|
|
|
|
|
#if IS_SCARA
|
|
|
|
#if IS_SCARA
|
|
|
@ -7744,12 +7725,7 @@ void report_current_position() {
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("FromStp:");
|
|
|
|
SERIAL_PROTOCOLPGM("FromStp:");
|
|
|
|
get_cartesian_from_steppers(); // writes cartes[XYZ] (with forward kinematics)
|
|
|
|
get_cartesian_from_steppers(); // writes cartes[XYZ] (with forward kinematics)
|
|
|
|
const float from_steppers[XYZE] = {
|
|
|
|
const float from_steppers[XYZE] = { cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS], stepper.get_axis_position_mm(E_AXIS) };
|
|
|
|
cartes[X_AXIS],
|
|
|
|
|
|
|
|
cartes[Y_AXIS],
|
|
|
|
|
|
|
|
cartes[Z_AXIS],
|
|
|
|
|
|
|
|
stepper.get_axis_position_mm(E_AXIS)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
report_xyze(from_steppers);
|
|
|
|
report_xyze(from_steppers);
|
|
|
|
|
|
|
|
|
|
|
|
const float diff[XYZE] = {
|
|
|
|
const float diff[XYZE] = {
|
|
|
@ -7764,7 +7740,7 @@ void report_current_position() {
|
|
|
|
#endif // M114_DETAIL
|
|
|
|
#endif // M114_DETAIL
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M114: Output current position to serial port
|
|
|
|
* M114: Report current position to host
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M114() {
|
|
|
|
inline void gcode_M114() {
|
|
|
|
|
|
|
|
|
|
|
@ -7859,9 +7835,7 @@ inline void gcode_M115() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M117: Set LCD Status Message
|
|
|
|
* M117: Set LCD Status Message
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M117() {
|
|
|
|
inline void gcode_M117() { lcd_setstatus(parser.string_arg); }
|
|
|
|
lcd_setstatus(parser.string_arg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M119: Output endstop states to serial output
|
|
|
|
* M119: Output endstop states to serial output
|
|
|
|