|
|
@ -1,6 +1,6 @@ |
|
|
|
/**
|
|
|
|
* 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. |
|
|
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm |
|
|
@ -234,6 +234,10 @@ |
|
|
|
#include "duration_t.h" |
|
|
|
#include "types.h" |
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
#include "UBL.h" |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_ABL |
|
|
|
#include "vector_3.h" |
|
|
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR) |
|
|
@ -297,6 +301,10 @@ |
|
|
|
G38_endstop_hit = false; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
bed_leveling blm; |
|
|
|
#endif |
|
|
|
|
|
|
|
bool Running = true; |
|
|
|
|
|
|
|
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'. |
|
|
|
* 'line_to_destination' sets 'current_position' to 'destination'. |
|
|
|
*/ |
|
|
|
static float destination[XYZE] = { 0.0 }; |
|
|
|
float destination[XYZE] = { 0.0 }; |
|
|
|
|
|
|
|
/**
|
|
|
|
* axis_homed |
|
|
@ -1760,7 +1768,7 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
|
#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) |
|
|
|
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], |
|
|
|
yy = y && !axis_homed[Y_AXIS], |
|
|
|
zz = z && !axis_homed[Z_AXIS]; |
|
|
@ -2009,7 +2017,7 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
|
#endif |
|
|
|
|
|
|
|
// 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 (DEBUGGING(LEVELING)) { |
|
|
@ -2184,7 +2192,8 @@ static void clean_up_after_endstop_or_probe_move() { |
|
|
|
// - Raise to the BETWEEN height
|
|
|
|
// - 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 (DEBUGGING(LEVELING)) { |
|
|
|
SERIAL_ECHOPAIR(">>> probe_pt(", x); |
|
|
@ -3279,10 +3288,12 @@ inline void gcode_G4() { |
|
|
|
SERIAL_ECHOPGM("BILINEAR"); |
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_3POINT) |
|
|
|
SERIAL_ECHOPGM("3POINT"); |
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
SERIAL_ECHOPGM("UBL"); |
|
|
|
#endif |
|
|
|
if (planner.abl_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] = { |
|
|
|
stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS], |
|
|
|
stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS], |
|
|
@ -3830,7 +3841,7 @@ inline void gcode_G28() { |
|
|
|
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. |
|
|
@ -4383,7 +4394,7 @@ inline void gcode_G28() { |
|
|
|
SYNC_PLAN_POSITION_KINEMATIC(); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // HAS_ABL
|
|
|
|
#endif // HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
|
|
|
|
|
|
|
|
#if HAS_BED_PROBE |
|
|
|
|
|
|
@ -6993,6 +7004,8 @@ void quickstop_stepper() { |
|
|
|
bed_level_virt_print(); |
|
|
|
#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) |
|
|
|
if (mbl.has_mesh()) { |
|
|
|
SERIAL_ECHOLNPGM("Mesh Bed Level data:"); |
|
|
@ -8303,6 +8316,12 @@ void process_next_command() { |
|
|
|
break; |
|
|
|
#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) |
|
|
|
case 27: // G27: Nozzle Park
|
|
|
|
gcode_G27(); |
|
|
@ -8314,7 +8333,8 @@ void process_next_command() { |
|
|
|
break; |
|
|
|
|
|
|
|
#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(); |
|
|
|
break; |
|
|
|
#endif // PLANNER_LEVELING
|
|
|
@ -8421,12 +8441,24 @@ void process_next_command() { |
|
|
|
gcode_M43(); break; |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) |
|
|
|
case 48: // M48: Z probe repeatability test
|
|
|
|
gcode_M48(); |
|
|
|
break; |
|
|
|
#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
|
|
|
|
gcode_M75(); break; |
|
|
|
case 76: // M76: Pause print timer
|
|
|
@ -9066,7 +9098,7 @@ void ok_to_send() { |
|
|
|
SERIAL_ECHOLNPAIR(" offset=", offset); |
|
|
|
} |
|
|
|
last_offset = offset; |
|
|
|
//*/
|
|
|
|
*/ |
|
|
|
|
|
|
|
return offset; |
|
|
|
} |
|
|
@ -9552,6 +9584,18 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
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) |
|
|
|
if (planner.abl_enabled) { |
|
|
|
bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s)); |
|
|
|