Merge pull request #6893 from thinkyhead/bf_lcd_leveling_fixes

Patch PROBE_MANUALLY + LCD_BED_LEVELING
master
Scott Lahteine 8 years ago committed by GitHub
commit 5d6366d4e6

@ -131,7 +131,7 @@
void set_destination_to_current(); void set_destination_to_current();
void set_current_to_destination(); void set_current_to_destination();
void prepare_move_to_destination(); void prepare_move_to_destination();
void lcd_setstatuspgm(const char* const message, const uint8_t level); void lcd_setstatusPGM(const char* const message, const int8_t level);
void sync_plan_position_e(); void sync_plan_position_e();
void chirp_at_user(); void chirp_at_user();
@ -181,18 +181,17 @@
safe_delay(10); // Wait for click to settle safe_delay(10); // Wait for click to settle
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99); lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
lcd_reset_alert_level();
while (!ubl_lcd_clicked()) idle(); // Wait for button release while (!ubl_lcd_clicked()) idle(); // Wait for button release
// If the button is suddenly pressed again, // If the button is suddenly pressed again,
// ask the user to resolve the issue // ask the user to resolve the issue
lcd_setstatuspgm(PSTR("Release button"), 99); // will never appear... lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
while (ubl_lcd_clicked()) idle(); // unless this loop happens while (ubl_lcd_clicked()) idle(); // unless this loop happens
lcd_setstatuspgm(PSTR("")); lcd_setstatusPGM(PSTR(""), -1);
return true; return true;
} }
@ -351,8 +350,7 @@
} while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0); } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
LEAVE: LEAVE:
lcd_reset_alert_level(); lcd_setstatusPGM(PSTR("Leaving G26"), -1);
lcd_setstatuspgm(PSTR("Leaving G26"));
retract_filament(destination); retract_filament(destination);
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
@ -726,8 +724,7 @@
} }
bool unified_bed_leveling::exit_from_g26() { bool unified_bed_leveling::exit_from_g26() {
lcd_reset_alert_level(); lcd_setstatusPGM(PSTR("Leaving G26"), -1);
lcd_setstatuspgm(PSTR("Leaving G26"));
while (ubl_lcd_clicked()) idle(); while (ubl_lcd_clicked()) idle();
return UBL_ERR; return UBL_ERR;
} }
@ -741,7 +738,7 @@
#if HAS_TEMP_BED #if HAS_TEMP_BED
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
if (g26_bed_temp > 25) { if (g26_bed_temp > 25) {
lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99); lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
has_control_of_lcd_panel = true; has_control_of_lcd_panel = true;
@ -757,7 +754,7 @@
} }
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
} }
lcd_setstatuspgm(PSTR("G26 Heating Nozzle."), 99); lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99);
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
#endif #endif
@ -774,8 +771,7 @@
} }
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_reset_alert_level(); lcd_setstatusPGM(PSTR(""), -1);
lcd_setstatuspgm(PSTR(""));
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
@ -792,7 +788,7 @@
has_control_of_lcd_panel = true; has_control_of_lcd_panel = true;
lcd_setstatuspgm(PSTR("User-Controlled Prime"), 99); lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99);
chirp_at_user(); chirp_at_user();
set_destination_to_current(); set_destination_to_current();
@ -819,9 +815,9 @@
while (ubl_lcd_clicked()) idle(); // Debounce Encoder Wheel while (ubl_lcd_clicked()) idle(); // Debounce Encoder Wheel
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatuspgm() without having it continue; strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
// So... We cheat to get a message up. // So... We cheat to get a message up.
lcd_setstatuspgm(PSTR("Done Priming"), 99); lcd_setstatusPGM(PSTR("Done Priming"), 99);
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
@ -830,7 +826,7 @@
} }
else { else {
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_setstatuspgm(PSTR("Fixed Length Prime."), 99); lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99);
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
set_destination_to_current(); set_destination_to_current();

@ -217,8 +217,8 @@ extern bool volumetric_enabled;
extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
extern bool axis_known_position[XYZ]; // axis[n].is_known extern bool axis_known_position[XYZ];
extern bool axis_homed[XYZ]; // axis[n].is_homed extern bool axis_homed[XYZ];
extern volatile bool wait_for_heatup; extern volatile bool wait_for_heatup;
#if HAS_RESUME_CONTINUE #if HAS_RESUME_CONTINUE

@ -1743,15 +1743,15 @@ static void clean_up_after_endstop_or_probe_move() {
#if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION) #if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION)
bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) { bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) {
#if ENABLED(HOME_AFTER_DEACTIVATE) #if ENABLED(HOME_AFTER_DEACTIVATE)
const bool xx = x && !axis_known_position[X_AXIS], const bool xx = x && !axis_known_position[X_AXIS],
yy = y && !axis_known_position[Y_AXIS], yy = y && !axis_known_position[Y_AXIS],
zz = z && !axis_known_position[Z_AXIS]; zz = z && !axis_known_position[Z_AXIS];
#else #else
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];
#endif #endif
if (xx || yy || zz) { if (xx || yy || zz) {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOME " "); SERIAL_ECHOPGM(MSG_HOME " ");
@ -2467,7 +2467,7 @@ static void clean_up_after_endstop_or_probe_move() {
#endif #endif
for (uint8_t y = 0; y < sy; y++) { for (uint8_t y = 0; y < sy; y++) {
#ifdef SCAD_MESH_OUTPUT #ifdef SCAD_MESH_OUTPUT
SERIAL_PROTOCOLLNPGM(" ["); // open sub-array SERIAL_PROTOCOLPGM(" ["); // open sub-array
#else #else
if (y < 10) SERIAL_PROTOCOLCHAR(' '); if (y < 10) SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOL((int)y); SERIAL_PROTOCOL((int)y);
@ -2501,7 +2501,7 @@ static void clean_up_after_endstop_or_probe_move() {
SERIAL_EOL; SERIAL_EOL;
} }
#ifdef SCAD_MESH_OUTPUT #ifdef SCAD_MESH_OUTPUT
SERIAL_PROTOCOLPGM("\n];"); // close 2D array SERIAL_PROTOCOLPGM("];"); // close 2D array
#endif #endif
SERIAL_EOL; SERIAL_EOL;
} }
@ -3798,6 +3798,8 @@ inline void gcode_G28(const bool always_home_all) {
tool_change(old_tool_index, 0, true); tool_change(old_tool_index, 0, true);
#endif #endif
lcd_refresh();
report_current_position(); report_current_position();
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
@ -3839,7 +3841,7 @@ void home_all_axes() { gcode_G28(true); }
#if MANUAL_PROBE_HEIGHT > 0 #if MANUAL_PROBE_HEIGHT > 0
feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS]; feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS];
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2; // just slightly over the bed current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); // just slightly over the bed
line_to_current_position(); line_to_current_position();
#endif #endif
@ -4132,8 +4134,14 @@ void home_all_axes() { gcode_G28(true); }
#endif #endif
#endif #endif
#if ENABLED(PROBE_MANUALLY)
const bool seenA = parser.seen('A'), seenQ = parser.seen('Q'), no_action = seenA || seenQ;
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) #if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY)
const bool faux = parser.seen('C') && parser.value_bool(); const bool faux = parser.seen('C') && parser.value_bool();
#elif ENABLED(PROBE_MANUALLY)
const bool faux = no_action;
#else #else
bool constexpr faux = false; bool constexpr faux = false;
#endif #endif
@ -4231,19 +4239,19 @@ void home_all_axes() { gcode_G28(true); }
return; return;
} }
const float z = parser.seen('Z') && parser.has_value() ? parser.value_float() : 99999; const float z = parser.seen('Z') && parser.has_value() ? parser.value_float() : NAN;
if (!WITHIN(z, -10, 10)) { if (!isnan(z) || !WITHIN(z, -10, 10)) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Bad Z value"); SERIAL_ERRORLNPGM("Bad Z value");
return; return;
} }
const float x = parser.seen('X') && parser.has_value() ? parser.value_float() : 99999, const float x = parser.seen('X') && parser.has_value() ? parser.value_float() : NAN,
y = parser.seen('Y') && parser.has_value() ? parser.value_float() : 99999; y = parser.seen('Y') && parser.has_value() ? parser.value_float() : NAN;
int8_t i = parser.seen('I') && parser.has_value() ? parser.value_byte() : -1, int8_t i = parser.seen('I') && parser.has_value() ? parser.value_byte() : -1,
j = parser.seen('J') && parser.has_value() ? parser.value_byte() : -1; j = parser.seen('J') && parser.has_value() ? parser.value_byte() : -1;
if (x < 99998 && y < 99998) { if (!isnan(x) && !isnan(y)) {
// Get nearest i / j from x / y // Get nearest i / j from x / y
i = (x - LOGICAL_X_POSITION(bilinear_start[X_AXIS]) + 0.5 * xGridSpacing) / xGridSpacing; i = (x - LOGICAL_X_POSITION(bilinear_start[X_AXIS]) + 0.5 * xGridSpacing) / xGridSpacing;
j = (y - LOGICAL_Y_POSITION(bilinear_start[Y_AXIS]) + 0.5 * yGridSpacing) / yGridSpacing; j = (y - LOGICAL_Y_POSITION(bilinear_start[Y_AXIS]) + 0.5 * yGridSpacing) / yGridSpacing;
@ -4279,7 +4287,11 @@ void home_all_axes() { gcode_G28(true); }
return; return;
} }
dryrun = parser.seen('D') && parser.value_bool(); dryrun = (parser.seen('D') && parser.value_bool())
#if ENABLED(PROBE_MANUALLY)
|| no_action
#endif
;
#if ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
@ -4424,16 +4436,14 @@ 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. // For manual probing, get the next index to probe now.
// On the first probe this will be incremented to 0. // On the first probe this will be incremented to 0.
if (!seenA && !seenQ) { if (!no_action) {
++abl_probe_index; ++abl_probe_index;
g29_in_progress = true; g29_in_progress = true;
} }
// Abort current G29 procedure, go back to ABLStart // Abort current G29 procedure, go back to idle state
if (seenA && 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
@ -4450,14 +4460,14 @@ void home_all_axes() { gcode_G28(true); }
if (verbose_level || seenQ) { if (verbose_level || seenQ) {
SERIAL_PROTOCOLPGM("Manual G29 "); SERIAL_PROTOCOLPGM("Manual G29 ");
if (g29_in_progress) { if (g29_in_progress) {
SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1); SERIAL_PROTOCOLPAIR("point ", min(abl_probe_index + 1, abl2));
SERIAL_PROTOCOLLNPAIR(" of ", abl2); SERIAL_PROTOCOLLNPAIR(" of ", abl2);
} }
else else
SERIAL_PROTOCOLLNPGM("idle"); SERIAL_PROTOCOLLNPGM("idle");
} }
if (seenA || seenQ) return; if (no_action) return;
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
@ -4482,6 +4492,14 @@ void home_all_axes() { gcode_G28(true); }
z_values[xCount][yCount] = measured_z + zoffset; z_values[xCount][yCount] = measured_z + zoffset;
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_PROTOCOLPAIR("Save X", xCount);
SERIAL_PROTOCOLPAIR(" Y", yCount);
SERIAL_PROTOCOLLNPAIR(" Z", measured_z + zoffset);
}
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT) #elif ENABLED(AUTO_BED_LEVELING_3POINT)
points[i].z = measured_z; points[i].z = measured_z;

