Merge branch 'Development' into config_testing
Latest upstream commits
This commit is contained in:
@ -69,6 +69,13 @@ static void lcd_sdcard_menu();
|
||||
static void lcd_delta_calibrate_menu();
|
||||
#endif // DELTA_CALIBRATION_MENU
|
||||
|
||||
#if defined(MANUAL_BED_LEVELING)
|
||||
#include "mesh_bed_leveling.h"
|
||||
static void _lcd_level_bed();
|
||||
static void _lcd_level_bed_homing();
|
||||
static void lcd_level_bed();
|
||||
#endif // MANUAL_BED_LEVELING
|
||||
|
||||
static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
|
||||
|
||||
/* Different types of actions that can be used in menu items. */
|
||||
@ -629,6 +636,10 @@ static void lcd_prepare_menu() {
|
||||
}
|
||||
#endif
|
||||
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
|
||||
|
||||
#if defined(MANUAL_BED_LEVELING)
|
||||
MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
|
||||
#endif
|
||||
|
||||
END_MENU();
|
||||
}
|
||||
@ -1336,7 +1347,12 @@ void lcd_update() {
|
||||
#endif
|
||||
|
||||
#ifdef ULTIPANEL
|
||||
if (currentMenu != lcd_status_screen && millis() > timeoutToStatus) {
|
||||
if (currentMenu != lcd_status_screen &&
|
||||
#if defined(MANUAL_BED_LEVELING)
|
||||
currentMenu != _lcd_level_bed &&
|
||||
currentMenu != _lcd_level_bed_homing &&
|
||||
#endif // MANUAL_BED_LEVELING
|
||||
millis() > timeoutToStatus) {
|
||||
lcd_return_to_status();
|
||||
lcdDrawUpdate = 2;
|
||||
}
|
||||
@ -1755,4 +1771,75 @@ char *ftostr52(const float &x)
|
||||
return conv;
|
||||
}
|
||||
|
||||
#if defined(MANUAL_BED_LEVELING)
|
||||
static int _lcd_level_bed_position;
|
||||
static void _lcd_level_bed()
|
||||
{
|
||||
if (encoderPosition != 0) {
|
||||
refresh_cmd_timeout();
|
||||
current_position[Z_AXIS] += float((int)encoderPosition) * 0.05;
|
||||
if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
|
||||
if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
|
||||
encoderPosition = 0;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder);
|
||||
lcdDrawUpdate = 1;
|
||||
}
|
||||
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr32(current_position[Z_AXIS]));
|
||||
static bool debounce_click = false;
|
||||
if (LCD_CLICKED) {
|
||||
if (!debounce_click) {
|
||||
debounce_click = true;
|
||||
int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
|
||||
int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
|
||||
mbl.set_z(ix, iy, current_position[Z_AXIS]);
|
||||
_lcd_level_bed_position++;
|
||||
if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
|
||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
|
||||
mbl.active = 1;
|
||||
enquecommands_P(PSTR("G28"));
|
||||
lcd_return_to_status();
|
||||
} else {
|
||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
|
||||
ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
|
||||
iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
|
||||
if (iy&1) { // Zig zag
|
||||
ix = (MESH_NUM_X_POINTS - 1) - ix;
|
||||
}
|
||||
current_position[X_AXIS] = mbl.get_x(ix);
|
||||
current_position[Y_AXIS] = mbl.get_y(iy);
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
|
||||
lcdDrawUpdate = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
debounce_click = false;
|
||||
}
|
||||
}
|
||||
static void _lcd_level_bed_homing()
|
||||
{
|
||||
if (axis_known_position[X_AXIS] &&
|
||||
axis_known_position[Y_AXIS] &&
|
||||
axis_known_position[Z_AXIS]) {
|
||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
current_position[X_AXIS] = MESH_MIN_X;
|
||||
current_position[Y_AXIS] = MESH_MIN_Y;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
|
||||
_lcd_level_bed_position = 0;
|
||||
lcd_goto_menu(_lcd_level_bed);
|
||||
}
|
||||
}
|
||||
static void lcd_level_bed()
|
||||
{
|
||||
axis_known_position[X_AXIS] = false;
|
||||
axis_known_position[Y_AXIS] = false;
|
||||
axis_known_position[Z_AXIS] = false;
|
||||
mbl.reset();
|
||||
enquecommands_P(PSTR("G28"));
|
||||
lcd_goto_menu(_lcd_level_bed_homing);
|
||||
}
|
||||
#endif // MANUAL_BED_LEVELING
|
||||
|
||||
#endif //ULTRA_LCD
|
||||
|
Reference in New Issue
Block a user