Merge pull request #6858 from thinkyhead/bf_leveling_patch
Fixes for PROBE_MANUALLY and LCD_BED_LEVELING
This commit is contained in:
commit
73ed0c63b4
1
.gitignore
vendored
1
.gitignore
vendored
@ -52,6 +52,7 @@ tags
|
|||||||
*.lo
|
*.lo
|
||||||
*.o
|
*.o
|
||||||
*.obj
|
*.obj
|
||||||
|
*.ino.cpp
|
||||||
|
|
||||||
# Precompiled Headers
|
# Precompiled Headers
|
||||||
*.gch
|
*.gch
|
||||||
|
@ -3800,6 +3800,10 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
|
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
|
||||||
|
|
||||||
|
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
|
||||||
|
extern bool lcd_wait_for_move;
|
||||||
|
#endif
|
||||||
|
|
||||||
inline void _manual_goto_xy(const float &x, const float &y) {
|
inline void _manual_goto_xy(const float &x, const float &y) {
|
||||||
const float old_feedrate_mm_s = feedrate_mm_s;
|
const float old_feedrate_mm_s = feedrate_mm_s;
|
||||||
|
|
||||||
@ -3822,6 +3826,10 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
|
|
||||||
feedrate_mm_s = old_feedrate_mm_s;
|
feedrate_mm_s = old_feedrate_mm_s;
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
|
|
||||||
|
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
|
||||||
|
lcd_wait_for_move = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -4190,7 +4198,7 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
if (!g29_in_progress) {
|
if (!g29_in_progress) {
|
||||||
|
|
||||||
#if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
|
#if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||||
abl_probe_index = 0;
|
abl_probe_index = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
abl_should_enable = planner.abl_enabled;
|
abl_should_enable = planner.abl_enabled;
|
||||||
@ -4397,30 +4405,40 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
|
|
||||||
#if ENABLED(PROBE_MANUALLY)
|
#if ENABLED(PROBE_MANUALLY)
|
||||||
|
|
||||||
|
const bool seenA = parser.seen('A'), seenQ = parser.seen('Q');
|
||||||
|
|
||||||
|
// For manual probing, get the next index to probe now.
|
||||||
|
// On the first probe this will be incremented to 0.
|
||||||
|
if (!seenA && !seenQ) {
|
||||||
|
++abl_probe_index;
|
||||||
|
g29_in_progress = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Abort current G29 procedure, go back to ABLStart
|
// Abort current G29 procedure, go back to ABLStart
|
||||||
if (parser.seen('A') && g29_in_progress) {
|
if (seenA && g29_in_progress) {
|
||||||
SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
|
SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
|
||||||
#if HAS_SOFTWARE_ENDSTOPS
|
#if HAS_SOFTWARE_ENDSTOPS
|
||||||
soft_endstops_enabled = enable_soft_endstops;
|
soft_endstops_enabled = enable_soft_endstops;
|
||||||
#endif
|
#endif
|
||||||
planner.abl_enabled = abl_should_enable;
|
planner.abl_enabled = abl_should_enable;
|
||||||
g29_in_progress = false;
|
g29_in_progress = false;
|
||||||
|
#if ENABLED(LCD_BED_LEVELING)
|
||||||
|
lcd_wait_for_move = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query G29 status
|
// Query G29 status
|
||||||
if (parser.seen('Q')) {
|
if (verbose_level || seenQ) {
|
||||||
if (!g29_in_progress)
|
SERIAL_PROTOCOLPGM("Manual G29 ");
|
||||||
SERIAL_PROTOCOLLNPGM("Manual G29 idle");
|
if (g29_in_progress) {
|
||||||
else {
|
SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1);
|
||||||
SERIAL_PROTOCOLPAIR("Manual G29 point ", abl_probe_index + 1);
|
|
||||||
SERIAL_PROTOCOLLNPAIR(" of ", abl2);
|
SERIAL_PROTOCOLLNPAIR(" of ", abl2);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
SERIAL_PROTOCOLLNPGM("idle");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.seen('A') || parser.seen('Q')) return;
|
if (seenA || seenQ) return;
|
||||||
|
|
||||||
// Fall through to probe the first point
|
|
||||||
g29_in_progress = true;
|
|
||||||
|
|
||||||
if (abl_probe_index == 0) {
|
if (abl_probe_index == 0) {
|
||||||
// For the initial G29 save software endstop state
|
// For the initial G29 save software endstop state
|
||||||
@ -4458,20 +4476,20 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
|
|
||||||
#if ABL_GRID
|
#if ABL_GRID
|
||||||
|
|
||||||
// Find a next point to probe
|
// Skip any unreachable points
|
||||||
// On the first G29 this will be the first probe point
|
|
||||||
while (abl_probe_index < abl2) {
|
while (abl_probe_index < abl2) {
|
||||||
|
|
||||||
// Set xCount, yCount based on abl_probe_index, with zig-zag
|
// Set xCount, yCount based on abl_probe_index, with zig-zag
|
||||||
PR_OUTER_VAR = abl_probe_index / PR_INNER_END;
|
PR_OUTER_VAR = abl_probe_index / PR_INNER_END;
|
||||||
PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END);
|
PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END);
|
||||||
|
|
||||||
bool zig = (PR_OUTER_VAR & 1) != ((PR_OUTER_END) & 1);
|
// Probe in reverse order for every other row/column
|
||||||
|
bool zig = (PR_OUTER_VAR & 1); // != ((PR_OUTER_END) & 1);
|
||||||
|
|
||||||
if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR;
|
if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR;
|
||||||
|
|
||||||
const float xBase = left_probe_bed_position + xGridSpacing * xCount,
|
const float xBase = xCount * xGridSpacing + left_probe_bed_position,
|
||||||
yBase = front_probe_bed_position + yGridSpacing * yCount;
|
yBase = yCount * yGridSpacing + front_probe_bed_position;
|
||||||
|
|
||||||
xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5));
|
xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5));
|
||||||
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
|
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
|
||||||
@ -4488,7 +4506,6 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
// Is there a next point to move to?
|
// Is there a next point to move to?
|
||||||
if (abl_probe_index < abl2) {
|
if (abl_probe_index < abl2) {
|
||||||
_manual_goto_xy(xProbe, yProbe); // Can be used here too!
|
_manual_goto_xy(xProbe, yProbe); // Can be used here too!
|
||||||
++abl_probe_index;
|
|
||||||
#if HAS_SOFTWARE_ENDSTOPS
|
#if HAS_SOFTWARE_ENDSTOPS
|
||||||
// Disable software endstops to allow manual adjustment
|
// Disable software endstops to allow manual adjustment
|
||||||
// If G29 is not completed, they will not be re-enabled
|
// If G29 is not completed, they will not be re-enabled
|
||||||
@ -4497,10 +4514,9 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Then leveling is done!
|
|
||||||
// G29 finishing code goes here
|
|
||||||
|
|
||||||
// After recording the last point, activate abl
|
// Leveling done! Fall through to G29 finishing code below
|
||||||
|
|
||||||
SERIAL_PROTOCOLLNPGM("Grid probing done.");
|
SERIAL_PROTOCOLLNPGM("Grid probing done.");
|
||||||
g29_in_progress = false;
|
g29_in_progress = false;
|
||||||
|
|
||||||
@ -4514,9 +4530,8 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
|
|
||||||
// Probe at 3 arbitrary points
|
// Probe at 3 arbitrary points
|
||||||
if (abl_probe_index < 3) {
|
if (abl_probe_index < 3) {
|
||||||
xProbe = LOGICAL_X_POSITION(points[i].x);
|
xProbe = LOGICAL_X_POSITION(points[abl_probe_index].x);
|
||||||
yProbe = LOGICAL_Y_POSITION(points[i].y);
|
yProbe = LOGICAL_Y_POSITION(points[abl_probe_index].y);
|
||||||
++abl_probe_index;
|
|
||||||
#if HAS_SOFTWARE_ENDSTOPS
|
#if HAS_SOFTWARE_ENDSTOPS
|
||||||
// Disable software endstops to allow manual adjustment
|
// Disable software endstops to allow manual adjustment
|
||||||
// If G29 is not completed, they will not be re-enabled
|
// If G29 is not completed, they will not be re-enabled
|
||||||
@ -4587,7 +4602,7 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
|
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||||
indexIntoAB[xCount][yCount] = ++abl_probe_index;
|
indexIntoAB[xCount][yCount] = ++abl_probe_index; // 0...
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IS_KINEMATIC
|
#if IS_KINEMATIC
|
||||||
@ -4665,7 +4680,10 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
// G29 Finishing Code
|
// G29 Finishing Code
|
||||||
//
|
//
|
||||||
// Unless this is a dry run, auto bed leveling will
|
// Unless this is a dry run, auto bed leveling will
|
||||||
// definitely be enabled after this point
|
// definitely be enabled after this point.
|
||||||
|
//
|
||||||
|
// If code above wants to continue leveling, it should
|
||||||
|
// return or loop before this point.
|
||||||
//
|
//
|
||||||
|
|
||||||
// Restore state after probing
|
// Restore state after probing
|
||||||
@ -4675,6 +4693,10 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
|
||||||
|
lcd_wait_for_move = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Calculate leveling, print reports, correct the position
|
// Calculate leveling, print reports, correct the position
|
||||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||||
|
|
||||||
|
@ -1344,9 +1344,8 @@ void MarlinSettings::reset() {
|
|||||||
#else
|
#else
|
||||||
#define LINEAR_UNIT(N) N
|
#define LINEAR_UNIT(N) N
|
||||||
#define VOLUMETRIC_UNIT(N) N
|
#define VOLUMETRIC_UNIT(N) N
|
||||||
SERIAL_ECHOLNPGM(" G21 ; Units in mm\n");
|
SERIAL_ECHOLNPGM(" G21 ; Units in mm");
|
||||||
#endif
|
#endif
|
||||||
SERIAL_EOL;
|
|
||||||
|
|
||||||
#if ENABLED(ULTIPANEL)
|
#if ENABLED(ULTIPANEL)
|
||||||
|
|
||||||
@ -1361,12 +1360,13 @@ void MarlinSettings::reset() {
|
|||||||
serialprintPGM(parser.temp_units_name());
|
serialprintPGM(parser.temp_units_name());
|
||||||
#else
|
#else
|
||||||
#define TEMP_UNIT(N) N
|
#define TEMP_UNIT(N) N
|
||||||
SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius\n");
|
SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius");
|
||||||
#endif
|
#endif
|
||||||
SERIAL_EOL;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SERIAL_EOL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Volumetric extrusion M200
|
* Volumetric extrusion M200
|
||||||
*/
|
*/
|
||||||
|
179
Marlin/ultralcd.cpp
Normal file → Executable file
179
Marlin/ultralcd.cpp
Normal file → Executable file
@ -78,9 +78,6 @@ uint16_t max_display_update_time = 0;
|
|||||||
|
|
||||||
#if ENABLED(DOGLCD)
|
#if ENABLED(DOGLCD)
|
||||||
bool drawing_screen = false;
|
bool drawing_screen = false;
|
||||||
#define LCDVIEW_KEEP_REDRAWING LCDVIEW_CALL_REDRAW_NEXT
|
|
||||||
#else
|
|
||||||
#define LCDVIEW_KEEP_REDRAWING LCDVIEW_REDRAW_NOW
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||||
@ -479,22 +476,18 @@ uint16_t max_display_update_time = 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronize safely while holding the current screen
|
* Show "Moving..." till moves are done, then revert to previous display.
|
||||||
* This blocks all further screen or stripe updates once called
|
|
||||||
*/
|
*/
|
||||||
extern uint8_t commands_in_queue;
|
|
||||||
|
|
||||||
inline void lcd_synchronize() {
|
inline void lcd_synchronize() {
|
||||||
static bool no_reentry = false;
|
static bool no_reentry = false;
|
||||||
lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_MOVING));
|
lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_MOVING));
|
||||||
if (no_reentry) return;
|
if (no_reentry) return;
|
||||||
|
|
||||||
|
// Make this the current handler till all moves are done
|
||||||
no_reentry = true;
|
no_reentry = true;
|
||||||
screenFunc_t old_screen = currentScreen;
|
screenFunc_t old_screen = currentScreen;
|
||||||
lcd_goto_screen(lcd_synchronize);
|
lcd_goto_screen(lcd_synchronize);
|
||||||
while (commands_in_queue) {
|
|
||||||
idle();
|
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
}
|
|
||||||
no_reentry = false;
|
no_reentry = false;
|
||||||
lcd_goto_screen(old_screen);
|
lcd_goto_screen(old_screen);
|
||||||
}
|
}
|
||||||
@ -879,7 +872,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
if (encoderPosition) {
|
if (encoderPosition) {
|
||||||
const int babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
const int babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
thermalManager.babystep_axis(axis, babystep_increment);
|
thermalManager.babystep_axis(axis, babystep_increment);
|
||||||
babysteps_done += babystep_increment;
|
babysteps_done += babystep_increment;
|
||||||
}
|
}
|
||||||
@ -912,7 +905,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
|
|
||||||
zprobe_zoffset = new_zoffset;
|
zprobe_zoffset = new_zoffset;
|
||||||
refresh_zprobe_zoffset(true);
|
refresh_zprobe_zoffset(true);
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lcdDrawUpdate)
|
if (lcdDrawUpdate)
|
||||||
@ -943,7 +936,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005 / 2.0;
|
mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005 / 2.0;
|
||||||
mesh_edit_value = mesh_edit_accumulator;
|
mesh_edit_value = mesh_edit_accumulator;
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
|
|
||||||
const int32_t rounded = (int32_t)(mesh_edit_value * 1000.0);
|
const int32_t rounded = (int32_t)(mesh_edit_value * 1000.0);
|
||||||
mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0;
|
mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0;
|
||||||
@ -1422,7 +1415,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
constexpr uint8_t total_probe_points = (
|
constexpr uint8_t total_probe_points = (
|
||||||
#if ENABLED(AUTO_BED_LEVELING_3POINT)
|
#if ENABLED(AUTO_BED_LEVELING_3POINT)
|
||||||
3
|
3
|
||||||
#elif ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING)
|
#elif ABL_GRID || ENABLED(MESH_BED_LEVELING)
|
||||||
GRID_MAX_POINTS
|
GRID_MAX_POINTS
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@ -1447,26 +1440,12 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
|
|
||||||
#endif // MESH_BED_LEVELING
|
#endif // MESH_BED_LEVELING
|
||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
|
|
||||||
void _lcd_level_goto_next_point();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void _lcd_level_bed_done() {
|
void _lcd_level_bed_done() {
|
||||||
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void _lcd_level_goto_next_point();
|
||||||
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish
|
|
||||||
*/
|
|
||||||
void _lcd_level_bed_moving() {
|
|
||||||
if (lcdDrawUpdate) {
|
|
||||||
char msg[10];
|
|
||||||
sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), total_probe_points);
|
|
||||||
lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
|
|
||||||
}
|
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Step 7: Get the Z coordinate, click goes to the next point or exits
|
* Step 7: Get the Z coordinate, click goes to the next point or exits
|
||||||
@ -1474,40 +1453,24 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
void _lcd_level_bed_get_z() {
|
void _lcd_level_bed_get_z() {
|
||||||
ENCODER_DIRECTION_NORMAL();
|
ENCODER_DIRECTION_NORMAL();
|
||||||
|
|
||||||
// Encoder knob or keypad buttons adjust the Z position
|
|
||||||
if (encoderPosition) {
|
|
||||||
refresh_cmd_timeout();
|
|
||||||
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
|
|
||||||
NOLESS(current_position[Z_AXIS], -(LCD_PROBE_Z_RANGE) * 0.5);
|
|
||||||
NOMORE(current_position[Z_AXIS], (LCD_PROBE_Z_RANGE) * 0.5);
|
|
||||||
line_to_current(Z_AXIS);
|
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
|
||||||
encoderPosition = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lcd_clicked) {
|
if (lcd_clicked) {
|
||||||
|
|
||||||
// Use a hook to set the probe point z
|
// Use a hook to set the probe point z
|
||||||
// (zigzag arranges in XY order)
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
|
|
||||||
// UBL set-z handling goes here
|
// MBL records the position but doesn't move to the next one
|
||||||
|
mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]);
|
||||||
|
|
||||||
#elif ENABLED(PROBE_MANUALLY)
|
#elif ENABLED(PROBE_MANUALLY)
|
||||||
|
|
||||||
// G29 helpfully records Z and goes to the next
|
// The last G29 will record but not move
|
||||||
// point (or beeps if done)
|
if (manual_probe_index == total_probe_points - 1)
|
||||||
enqueue_and_echo_commands_P(PSTR("G29"));
|
enqueue_and_echo_commands_P("G29 V1");
|
||||||
manual_probe_index++;
|
|
||||||
|
|
||||||
#elif ENABLED(MESH_BED_LEVELING)
|
|
||||||
|
|
||||||
mbl.set_zigzag_z(manual_probe_index++, current_position[Z_AXIS]);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If done...
|
// If done...
|
||||||
if (manual_probe_index == total_probe_points) {
|
if (++manual_probe_index >= total_probe_points) {
|
||||||
|
|
||||||
// Say "Done!"
|
// Say "Done!"
|
||||||
lcd_goto_screen(_lcd_level_bed_done);
|
lcd_goto_screen(_lcd_level_bed_done);
|
||||||
@ -1526,10 +1489,6 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
mbl.set_has_mesh(true);
|
mbl.set_has_mesh(true);
|
||||||
mesh_probing_done();
|
mesh_probing_done();
|
||||||
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
|
|
||||||
// UBL enable goes here
|
|
||||||
|
|
||||||
#elif ENABLED(PROBE_MANUALLY)
|
#elif ENABLED(PROBE_MANUALLY)
|
||||||
|
|
||||||
// ABL will be enabled due to "G29".
|
// ABL will be enabled due to "G29".
|
||||||
@ -1540,19 +1499,21 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
|
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
|
||||||
lcd_completion_feedback();
|
lcd_completion_feedback();
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
|
||||||
// Move to the next probe point, if needed
|
|
||||||
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
|
|
||||||
|
|
||||||
_lcd_level_goto_next_point();
|
_lcd_level_goto_next_point();
|
||||||
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
return;
|
||||||
|
|
||||||
// UBL goto-next-point goes here
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Encoder knob or keypad buttons adjust the Z position
|
||||||
|
if (encoderPosition) {
|
||||||
|
refresh_cmd_timeout();
|
||||||
|
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
|
||||||
|
NOLESS(current_position[Z_AXIS], -(LCD_PROBE_Z_RANGE) * 0.5);
|
||||||
|
NOMORE(current_position[Z_AXIS], (LCD_PROBE_Z_RANGE) * 0.5);
|
||||||
|
line_to_current(Z_AXIS);
|
||||||
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
|
encoderPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update on first display, then only on updates to Z position
|
// Update on first display, then only on updates to Z position
|
||||||
@ -1563,7 +1524,25 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
|
/**
|
||||||
|
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if ENABLED(PROBE_MANUALLY)
|
||||||
|
bool lcd_wait_for_move;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void _lcd_level_bed_moving() {
|
||||||
|
if (lcdDrawUpdate) {
|
||||||
|
char msg[10];
|
||||||
|
sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), total_probe_points);
|
||||||
|
lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
|
||||||
|
}
|
||||||
|
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
||||||
|
#if ENABLED(PROBE_MANUALLY)
|
||||||
|
if (!lcd_wait_for_move) lcd_goto_screen(_lcd_level_bed_get_z);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Step 5: Initiate a move to the next point
|
* Step 5: Initiate a move to the next point
|
||||||
@ -1584,23 +1563,18 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
LOGICAL_Y_POSITION(mbl.index_to_ypos[py])
|
LOGICAL_Y_POSITION(mbl.index_to_ypos[py])
|
||||||
);
|
);
|
||||||
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
// After the blocking function returns, change menus
|
||||||
|
lcd_goto_screen(_lcd_level_bed_get_z);
|
||||||
// UBL may have its own methodology
|
|
||||||
|
|
||||||
#elif ENABLED(PROBE_MANUALLY)
|
#elif ENABLED(PROBE_MANUALLY)
|
||||||
|
|
||||||
// Just wait for the G29 move to complete
|
// G29 will signal when it's done
|
||||||
lcd_synchronize();
|
lcd_wait_for_move = true;
|
||||||
|
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// After the blocking function returns, change menus
|
|
||||||
lcd_goto_screen(_lcd_level_bed_get_z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MESH_BED_LEVELING
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Step 4: Display "Click to Begin", wait for click
|
* Step 4: Display "Click to Begin", wait for click
|
||||||
* Move to the first probe position
|
* Move to the first probe position
|
||||||
@ -1609,14 +1583,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
|
||||||
if (lcd_clicked) {
|
if (lcd_clicked) {
|
||||||
manual_probe_index = 0;
|
manual_probe_index = 0;
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
|
||||||
_lcd_level_goto_next_point();
|
_lcd_level_goto_next_point();
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
// UBL click handling should go here
|
|
||||||
#elif ENABLED(PROBE_MANUALLY)
|
|
||||||
enqueue_and_echo_commands_P(PSTR("G29"));
|
|
||||||
_lcd_level_goto_next_point();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1625,15 +1592,11 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
*/
|
*/
|
||||||
void _lcd_level_bed_homing() {
|
void _lcd_level_bed_homing() {
|
||||||
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
||||||
|
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
||||||
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
|
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
|
||||||
lcd_goto_screen(_lcd_level_bed_homing_done);
|
lcd_goto_screen(_lcd_level_bed_homing_done);
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // LCD_BED_LEVELING
|
|
||||||
|
|
||||||
#if ENABLED(LCD_BED_LEVELING) || HAS_ABL
|
|
||||||
|
|
||||||
#if ENABLED(PROBE_MANUALLY)
|
#if ENABLED(PROBE_MANUALLY)
|
||||||
extern bool g29_in_progress;
|
extern bool g29_in_progress;
|
||||||
#endif
|
#endif
|
||||||
@ -1642,15 +1605,10 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
* Step 2: Continue Bed Leveling...
|
* Step 2: Continue Bed Leveling...
|
||||||
*/
|
*/
|
||||||
void _lcd_level_bed_continue() {
|
void _lcd_level_bed_continue() {
|
||||||
#if ENABLED(LCD_BED_LEVELING)
|
|
||||||
defer_return_to_status = true;
|
defer_return_to_status = true;
|
||||||
axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false;
|
axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false;
|
||||||
lcd_goto_screen(_lcd_level_bed_homing);
|
lcd_goto_screen(_lcd_level_bed_homing);
|
||||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
||||||
#else
|
|
||||||
lcd_return_to_status();
|
|
||||||
enqueue_and_echo_commands_P(axis_homed[X_AXIS] && axis_homed[Y_AXIS] ? PSTR("G29") : PSTR("G28\nG29"));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1663,7 +1621,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
void _lcd_ubl_level_bed();
|
void _lcd_ubl_level_bed();
|
||||||
|
|
||||||
@ -2022,9 +1980,8 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W"));
|
MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W"));
|
||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // LCD_BED_LEVELING || HAS_ABL
|
#endif // AUTO_BED_LEVELING_UBL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -2061,19 +2018,15 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
//
|
//
|
||||||
// Level Bed
|
// Level Bed
|
||||||
//
|
//
|
||||||
#if ENABLED(LCD_BED_LEVELING) || HAS_ABL
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed);
|
||||||
|
#elif ENABLED(LCD_BED_LEVELING)
|
||||||
#if ENABLED(PROBE_MANUALLY)
|
#if ENABLED(PROBE_MANUALLY)
|
||||||
if (!g29_in_progress)
|
if (!g29_in_progress)
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
||||||
MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed);
|
|
||||||
#else
|
|
||||||
MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
|
MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // LCD_BED_LEVELING || HAS_ABL
|
|
||||||
|
|
||||||
#if HAS_M206_COMMAND
|
#if HAS_M206_COMMAND
|
||||||
//
|
//
|
||||||
// Set Home Offsets
|
// Set Home Offsets
|
||||||
@ -2158,7 +2111,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
|
|
||||||
void _lcd_calibrate_homing() {
|
void _lcd_calibrate_homing() {
|
||||||
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING));
|
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING));
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
|
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
|
||||||
lcd_goto_previous_menu();
|
lcd_goto_previous_menu();
|
||||||
}
|
}
|
||||||
@ -2292,7 +2245,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
manual_move_to_current(axis);
|
manual_move_to_current(axis);
|
||||||
|
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
}
|
}
|
||||||
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis]));
|
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis]));
|
||||||
}
|
}
|
||||||
@ -2314,7 +2267,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
, eindex
|
, eindex
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
}
|
}
|
||||||
if (lcdDrawUpdate) {
|
if (lcdDrawUpdate) {
|
||||||
PGM_P pos_label;
|
PGM_P pos_label;
|
||||||
@ -3243,7 +3196,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
||||||
++encoderLine; \
|
++encoderLine; \
|
||||||
} \
|
} \
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; \
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
|
||||||
} \
|
} \
|
||||||
++_thisItemNr; \
|
++_thisItemNr; \
|
||||||
} while(0)
|
} while(0)
|
||||||
@ -3775,9 +3728,9 @@ bool lcd_blink() {
|
|||||||
* - if (lcdDrawUpdate) { redraw }
|
* - if (lcdDrawUpdate) { redraw }
|
||||||
* - Before exiting the handler set lcdDrawUpdate to:
|
* - Before exiting the handler set lcdDrawUpdate to:
|
||||||
* - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT.
|
* - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT.
|
||||||
* - LCDVIEW_REDRAW_NOW or LCDVIEW_NONE to keep drawing, but only in this loop.
|
* - LCDVIEW_REDRAW_NOW to draw now (including remaining stripes).
|
||||||
* - LCDVIEW_CALL_REDRAW_NEXT to keep drawing and draw on the next loop also.
|
* - LCDVIEW_CALL_REDRAW_NEXT to draw now and get LCDVIEW_REDRAW_NOW on the next loop.
|
||||||
* - LCDVIEW_CALL_NO_REDRAW to keep drawing (or start drawing) with no redraw on the next loop.
|
* - LCDVIEW_CALL_NO_REDRAW to draw now and get LCDVIEW_NONE on the next loop.
|
||||||
* - NOTE: For graphical displays menu handlers may be called 2 or more times per loop,
|
* - NOTE: For graphical displays menu handlers may be called 2 or more times per loop,
|
||||||
* so don't change lcdDrawUpdate without considering this.
|
* so don't change lcdDrawUpdate without considering this.
|
||||||
*
|
*
|
||||||
@ -3897,7 +3850,7 @@ void lcd_update() {
|
|||||||
encoderDiff = 0;
|
encoderDiff = 0;
|
||||||
}
|
}
|
||||||
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
||||||
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
}
|
}
|
||||||
#endif // ULTIPANEL
|
#endif // ULTIPANEL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user