@ -394,8 +394,8 @@
#ifndef MSG_VE_JERK #ifndef MSG_VE_JERK
#define MSG_VE_JERK _UxGT("Ve-jerk") #define MSG_VE_JERK _UxGT("Ve-jerk")
#endif #endif
#ifndef MSG_FEEDRATE #ifndef MSG_VELOCITY
#define MSG_FEEDRATE _UxGT("Feedrate") #define MSG_VELOCITY _UxGT("Velocity")
#endif #endif
#ifndef MSG_VMAX #ifndef MSG_VMAX
#define MSG_VMAX _UxGT("Vmax ") #define MSG_VMAX _UxGT("Vmax ")

@ -58,7 +58,7 @@
typedef void (*screenFunc_t)(); typedef void (*screenFunc_t)();
extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0); extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
extern void lcd_setstatus(const char* message, const bool persist); extern void lcd_setstatus(const char* message, const bool persist);
extern void lcd_setstatuspgm(const char* message, const uint8_t level); extern void lcd_setstatusPGM(const char* message, const int8_t level);
int unified_bed_leveling::g29_verbose_level, int unified_bed_leveling::g29_verbose_level,
unified_bed_leveling::g29_phase_value, unified_bed_leveling::g29_phase_value,

@ -481,21 +481,35 @@ uint16_t max_display_update_time = 0;
/** /**
* Show "Moving..." till moves are done, then revert to previous display. * Show "Moving..." till moves are done, then revert to previous display.
*/ */
inline void lcd_synchronize(const char * const msg=NULL) { static const char moving[] PROGMEM = MSG_MOVING;
static const char *sync_message = moving;
//
// Display the synchronize screen until moves are
// finished, and don't return to the caller until
// done. ** This blocks the command queue! **
//
void _lcd_synchronize() {
static bool no_reentry = false; static bool no_reentry = false;
const static char moving[] PROGMEM = MSG_MOVING; if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, msg ? msg : moving);
if (no_reentry) return; if (no_reentry) return;
// Make this the current handler till all moves are done // 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);
stepper.synchronize(); stepper.synchronize();
no_reentry = false; no_reentry = false;
lcd_goto_screen(old_screen); lcd_goto_screen(old_screen);
} }
// Display the synchronize screen with a custom message
// ** This blocks the command queue! **
void lcd_synchronize(const char * const msg=NULL) {
sync_message = msg ? msg : moving;
_lcd_synchronize();
}
void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); } void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
void lcd_save_previous_screen() { void lcd_save_previous_screen() {
@ -680,7 +694,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(PARK_HEAD_ON_PAUSE) #if ENABLED(PARK_HEAD_ON_PAUSE)
enqueue_and_echo_commands_P(PSTR("M125")); enqueue_and_echo_commands_P(PSTR("M125"));
#endif #endif
lcd_setstatuspgm(PSTR(MSG_PRINT_PAUSED), true); lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1);
} }
void lcd_sdcard_resume() { void lcd_sdcard_resume() {
@ -690,7 +704,7 @@ void kill_screen(const char* lcd_msg) {
card.startFileprint(); card.startFileprint();
print_job_timer.start(); print_job_timer.start();
#endif #endif
lcd_setstatuspgm(PSTR(""), true); lcd_setstatusPGM(PSTR(""), -1);
} }
void lcd_sdcard_stop() { void lcd_sdcard_stop() {
@ -703,7 +717,7 @@ void kill_screen(const char* lcd_msg) {
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
#endif #endif
wait_for_heatup = false; wait_for_heatup = false;
LCD_MESSAGEPGM(MSG_PRINT_ABORTED); lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1);
} }
#endif // SDSUPPORT #endif // SDSUPPORT
@ -1420,6 +1434,26 @@ void kill_screen(const char* lcd_msg) {
#endif #endif
); );
//
// Raise Z to the "manual probe height"
// Don't return until done.
// ** This blocks the command queue! **
//
void _lcd_after_probing() {
#if MANUAL_PROBE_HEIGHT > 0
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT;
line_to_current(Z_AXIS);
#endif
// Display "Done" screen and wait for moves to complete
#if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
#endif
lcd_goto_previous_menu();
lcd_completion_feedback();
defer_return_to_status = false;
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
}
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
// Utility to go to the next mesh point // Utility to go to the next mesh point
@ -1432,19 +1466,29 @@ void kill_screen(const char* lcd_msg) {
current_position[Y_AXIS] = LOGICAL_Y_POSITION(y); current_position[Y_AXIS] = LOGICAL_Y_POSITION(y);
planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder); planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
#if MANUAL_PROBE_HEIGHT > 0 #if MANUAL_PROBE_HEIGHT > 0
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2; current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
line_to_current(Z_AXIS); line_to_current(Z_AXIS);
#endif #endif
lcd_synchronize(); lcd_synchronize();
} }
#endif // MESH_BED_LEVELING #elif ENABLED(PROBE_MANUALLY)
bool lcd_wait_for_move;
//
// Bed leveling is done. Wait for G29 to complete.
// A flag is used so that this can release control
// and allow the command queue to be processed.
//
void _lcd_level_bed_done() { void _lcd_level_bed_done() {
if (!lcd_wait_for_move) _lcd_after_probing();
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE)); if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
} }
#endif
void _lcd_level_goto_next_point(); void _lcd_level_goto_next_point();
/** /**
@ -1455,59 +1499,55 @@ void kill_screen(const char* lcd_msg) {
if (lcd_clicked) { if (lcd_clicked) {
// Use a hook to set the probe point z //
// Save the current Z position
//
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
//
// MBL records the position but doesn't move to the next one // 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)
// The last G29 will record but not move mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]);
if (manual_probe_index == total_probe_points - 1)
enqueue_and_echo_commands_P(PSTR("G29 V1"));
#endif #endif
// If done... // If done...
if (++manual_probe_index >= total_probe_points) { if (++manual_probe_index >= total_probe_points) {
// Say "Done!" #if ENABLED(PROBE_MANUALLY)
lcd_goto_screen(_lcd_level_bed_done);
// Raise Z to the "manual probe height" //
#if MANUAL_PROBE_HEIGHT > 0 // The last G29 will record and enable but not move.
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; // Since G29 is deferred,
line_to_current(Z_AXIS); //
#endif lcd_wait_for_move = true;
enqueue_and_echo_commands_P(PSTR("G29 V1"));
lcd_goto_screen(_lcd_level_bed_done);
#if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING) #elif ENABLED(MESH_BED_LEVELING)
lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
#endif
// Enable leveling, if needed _lcd_after_probing();
#if ENABLED(MESH_BED_LEVELING)
mbl.set_has_mesh(true); mbl.set_has_mesh(true);
mesh_probing_done(); mesh_probing_done();
#elif ENABLED(PROBE_MANUALLY)
// ABL will be enabled due to "G29".
#endif #endif
lcd_return_to_status();
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
lcd_completion_feedback();
} }
else else {
// MESH_BED_LEVELING: Z already stored, just move
// PROBE_MANUALLY: Send G29 to record Z, then move
_lcd_level_goto_next_point(); _lcd_level_goto_next_point();
}
return; return;
} }
//
// Encoder knob or keypad buttons adjust the Z position // Encoder knob or keypad buttons adjust the Z position
//
if (encoderPosition) { if (encoderPosition) {
refresh_cmd_timeout(); refresh_cmd_timeout();
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP); current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
@ -1518,8 +1558,9 @@ void kill_screen(const char* lcd_msg) {
encoderPosition = 0; encoderPosition = 0;
} }
// Update on first display, then only on updates to Z position //
// Show message above on clicks instead // Draw on first display, then only on Z change
//
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
const float v = current_position[Z_AXIS]; const float v = current_position[Z_AXIS];
lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001 : 0.0001), '+')); lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001 : 0.0001), '+'));
@ -1530,10 +1571,6 @@ void kill_screen(const char* lcd_msg) {
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish * 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() { void _lcd_level_bed_moving() {
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
char msg[10]; char msg[10];
@ -1570,7 +1607,7 @@ void kill_screen(const char* lcd_msg) {
#elif ENABLED(PROBE_MANUALLY) #elif ENABLED(PROBE_MANUALLY)
// G29 will signal when it's done // G29 Records Z, moves, and signals when it pauses
lcd_wait_for_move = true; lcd_wait_for_move = true;
enqueue_and_echo_commands_P(PSTR("G29 V1")); enqueue_and_echo_commands_P(PSTR("G29 V1"));
@ -1620,19 +1657,22 @@ void kill_screen(const char* lcd_msg) {
/** /**
* Step 1: Bed Level entry-point * Step 1: Bed Level entry-point
* - Cancel * - Cancel
* - Auto Home (if homing needed)
* - Leveling On/Off (if data exists, and homed)
* - Level Bed > * - Level Bed >
* - Leveling On/Off (if there is leveling data)
* - Fade Height (Req: ENABLE_LEVELING_FADE_HEIGHT) * - Fade Height (Req: ENABLE_LEVELING_FADE_HEIGHT)
* - Mesh Z Offset (Req: MESH_BED_LEVELING) * - Mesh Z Offset (Req: MESH_BED_LEVELING)
* - Z Probe Offset (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) * - Z Probe Offset (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET)
* - Load Settings (Req: EEPROM_SETTINGS) * - Load Settings (Req: EEPROM_SETTINGS)
* - Save Settings (Req: EEPROM_SETTINGS) * - Save Settings (Req: EEPROM_SETTINGS)
*/ */
void lcd_level_bed() { void lcd_bed_leveling() {
START_MENU(); START_MENU();
MENU_BACK(MSG_PREPARE); MENU_BACK(MSG_PREPARE);
MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
if (leveling_is_valid()) { // Leveling data exists? Show more options. if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
else if (leveling_is_valid()) {
_level_state = leveling_is_active(); _level_state = leveling_is_active();
MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &_level_state, _lcd_toggle_bed_leveling); MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &_level_state, _lcd_toggle_bed_leveling);
} }
@ -1642,7 +1682,9 @@ void kill_screen(const char* lcd_msg) {
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &planner.z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &planner.z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
#endif #endif
// Manual bed leveling, Bed Z: //
// MBL Z Offset
//
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
#endif #endif
@ -1653,6 +1695,8 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset); MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset);
#endif #endif
MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
@ -2063,7 +2107,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(PROBE_MANUALLY) #if ENABLED(PROBE_MANUALLY)
if (!g29_in_progress) if (!g29_in_progress)
#endif #endif
MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_level_bed); MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
#endif #endif
#if HAS_M206_COMMAND #if HAS_M206_COMMAND
@ -2826,8 +2870,8 @@ void kill_screen(const char* lcd_msg) {
static void lcd_refresh_zprobe_zoffset() { refresh_zprobe_zoffset(); } static void lcd_refresh_zprobe_zoffset() { refresh_zprobe_zoffset(); }
#endif #endif
// M203 / M205 Feedrates // M203 / M205 Velocity options
void lcd_control_motion_feedrate_menu() { void lcd_control_motion_velocity_menu() {
START_MENU(); START_MENU();
MENU_BACK(MSG_MOTION); MENU_BACK(MSG_MOTION);
@ -2957,18 +3001,19 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset); MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset);
#endif #endif
// M203 / M205 Feedrate items // M203 / M205 - Feedrate items
MENU_ITEM(submenu, MSG_FEEDRATE, lcd_control_motion_feedrate_menu); MENU_ITEM(submenu, MSG_VELOCITY, lcd_control_motion_velocity_menu);
// M201 Acceleration items // M201 - Acceleration items
MENU_ITEM(submenu, MSG_ACCELERATION, lcd_control_motion_acceleration_menu); MENU_ITEM(submenu, MSG_ACCELERATION, lcd_control_motion_acceleration_menu);
// M205 Max Jerk // M205 - Max Jerk
MENU_ITEM(submenu, MSG_JERK, lcd_control_motion_jerk_menu); MENU_ITEM(submenu, MSG_JERK, lcd_control_motion_jerk_menu);
// M92 Steps Per mm // M92 - Steps Per mm
MENU_ITEM(submenu, MSG_STEPS_PER_MM, lcd_control_motion_steps_per_mm_menu); MENU_ITEM(submenu, MSG_STEPS_PER_MM, lcd_control_motion_steps_per_mm_menu);
// M540 S - Abort on endstop hit when SD printing
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit); MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
#endif #endif
@ -4095,7 +4140,8 @@ void lcd_setstatus(const char * const message, const bool persist) {
lcd_finishstatus(persist); lcd_finishstatus(persist);
} }
void lcd_setstatuspgm(const char * const message, const uint8_t level) { void lcd_setstatusPGM(const char * const message, int8_t level) {
if (level < 0) level = lcd_status_message_level = 0;
if (level < lcd_status_message_level) return; if (level < lcd_status_message_level) return;
lcd_status_message_level = level; lcd_status_message_level = level;
strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
@ -4113,7 +4159,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
} }
void lcd_setalertstatuspgm(const char * const message) { void lcd_setalertstatuspgm(const char * const message) {
lcd_setstatuspgm(message, 1); lcd_setstatusPGM(message, 1);
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
lcd_return_to_status(); lcd_return_to_status();
#endif #endif

@ -38,7 +38,7 @@
void lcd_init(); void lcd_init();
bool lcd_hasstatus(); bool lcd_hasstatus();
void lcd_setstatus(const char* message, const bool persist=false); void lcd_setstatus(const char* message, const bool persist=false);
void lcd_setstatuspgm(const char* message, const uint8_t level=0); void lcd_setstatusPGM(const char* message, const int8_t level=0);
void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...); void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
void lcd_setalertstatuspgm(const char* message); void lcd_setalertstatuspgm(const char* message);
void lcd_reset_alert_level(); void lcd_reset_alert_level();
@ -46,6 +46,9 @@
void kill_screen(const char* lcd_msg); void kill_screen(const char* lcd_msg);
bool lcd_detected(void); bool lcd_detected(void);
extern uint8_t lcdDrawUpdate;
inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
#if HAS_BUZZER #if HAS_BUZZER
void lcd_buzz(long duration, uint16_t freq); void lcd_buzz(long duration, uint16_t freq);
#endif #endif
@ -61,7 +64,7 @@
void bootscreen(); void bootscreen();
#endif #endif
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x))
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
#define LCD_UPDATE_INTERVAL 100 #define LCD_UPDATE_INTERVAL 100
@ -153,11 +156,12 @@
inline void lcd_init() {} inline void lcd_init() {}
inline bool lcd_hasstatus() { return false; } inline bool lcd_hasstatus() { return false; }
inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); } inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); } inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
inline void lcd_buttons_update() {} inline void lcd_buttons_update() {}
inline void lcd_reset_alert_level() {} inline void lcd_reset_alert_level() {}
inline bool lcd_detected() { return true; } inline bool lcd_detected() { return true; }
inline void lcd_refresh() {}
#define LCD_MESSAGEPGM(x) NOOP #define LCD_MESSAGEPGM(x) NOOP
#define LCD_ALERTMESSAGEPGM(x) NOOP #define LCD_ALERTMESSAGEPGM(x) NOOP

@ -806,8 +806,10 @@ static void lcd_implementation_status_screen() {
// Draw the progress bar if the message has shown long enough // Draw the progress bar if the message has shown long enough
// or if there is no message set. // or if there is no message set.
if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) {
return lcd_draw_progress_bar(card.percentDone()); const uint8_t percent = card.percentDone();
if (percent) return lcd_draw_progress_bar(percent);
}
#elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)

Loading…
Cancel
Save