|
@ -644,8 +644,8 @@ static void lcd_prepare_menu() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#ifdef DELTA_CALIBRATION_MENU |
|
|
#ifdef DELTA_CALIBRATION_MENU |
|
|
static void lcd_delta_calibrate_menu() |
|
|
|
|
|
{ |
|
|
static void lcd_delta_calibrate_menu() { |
|
|
START_MENU(); |
|
|
START_MENU(); |
|
|
MENU_ITEM(back, MSG_MAIN, lcd_main_menu); |
|
|
MENU_ITEM(back, MSG_MAIN, lcd_main_menu); |
|
|
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); |
|
|
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); |
|
@ -654,9 +654,19 @@ static void lcd_delta_calibrate_menu() |
|
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0")); |
|
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0")); |
|
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0")); |
|
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0")); |
|
|
END_MENU(); |
|
|
END_MENU(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // DELTA_CALIBRATION_MENU
|
|
|
#endif // DELTA_CALIBRATION_MENU
|
|
|
|
|
|
|
|
|
|
|
|
inline void line_to_current() { |
|
|
|
|
|
#ifdef DELTA |
|
|
|
|
|
calculate_delta(current_position); |
|
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder); |
|
|
|
|
|
#else |
|
|
|
|
|
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); |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
float move_menu_scale; |
|
|
float move_menu_scale; |
|
|
static void lcd_move_menu_axis(); |
|
|
static void lcd_move_menu_axis(); |
|
|
|
|
|
|
|
@ -667,12 +677,7 @@ static void _lcd_move(const char *name, int axis, int min, int max) { |
|
|
if (min_software_endstops && current_position[axis] < min) current_position[axis] = min; |
|
|
if (min_software_endstops && current_position[axis] < min) current_position[axis] = min; |
|
|
if (max_software_endstops && current_position[axis] > max) current_position[axis] = max; |
|
|
if (max_software_endstops && current_position[axis] > max) current_position[axis] = max; |
|
|
encoderPosition = 0; |
|
|
encoderPosition = 0; |
|
|
#ifdef DELTA |
|
|
line_to_current(); |
|
|
calculate_delta(current_position); |
|
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder); |
|
|
|
|
|
#else |
|
|
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder); |
|
|
|
|
|
#endif |
|
|
|
|
|
lcdDrawUpdate = 1; |
|
|
lcdDrawUpdate = 1; |
|
|
} |
|
|
} |
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis])); |
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis])); |
|
@ -681,17 +686,11 @@ static void _lcd_move(const char *name, int axis, int min, int max) { |
|
|
static void lcd_move_x() { _lcd_move(PSTR("X"), X_AXIS, X_MIN_POS, X_MAX_POS); } |
|
|
static void lcd_move_x() { _lcd_move(PSTR("X"), X_AXIS, X_MIN_POS, X_MAX_POS); } |
|
|
static void lcd_move_y() { _lcd_move(PSTR("Y"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); } |
|
|
static void lcd_move_y() { _lcd_move(PSTR("Y"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); } |
|
|
static void lcd_move_z() { _lcd_move(PSTR("Z"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); } |
|
|
static void lcd_move_z() { _lcd_move(PSTR("Z"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); } |
|
|
|
|
|
|
|
|
static void lcd_move_e() { |
|
|
static void lcd_move_e() { |
|
|
if (encoderPosition != 0) { |
|
|
if (encoderPosition != 0) { |
|
|
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale; |
|
|
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale; |
|
|
encoderPosition = 0; |
|
|
encoderPosition = 0; |
|
|
#ifdef DELTA |
|
|
line_to_current(); |
|
|
calculate_delta(current_position); |
|
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder); |
|
|
|
|
|
#else |
|
|
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder); |
|
|
|
|
|
#endif |
|
|
|
|
|
lcdDrawUpdate = 1; |
|
|
lcdDrawUpdate = 1; |
|
|
} |
|
|
} |
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS])); |
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS])); |
|
@ -1796,76 +1795,78 @@ char *ftostr52(const float &x) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#ifdef MANUAL_BED_LEVELING |
|
|
#ifdef MANUAL_BED_LEVELING |
|
|
static int _lcd_level_bed_position; |
|
|
|
|
|
static void _lcd_level_bed() |
|
|
static int _lcd_level_bed_position; |
|
|
{ |
|
|
static void _lcd_level_bed() { |
|
|
if (encoderPosition != 0) { |
|
|
if (encoderPosition != 0) { |
|
|
refresh_cmd_timeout(); |
|
|
refresh_cmd_timeout(); |
|
|
current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP; |
|
|
current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP; |
|
|
if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS; |
|
|
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; |
|
|
if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; |
|
|
encoderPosition = 0; |
|
|
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); |
|
|
line_to_current(); |
|
|
lcdDrawUpdate = 1; |
|
|
lcdDrawUpdate = 1; |
|
|
} |
|
|
} |
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS])); |
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS])); |
|
|
static bool debounce_click = false; |
|
|
static bool debounce_click = false; |
|
|
if (LCD_CLICKED) { |
|
|
if (LCD_CLICKED) { |
|
|
if (!debounce_click) { |
|
|
if (!debounce_click) { |
|
|
debounce_click = true; |
|
|
debounce_click = true; |
|
|
int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; |
|
|
int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; |
|
|
int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; |
|
|
int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; |
|
|
if (iy&1) { // Zig zag
|
|
|
|
|
|
ix = (MESH_NUM_X_POINTS - 1) - ix; |
|
|
|
|
|
} |
|
|
|
|
|
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
|
|
|
if (iy&1) { // Zig zag
|
|
|
ix = (MESH_NUM_X_POINTS - 1) - ix; |
|
|
ix = (MESH_NUM_X_POINTS - 1) - ix; |
|
|
} |
|
|
} |
|
|
current_position[X_AXIS] = mbl.get_x(ix); |
|
|
mbl.set_z(ix, iy, current_position[Z_AXIS]); |
|
|
current_position[Y_AXIS] = mbl.get_y(iy); |
|
|
_lcd_level_bed_position++; |
|
|
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); |
|
|
if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) { |
|
|
lcdDrawUpdate = 1; |
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; |
|
|
|
|
|
line_to_current(); |
|
|
|
|
|
mbl.active = 1; |
|
|
|
|
|
enquecommands_P(PSTR("G28")); |
|
|
|
|
|
lcd_return_to_status(); |
|
|
|
|
|
} else { |
|
|
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; |
|
|
|
|
|
line_to_current(); |
|
|
|
|
|
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); |
|
|
|
|
|
line_to_current(); |
|
|
|
|
|
lcdDrawUpdate = 1; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
debounce_click = false; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
debounce_click = false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
static void _lcd_level_bed_homing() |
|
|
static void _lcd_level_bed_homing() { |
|
|
{ |
|
|
if (axis_known_position[X_AXIS] && |
|
|
if (axis_known_position[X_AXIS] && |
|
|
axis_known_position[Y_AXIS] && |
|
|
axis_known_position[Y_AXIS] && |
|
|
axis_known_position[Z_AXIS]) { |
|
|
axis_known_position[Z_AXIS]) { |
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; |
|
|
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]); |
|
|
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[X_AXIS] = MESH_MIN_X; |
|
|
current_position[Y_AXIS] = MESH_MIN_Y; |
|
|
current_position[Y_AXIS] = MESH_MIN_Y; |
|
|
line_to_current(); |
|
|
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_level_bed_position = 0; |
|
|
lcd_goto_menu(_lcd_level_bed); |
|
|
lcd_goto_menu(_lcd_level_bed); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
static void lcd_level_bed() { |
|
|
static void lcd_level_bed() { |
|
|
axis_known_position[X_AXIS] = false; |
|
|
axis_known_position[X_AXIS] = false; |
|
|
axis_known_position[Y_AXIS] = false; |
|
|
axis_known_position[Y_AXIS] = false; |
|
|
axis_known_position[Z_AXIS] = false; |
|
|
axis_known_position[Z_AXIS] = false; |
|
|
mbl.reset(); |
|
|
mbl.reset(); |
|
|
enquecommands_P(PSTR("G28")); |
|
|
enquecommands_P(PSTR("G28")); |
|
|
lcd_goto_menu(_lcd_level_bed_homing); |
|
|
lcd_goto_menu(_lcd_level_bed_homing); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // MANUAL_BED_LEVELING
|
|
|
#endif // MANUAL_BED_LEVELING
|
|
|
|
|
|
|
|
|
#endif //ULTRA_LCD
|
|
|
#endif // ULTRA_LCD
|
|
|