|
@ -1,6 +1,6 @@ |
|
|
/**
|
|
|
/**
|
|
|
* Marlin 3D Printer Firmware |
|
|
* Marlin 3D Printer Firmware |
|
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
* Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
* |
|
|
* |
|
|
* Based on Sprinter and grbl. |
|
|
* Based on Sprinter and grbl. |
|
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm |
|
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm |
|
@ -234,6 +234,10 @@ |
|
|
#include "duration_t.h" |
|
|
#include "duration_t.h" |
|
|
#include "types.h" |
|
|
#include "types.h" |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
#include "UBL.h" |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#if HAS_ABL |
|
|
#if HAS_ABL |
|
|
#include "vector_3.h" |
|
|
#include "vector_3.h" |
|
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR) |
|
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR) |
|
@ -297,6 +301,10 @@ |
|
|
G38_endstop_hit = false; |
|
|
G38_endstop_hit = false; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
bed_leveling blm; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
bool Running = true; |
|
|
bool Running = true; |
|
|
|
|
|
|
|
|
uint8_t marlin_debug_flags = DEBUG_NONE; |
|
|
uint8_t marlin_debug_flags = DEBUG_NONE; |
|
@ -315,7 +323,7 @@ float current_position[XYZE] = { 0.0 }; |
|
|
* Set with 'gcode_get_destination' or 'set_destination_to_current'. |
|
|
* Set with 'gcode_get_destination' or 'set_destination_to_current'. |
|
|
* 'line_to_destination' sets 'current_position' to 'destination'. |
|
|
* 'line_to_destination' sets 'current_position' to 'destination'. |
|
|
*/ |
|
|
*/ |
|
|
static float destination[XYZE] = { 0.0 }; |
|
|
float destination[XYZE] = { 0.0 }; |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* axis_homed |
|
|
* axis_homed |
|
@ -1760,7 +1768,7 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
#endif //HAS_BED_PROBE
|
|
|
#endif //HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) |
|
|
#if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) |
|
|
static bool axis_unhomed_error(const bool x, const bool y, const bool z) { |
|
|
bool axis_unhomed_error(const bool x, const bool y, const bool z) { |
|
|
const bool xx = x && !axis_homed[X_AXIS], |
|
|
const bool xx = x && !axis_homed[X_AXIS], |
|
|
yy = y && !axis_homed[Y_AXIS], |
|
|
yy = y && !axis_homed[Y_AXIS], |
|
|
zz = z && !axis_homed[Z_AXIS]; |
|
|
zz = z && !axis_homed[Z_AXIS]; |
|
@ -2009,7 +2017,7 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
// returns false for ok and true for failure
|
|
|
// returns false for ok and true for failure
|
|
|
static bool set_probe_deployed(bool deploy) { |
|
|
bool set_probe_deployed(bool deploy) { |
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
if (DEBUGGING(LEVELING)) { |
|
|
if (DEBUGGING(LEVELING)) { |
|
@ -2184,7 +2192,8 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
// - Raise to the BETWEEN height
|
|
|
// - Raise to the BETWEEN height
|
|
|
// - Return the probed Z position
|
|
|
// - Return the probed Z position
|
|
|
//
|
|
|
//
|
|
|
static float probe_pt(const float &x, const float &y, const bool stow = true, const int verbose_level = 1) { |
|
|
//float probe_pt(const float &x, const float &y, const bool stow = true, const int verbose_level = 1) {
|
|
|
|
|
|
float probe_pt(const float x, const float y, const bool stow, const int verbose_level) { |
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) |
|
|
if (DEBUGGING(LEVELING)) { |
|
|
if (DEBUGGING(LEVELING)) { |
|
|
SERIAL_ECHOPAIR(">>> probe_pt(", x); |
|
|
SERIAL_ECHOPAIR(">>> probe_pt(", x); |
|
@ -3279,10 +3288,12 @@ inline void gcode_G4() { |
|
|
SERIAL_ECHOPGM("BILINEAR"); |
|
|
SERIAL_ECHOPGM("BILINEAR"); |
|
|
#elif ENABLED(AUTO_BED_LEVELING_3POINT) |
|
|
#elif ENABLED(AUTO_BED_LEVELING_3POINT) |
|
|
SERIAL_ECHOPGM("3POINT"); |
|
|
SERIAL_ECHOPGM("3POINT"); |
|
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
SERIAL_ECHOPGM("UBL"); |
|
|
#endif |
|
|
#endif |
|
|
if (planner.abl_enabled) { |
|
|
if (planner.abl_enabled) { |
|
|
SERIAL_ECHOLNPGM(" (enabled)"); |
|
|
SERIAL_ECHOLNPGM(" (enabled)"); |
|
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT) |
|
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
float diff[XYZ] = { |
|
|
float diff[XYZ] = { |
|
|
stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS], |
|
|
stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS], |
|
|
stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS], |
|
|
stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS], |
|
@ -3830,7 +3841,7 @@ inline void gcode_G28() { |
|
|
report_current_position(); |
|
|
report_current_position(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#elif HAS_ABL |
|
|
#elif HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* G29: Detailed Z probe, probes the bed at 3 or more points. |
|
|
* G29: Detailed Z probe, probes the bed at 3 or more points. |
|
@ -4383,7 +4394,7 @@ inline void gcode_G28() { |
|
|
SYNC_PLAN_POSITION_KINEMATIC(); |
|
|
SYNC_PLAN_POSITION_KINEMATIC(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // HAS_ABL
|
|
|
#endif // HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
|
|
|
|
|
|
|
|
|
#if HAS_BED_PROBE |
|
|
#if HAS_BED_PROBE |
|
|
|
|
|
|
|
@ -6993,6 +7004,8 @@ void quickstop_stepper() { |
|
|
bed_level_virt_print(); |
|
|
bed_level_virt_print(); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
blm.display_map(0); // Right now, we only support one type of map
|
|
|
#elif ENABLED(MESH_BED_LEVELING) |
|
|
#elif ENABLED(MESH_BED_LEVELING) |
|
|
if (mbl.has_mesh()) { |
|
|
if (mbl.has_mesh()) { |
|
|
SERIAL_ECHOLNPGM("Mesh Bed Level data:"); |
|
|
SERIAL_ECHOLNPGM("Mesh Bed Level data:"); |
|
@ -8303,6 +8316,12 @@ void process_next_command() { |
|
|
break; |
|
|
break; |
|
|
#endif // INCH_MODE_SUPPORT
|
|
|
#endif // INCH_MODE_SUPPORT
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
case 26: // G26: Mesh Validation Pattern generation
|
|
|
|
|
|
gcode_G26(); |
|
|
|
|
|
break; |
|
|
|
|
|
#endif // AUTO_BED_LEVELING_UBL
|
|
|
|
|
|
|
|
|
#if ENABLED(NOZZLE_PARK_FEATURE) |
|
|
#if ENABLED(NOZZLE_PARK_FEATURE) |
|
|
case 27: // G27: Nozzle Park
|
|
|
case 27: // G27: Nozzle Park
|
|
|
gcode_G27(); |
|
|
gcode_G27(); |
|
@ -8314,7 +8333,8 @@ void process_next_command() { |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
#if PLANNER_LEVELING |
|
|
#if PLANNER_LEVELING |
|
|
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points.
|
|
|
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
|
|
|
|
|
|
// or provides access to the UBL System if enabled.
|
|
|
gcode_G29(); |
|
|
gcode_G29(); |
|
|
break; |
|
|
break; |
|
|
#endif // PLANNER_LEVELING
|
|
|
#endif // PLANNER_LEVELING
|
|
@ -8421,12 +8441,24 @@ void process_next_command() { |
|
|
gcode_M43(); break; |
|
|
gcode_M43(); break; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) |
|
|
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) |
|
|
case 48: // M48: Z probe repeatability test
|
|
|
case 48: // M48: Z probe repeatability test
|
|
|
gcode_M48(); |
|
|
gcode_M48(); |
|
|
break; |
|
|
break; |
|
|
#endif // Z_MIN_PROBE_REPEATABILITY_TEST
|
|
|
#endif // Z_MIN_PROBE_REPEATABILITY_TEST
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
case 49: // M49: Turn on or off G26_Debug_flag for verbose output
|
|
|
|
|
|
if (G26_Debug_flag) { |
|
|
|
|
|
SERIAL_PROTOCOLPGM("UBL Debug Flag turned off.\n"); |
|
|
|
|
|
G26_Debug_flag = 0; } |
|
|
|
|
|
else { |
|
|
|
|
|
SERIAL_PROTOCOLPGM("UBL Debug Flag turned on.\n"); |
|
|
|
|
|
G26_Debug_flag++; } |
|
|
|
|
|
break; |
|
|
|
|
|
#endif // Z_MIN_PROBE_REPEATABILITY_TEST
|
|
|
|
|
|
|
|
|
case 75: // M75: Start print timer
|
|
|
case 75: // M75: Start print timer
|
|
|
gcode_M75(); break; |
|
|
gcode_M75(); break; |
|
|
case 76: // M76: Pause print timer
|
|
|
case 76: // M76: Pause print timer
|
|
@ -9066,7 +9098,7 @@ void ok_to_send() { |
|
|
SERIAL_ECHOLNPAIR(" offset=", offset); |
|
|
SERIAL_ECHOLNPAIR(" offset=", offset); |
|
|
} |
|
|
} |
|
|
last_offset = offset; |
|
|
last_offset = offset; |
|
|
//*/
|
|
|
*/ |
|
|
|
|
|
|
|
|
return offset; |
|
|
return offset; |
|
|
} |
|
|
} |
|
@ -9552,6 +9584,18 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
if (blm.state.active) { |
|
|
|
|
|
|
|
|
|
|
|
// UBL_line_to_destination(MMS_SCALED(feedrate_mm_s));
|
|
|
|
|
|
|
|
|
|
|
|
UBL_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], |
|
|
|
|
|
// (feedrate*(1.0/60.0))*(feedrate_percentage*(1.0/100.0) ), active_extruder);
|
|
|
|
|
|
MMS_SCALED(feedrate_mm_s), active_extruder); |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) |
|
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) |
|
|
if (planner.abl_enabled) { |
|
|
if (planner.abl_enabled) { |
|
|
bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s)); |
|
|
bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s)); |
|
|