Merge pull request #6537 from thinkyhead/rc_cleanup_sunday
Various leveling-related patches
This commit is contained in:
commit
99b11db1a1
@ -718,15 +718,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ABL options based on the specific type of leveling
|
* Set granular options based on the specific type of leveling
|
||||||
*/
|
*/
|
||||||
#define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
|
#define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
|
||||||
#define ABL_GRID (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
|
#define ABL_GRID (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
|
||||||
#define HAS_ABL (ABL_PLANAR || ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL))
|
#define HAS_ABL (ABL_PLANAR || ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL))
|
||||||
|
#define HAS_LEVELING (HAS_ABL || ENABLED(MESH_BED_LEVELING))
|
||||||
#define PLANNER_LEVELING (HAS_ABL || ENABLED(MESH_BED_LEVELING))
|
#define PLANNER_LEVELING (ABL_PLANAR || ABL_GRID || ENABLED(MESH_BED_LEVELING))
|
||||||
#define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
|
#define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
|
||||||
|
|
||||||
#if HAS_PROBING_PROCEDURE
|
#if HAS_PROBING_PROCEDURE
|
||||||
#define PROBE_BED_WIDTH abs(RIGHT_PROBE_BED_POSITION - (LEFT_PROBE_BED_POSITION))
|
#define PROBE_BED_WIDTH abs(RIGHT_PROBE_BED_POSITION - (LEFT_PROBE_BED_POSITION))
|
||||||
#define PROBE_BED_HEIGHT abs(BACK_PROBE_BED_POSITION - (FRONT_PROBE_BED_POSITION))
|
#define PROBE_BED_HEIGHT abs(BACK_PROBE_BED_POSITION - (FRONT_PROBE_BED_POSITION))
|
||||||
|
@ -115,25 +115,29 @@
|
|||||||
* Y # Y coordinate Specify the starting location of the drawing activity.
|
* Y # Y coordinate Specify the starting location of the drawing activity.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// External references
|
||||||
|
|
||||||
extern float feedrate;
|
extern float feedrate;
|
||||||
extern Planner planner;
|
extern Planner planner;
|
||||||
//#if ENABLED(ULTRA_LCD)
|
#if ENABLED(ULTRA_LCD)
|
||||||
extern char lcd_status_message[];
|
extern char lcd_status_message[];
|
||||||
//#endif
|
#endif
|
||||||
extern float destination[XYZE];
|
extern float destination[XYZE];
|
||||||
extern void set_destination_to_current();
|
void set_destination_to_current();
|
||||||
extern void set_current_to_destination();
|
void set_current_to_destination();
|
||||||
extern float code_value_float();
|
float code_value_float();
|
||||||
extern bool code_value_bool();
|
bool code_value_bool();
|
||||||
extern bool code_has_value();
|
bool code_has_value();
|
||||||
extern void lcd_init();
|
void lcd_init();
|
||||||
extern void lcd_setstatuspgm(const char* const message, const uint8_t level);
|
void lcd_setstatuspgm(const char* const message, const uint8_t level);
|
||||||
#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS])) //bob
|
|
||||||
bool prepare_move_to_destination_cartesian();
|
bool prepare_move_to_destination_cartesian();
|
||||||
void line_to_destination();
|
void line_to_destination();
|
||||||
void line_to_destination(float );
|
void line_to_destination(float);
|
||||||
void gcode_G28();
|
|
||||||
void sync_plan_position_e();
|
void sync_plan_position_e();
|
||||||
|
void chirp_at_user();
|
||||||
|
|
||||||
|
// Private functions
|
||||||
|
|
||||||
void un_retract_filament(float where[XYZE]);
|
void un_retract_filament(float where[XYZE]);
|
||||||
void retract_filament(float where[XYZE]);
|
void retract_filament(float where[XYZE]);
|
||||||
void look_for_lines_to_connect();
|
void look_for_lines_to_connect();
|
||||||
@ -142,17 +146,14 @@
|
|||||||
void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&);
|
void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&);
|
||||||
bool turn_on_heaters();
|
bool turn_on_heaters();
|
||||||
bool prime_nozzle();
|
bool prime_nozzle();
|
||||||
void chirp_at_user();
|
|
||||||
|
|
||||||
static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], continue_with_closest = 0;
|
static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], continue_with_closest = 0;
|
||||||
float g26_e_axis_feedrate = 0.020,
|
float g26_e_axis_feedrate = 0.020,
|
||||||
random_deviation = 0.0,
|
random_deviation = 0.0,
|
||||||
layer_height = LAYER_HEIGHT;
|
layer_height = LAYER_HEIGHT;
|
||||||
|
|
||||||
bool g26_retracted = false; // We keep track of the state of the nozzle to know if it
|
static bool g26_retracted = false; // Track the retracted state of the nozzle so mismatched
|
||||||
// is currently retracted or not. This allows us to be
|
// retracts/recovers won't result in a bad state.
|
||||||
// less careful because mis-matched retractions and un-retractions
|
|
||||||
// won't leave us in a bad state.
|
|
||||||
|
|
||||||
float valid_trig_angle(float);
|
float valid_trig_angle(float);
|
||||||
mesh_index_pair find_closest_circle_to_print(const float&, const float&);
|
mesh_index_pair find_closest_circle_to_print(const float&, const float&);
|
||||||
@ -167,9 +168,9 @@
|
|||||||
hotend_temp = HOTEND_TEMP,
|
hotend_temp = HOTEND_TEMP,
|
||||||
ooze_amount = OOZE_AMOUNT;
|
ooze_amount = OOZE_AMOUNT;
|
||||||
|
|
||||||
int8_t prime_flag = 0;
|
static int8_t prime_flag = 0;
|
||||||
|
|
||||||
bool keep_heaters_on = false;
|
static bool keep_heaters_on = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G26: Mesh Validation Pattern generation.
|
* G26: Mesh Validation Pattern generation.
|
||||||
|
@ -324,7 +324,7 @@ float code_value_temp_diff();
|
|||||||
linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
|
linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
void reset_bed_level();
|
void reset_bed_level();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -490,8 +490,6 @@ static uint8_t target_extruder;
|
|||||||
float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]))
|
|
||||||
|
|
||||||
#if HAS_ABL
|
#if HAS_ABL
|
||||||
float xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
|
float xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
|
||||||
#define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s
|
#define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s
|
||||||
@ -2405,7 +2403,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
|
|
||||||
#endif // HAS_BED_PROBE
|
#endif // HAS_BED_PROBE
|
||||||
|
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
/**
|
/**
|
||||||
* Turn bed leveling on or off, fixing the current
|
* Turn bed leveling on or off, fixing the current
|
||||||
* position as-needed.
|
* position as-needed.
|
||||||
@ -2426,7 +2424,12 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
if (enable && mbl.has_mesh()) planner.unapply_leveling(current_position);
|
if (enable && mbl.has_mesh()) planner.unapply_leveling(current_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL)
|
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
|
ubl.state.active = enable;
|
||||||
|
//set_current_from_steppers_for_axis(Z_AXIS);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||||
const bool can_change = (!enable || (bilinear_grid_spacing[0] && bilinear_grid_spacing[1]));
|
const bool can_change = (!enable || (bilinear_grid_spacing[0] && bilinear_grid_spacing[1]));
|
||||||
@ -2454,9 +2457,6 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
else
|
else
|
||||||
planner.unapply_leveling(current_position);
|
planner.unapply_leveling(current_position);
|
||||||
}
|
}
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
ubl.state.active = enable;
|
|
||||||
//set_current_from_steppers_for_axis(Z_AXIS);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2513,7 +2513,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PLANNER_LEVELING
|
#endif // HAS_LEVELING
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
|
||||||
|
|
||||||
@ -3749,10 +3749,7 @@ inline void gcode_G28() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable the leveling matrix before homing
|
// Disable the leveling matrix before homing
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
const bool bed_leveling_state_at_entry = ubl.state.active;
|
|
||||||
#endif
|
|
||||||
set_bed_leveling_enabled(false);
|
set_bed_leveling_enabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3895,25 +3892,6 @@ inline void gcode_G28() {
|
|||||||
do_blocking_move_to_z(delta_clip_start_height);
|
do_blocking_move_to_z(delta_clip_start_height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
set_bed_leveling_enabled(bed_leveling_state_at_entry);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Enable mesh leveling again
|
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
|
||||||
if (mbl.reactivate()) {
|
|
||||||
set_bed_leveling_enabled(true);
|
|
||||||
if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
|
|
||||||
#if ENABLED(MESH_G28_REST_ORIGIN)
|
|
||||||
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
|
|
||||||
set_destination_to_current();
|
|
||||||
line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
|
|
||||||
stepper.synchronize();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
clean_up_after_endstop_or_probe_move();
|
clean_up_after_endstop_or_probe_move();
|
||||||
|
|
||||||
// Restore the active tool after homing
|
// Restore the active tool after homing
|
||||||
@ -3928,6 +3906,8 @@ inline void gcode_G28() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void home_all_axes() { gcode_G28(); }
|
||||||
|
|
||||||
#if HAS_PROBING_PROCEDURE
|
#if HAS_PROBING_PROCEDURE
|
||||||
|
|
||||||
void out_of_range_error(const char* p_edge) {
|
void out_of_range_error(const char* p_edge) {
|
||||||
@ -3980,6 +3960,18 @@ inline void gcode_G28() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mesh_probing_done() {
|
||||||
|
mbl.set_has_mesh(true);
|
||||||
|
home_all_axes();
|
||||||
|
set_bed_leveling_enabled(true);
|
||||||
|
#if ENABLED(MESH_G28_REST_ORIGIN)
|
||||||
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
|
||||||
|
set_destination_to_current();
|
||||||
|
line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
|
||||||
|
stepper.synchronize();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G29: Mesh-based Z probe, probes a grid and produces a
|
* G29: Mesh-based Z probe, probes a grid and produces a
|
||||||
* mesh to compensate for variable bed height
|
* mesh to compensate for variable bed height
|
||||||
@ -4070,14 +4062,12 @@ inline void gcode_G28() {
|
|||||||
line_to_current_position();
|
line_to_current_position();
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
|
|
||||||
// After recording the last point, activate the mbl and home
|
// After recording the last point, activate home and activate
|
||||||
SERIAL_PROTOCOLLNPGM("Mesh probing done.");
|
|
||||||
mbl_probe_index = -1;
|
mbl_probe_index = -1;
|
||||||
mbl.set_has_mesh(true);
|
SERIAL_PROTOCOLLNPGM("Mesh probing done.");
|
||||||
mbl.set_reactivate(true);
|
|
||||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
||||||
BUZZ(100, 659);
|
BUZZ(100, 659);
|
||||||
BUZZ(100, 698);
|
BUZZ(100, 698);
|
||||||
|
mesh_probing_done();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4368,7 +4358,7 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
|
|
||||||
// Jettison bed leveling data
|
// Jettison bed leveling data
|
||||||
if (code_seen('J')) {
|
if (code_seen('J')) {
|
||||||
@ -5013,7 +5003,7 @@ inline void gcode_G28() {
|
|||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
|
#endif // HAS_ABL && !AUTO_BED_LEVELING_UBL
|
||||||
|
|
||||||
#if HAS_BED_PROBE
|
#if HAS_BED_PROBE
|
||||||
|
|
||||||
@ -5034,7 +5024,7 @@ inline void gcode_G28() {
|
|||||||
if (!position_is_reachable(pos, true)) return;
|
if (!position_is_reachable(pos, true)) return;
|
||||||
|
|
||||||
// Disable leveling so the planner won't mess with us
|
// Disable leveling so the planner won't mess with us
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
set_bed_leveling_enabled(false);
|
set_bed_leveling_enabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -5091,7 +5081,7 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
|
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
set_bed_leveling_enabled(false);
|
set_bed_leveling_enabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -6198,10 +6188,6 @@ inline void gcode_M42() {
|
|||||||
* regenerated.
|
* regenerated.
|
||||||
*/
|
*/
|
||||||
inline void gcode_M48() {
|
inline void gcode_M48() {
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
bool bed_leveling_state_at_entry=0;
|
|
||||||
bed_leveling_state_at_entry = ubl.state.active;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (axis_unhomed_error(true, true, true)) return;
|
if (axis_unhomed_error(true, true, true)) return;
|
||||||
|
|
||||||
@ -6220,8 +6206,8 @@ inline void gcode_M42() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float X_current = current_position[X_AXIS],
|
float X_current = current_position[X_AXIS],
|
||||||
Y_current = current_position[Y_AXIS];
|
Y_current = current_position[Y_AXIS];
|
||||||
|
|
||||||
bool stow_probe_after_each = code_seen('E');
|
bool stow_probe_after_each = code_seen('E');
|
||||||
|
|
||||||
@ -6267,8 +6253,17 @@ inline void gcode_M42() {
|
|||||||
SERIAL_PROTOCOLLNPGM("Positioning the probe...");
|
SERIAL_PROTOCOLLNPGM("Positioning the probe...");
|
||||||
|
|
||||||
// Disable bed level correction in M48 because we want the raw data when we probe
|
// Disable bed level correction in M48 because we want the raw data when we probe
|
||||||
#if HAS_ABL
|
|
||||||
const bool abl_was_enabled = planner.abl_enabled;
|
#if HAS_LEVELING
|
||||||
|
const bool was_enabled =
|
||||||
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
ubl.state.active
|
||||||
|
#elif ENABLED(MESH_BED_LEVELING)
|
||||||
|
mbl.active()
|
||||||
|
#else
|
||||||
|
planner.abl_enabled
|
||||||
|
#endif
|
||||||
|
;
|
||||||
set_bed_leveling_enabled(false);
|
set_bed_leveling_enabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -6420,14 +6415,9 @@ inline void gcode_M42() {
|
|||||||
|
|
||||||
clean_up_after_endstop_or_probe_move();
|
clean_up_after_endstop_or_probe_move();
|
||||||
|
|
||||||
// Re-enable bed level correction if it has been on
|
// Re-enable bed level correction if it had been on
|
||||||
#if HAS_ABL
|
#if HAS_ABL
|
||||||
set_bed_leveling_enabled(abl_was_enabled);
|
set_bed_leveling_enabled(was_enabled);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
set_bed_leveling_enabled(bed_leveling_state_at_entry);
|
|
||||||
ubl.state.active = bed_leveling_state_at_entry;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
report_current_position();
|
report_current_position();
|
||||||
@ -7294,7 +7284,7 @@ inline void gcode_M115() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MESH_REPORT (M420 V)
|
// MESH_REPORT (M420 V)
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
|
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
|
||||||
#else
|
#else
|
||||||
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
|
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
|
||||||
@ -8336,7 +8326,7 @@ void quickstop_stepper() {
|
|||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
/**
|
/**
|
||||||
* M420: Enable/Disable Bed Leveling and/or set the Z fade height.
|
* M420: Enable/Disable Bed Leveling and/or set the Z fade height.
|
||||||
*
|
*
|
||||||
@ -9857,12 +9847,12 @@ void process_next_command() {
|
|||||||
gcode_G28();
|
gcode_G28();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if PLANNER_LEVELING || ENABLED(AUTO_BED_LEVELING_UBL)
|
#if HAS_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.
|
// or provides access to the UBL System if enabled.
|
||||||
gcode_G29();
|
gcode_G29();
|
||||||
break;
|
break;
|
||||||
#endif // PLANNER_LEVELING
|
#endif // HAS_LEVELING
|
||||||
|
|
||||||
#if HAS_BED_PROBE
|
#if HAS_BED_PROBE
|
||||||
|
|
||||||
@ -10363,7 +10353,7 @@ void process_next_command() {
|
|||||||
break;
|
break;
|
||||||
#endif // FILAMENT_WIDTH_SENSOR
|
#endif // FILAMENT_WIDTH_SENSOR
|
||||||
|
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
case 420: // M420: Enable/Disable Bed Leveling
|
case 420: // M420: Enable/Disable Bed Leveling
|
||||||
gcode_M420();
|
gcode_M420();
|
||||||
break;
|
break;
|
||||||
@ -10917,7 +10907,7 @@ void get_cartesian_from_steppers() {
|
|||||||
*/
|
*/
|
||||||
void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
||||||
get_cartesian_from_steppers();
|
get_cartesian_from_steppers();
|
||||||
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
|
#if PLANNER_LEVELING
|
||||||
planner.unapply_leveling(cartes);
|
planner.unapply_leveling(cartes);
|
||||||
#endif
|
#endif
|
||||||
if (axis == ALL_AXES)
|
if (axis == ALL_AXES)
|
||||||
|
@ -1071,7 +1071,7 @@ void MarlinSettings::reset() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Applies to all MBL and ABL
|
// Applies to all MBL and ABL
|
||||||
#if PLANNER_LEVELING
|
#if HAS_LEVELING
|
||||||
reset_bed_level();
|
reset_bed_level();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -36,8 +36,7 @@
|
|||||||
enum MBLStatus {
|
enum MBLStatus {
|
||||||
MBL_STATUS_NONE = 0,
|
MBL_STATUS_NONE = 0,
|
||||||
MBL_STATUS_HAS_MESH_BIT = 0,
|
MBL_STATUS_HAS_MESH_BIT = 0,
|
||||||
MBL_STATUS_ACTIVE_BIT = 1,
|
MBL_STATUS_ACTIVE_BIT = 1
|
||||||
MBL_STATUS_REACTIVATE_BIT = 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
|
#define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
|
||||||
@ -61,8 +60,6 @@
|
|||||||
static void set_active(const bool onOff) { onOff ? SBI(status, MBL_STATUS_ACTIVE_BIT) : CBI(status, MBL_STATUS_ACTIVE_BIT); }
|
static void set_active(const bool onOff) { onOff ? SBI(status, MBL_STATUS_ACTIVE_BIT) : CBI(status, MBL_STATUS_ACTIVE_BIT); }
|
||||||
static bool has_mesh() { return TEST(status, MBL_STATUS_HAS_MESH_BIT); }
|
static bool has_mesh() { return TEST(status, MBL_STATUS_HAS_MESH_BIT); }
|
||||||
static void set_has_mesh(const bool onOff) { onOff ? SBI(status, MBL_STATUS_HAS_MESH_BIT) : CBI(status, MBL_STATUS_HAS_MESH_BIT); }
|
static void set_has_mesh(const bool onOff) { onOff ? SBI(status, MBL_STATUS_HAS_MESH_BIT) : CBI(status, MBL_STATUS_HAS_MESH_BIT); }
|
||||||
static bool reactivate() { bool b = TEST(status, MBL_STATUS_REACTIVATE_BIT); CBI(status, MBL_STATUS_REACTIVATE_BIT); return b; }
|
|
||||||
static void set_reactivate(const bool onOff) { onOff ? SBI(status, MBL_STATUS_REACTIVATE_BIT) : CBI(status, MBL_STATUS_REACTIVATE_BIT); }
|
|
||||||
|
|
||||||
static inline void zigzag(const int8_t index, int8_t &px, int8_t &py) {
|
static inline void zigzag(const int8_t index, int8_t &px, int8_t &py) {
|
||||||
px = index % (GRID_MAX_POINTS_X);
|
px = index % (GRID_MAX_POINTS_X);
|
||||||
|
@ -530,7 +530,7 @@ void Planner::check_axes_activity() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
|
#if PLANNER_LEVELING
|
||||||
/**
|
/**
|
||||||
* lx, ly, lz - logical (cartesian, not delta) positions in mm
|
* lx, ly, lz - logical (cartesian, not delta) positions in mm
|
||||||
*/
|
*/
|
||||||
@ -634,7 +634,7 @@ void Planner::check_axes_activity() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PLANNER_LEVELING && !AUTO_BED_LEVELING_UBL
|
#endif // PLANNER_LEVELING
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Planner::_buffer_line
|
* Planner::_buffer_line
|
||||||
@ -1434,7 +1434,7 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Planner::set_position_mm_kinematic(const float position[NUM_AXIS]) {
|
void Planner::set_position_mm_kinematic(const float position[NUM_AXIS]) {
|
||||||
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
|
#if PLANNER_LEVELING
|
||||||
float lpos[XYZ] = { position[X_AXIS], position[Y_AXIS], position[Z_AXIS] };
|
float lpos[XYZ] = { position[X_AXIS], position[Y_AXIS], position[Z_AXIS] };
|
||||||
apply_leveling(lpos);
|
apply_leveling(lpos);
|
||||||
#else
|
#else
|
||||||
|
@ -246,7 +246,7 @@ class Planner {
|
|||||||
|
|
||||||
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
|
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
|
||||||
|
|
||||||
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
|
#if PLANNER_LEVELING
|
||||||
|
|
||||||
#define ARG_X float lx
|
#define ARG_X float lx
|
||||||
#define ARG_Y float ly
|
#define ARG_Y float ly
|
||||||
@ -296,7 +296,7 @@ class Planner {
|
|||||||
* extruder - target extruder
|
* extruder - target extruder
|
||||||
*/
|
*/
|
||||||
static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
|
static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
|
||||||
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL) && IS_CARTESIAN
|
#if PLANNER_LEVELING && IS_CARTESIAN
|
||||||
apply_leveling(lx, ly, lz);
|
apply_leveling(lx, ly, lz);
|
||||||
#endif
|
#endif
|
||||||
_buffer_line(lx, ly, lz, e, fr_mm_s, extruder);
|
_buffer_line(lx, ly, lz, e, fr_mm_s, extruder);
|
||||||
@ -312,7 +312,7 @@ class Planner {
|
|||||||
* extruder - target extruder
|
* extruder - target extruder
|
||||||
*/
|
*/
|
||||||
static FORCE_INLINE void buffer_line_kinematic(const float ltarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
|
static FORCE_INLINE void buffer_line_kinematic(const float ltarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
|
||||||
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
|
#if PLANNER_LEVELING
|
||||||
float lpos[XYZ] = { ltarget[X_AXIS], ltarget[Y_AXIS], ltarget[Z_AXIS] };
|
float lpos[XYZ] = { ltarget[X_AXIS], ltarget[Y_AXIS], ltarget[Z_AXIS] };
|
||||||
apply_leveling(lpos);
|
apply_leveling(lpos);
|
||||||
#else
|
#else
|
||||||
@ -336,7 +336,7 @@ class Planner {
|
|||||||
* Clears previous speed values.
|
* Clears previous speed values.
|
||||||
*/
|
*/
|
||||||
static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
|
static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
|
||||||
#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL) && IS_CARTESIAN
|
#if PLANNER_LEVELING && IS_CARTESIAN
|
||||||
apply_leveling(lx, ly, lz);
|
apply_leveling(lx, ly, lz);
|
||||||
#endif
|
#endif
|
||||||
_set_position_mm(lx, ly, lz, e);
|
_set_position_mm(lx, ly, lz, e);
|
||||||
@ -469,6 +469,8 @@ class Planner {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]))
|
||||||
|
|
||||||
extern Planner planner;
|
extern Planner planner;
|
||||||
|
|
||||||
#endif // PLANNER_H
|
#endif // PLANNER_H
|
||||||
|
@ -61,8 +61,9 @@
|
|||||||
bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
|
bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
|
||||||
char *ftostr43sign(const float&, char);
|
char *ftostr43sign(const float&, char);
|
||||||
|
|
||||||
|
void home_all_axes();
|
||||||
|
|
||||||
void gcode_G26();
|
void gcode_G26();
|
||||||
void gcode_G28();
|
|
||||||
void gcode_G29();
|
void gcode_G29();
|
||||||
|
|
||||||
extern int ubl_cnt;
|
extern int ubl_cnt;
|
||||||
|
@ -324,7 +324,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!code_seen('N') && axis_unhomed_error(true, true, true)) // Don't allow auto-leveling without homing first
|
if (!code_seen('N') && axis_unhomed_error(true, true, true)) // Don't allow auto-leveling without homing first
|
||||||
gcode_G28();
|
home_all_axes();
|
||||||
|
|
||||||
if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
|
if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
|
||||||
|
|
||||||
|
@ -162,6 +162,7 @@ uint16_t max_display_update_time = 0;
|
|||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
|
#if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
|
||||||
#include "mesh_bed_leveling.h"
|
#include "mesh_bed_leveling.h"
|
||||||
|
extern void mesh_probing_done();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
@ -1539,9 +1540,9 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
// Enable leveling, if needed
|
// Enable leveling, if needed
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
|
|
||||||
|
lcd_synchronize();
|
||||||
mbl.set_has_mesh(true);
|
mbl.set_has_mesh(true);
|
||||||
mbl.set_reactivate(true);
|
mesh_probing_done();
|
||||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
||||||
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user