Add a mesh edit menu for MBL / ABL-Bilinear

This commit is contained in:
KangDroid 2018-06-06 11:57:25 +09:00 committed by Scott Lahteine
parent 44fa7fb18c
commit 82ff7c6542
6 changed files with 44 additions and 8 deletions

View File

@ -1173,8 +1173,9 @@
//#define LCD_BED_LEVELING //#define LCD_BED_LEVELING
#if ENABLED(LCD_BED_LEVELING) #if ENABLED(LCD_BED_LEVELING)
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis.
#define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment
//#define MESH_EDIT_MENU // Add a menu to edit mesh points
#endif #endif
// Add a menu item to move between bed corners for manual bed adjustment // Add a menu item to move between bed corners for manual bed adjustment

View File

@ -1173,8 +1173,9 @@
//#define LCD_BED_LEVELING //#define LCD_BED_LEVELING
#if ENABLED(LCD_BED_LEVELING) #if ENABLED(LCD_BED_LEVELING)
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis.
#define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment
//#define MESH_EDIT_MENU // Add a menu to edit mesh points
#endif #endif
// Add a menu item to move between bed corners for manual bed adjustment // Add a menu item to move between bed corners for manual bed adjustment

View File

@ -319,6 +319,8 @@
#error "SWITCHING_TOOLHEAD_SECURITY_RAISE is now TOOLCHANGE_ZRAISE. Please update your configuration." #error "SWITCHING_TOOLHEAD_SECURITY_RAISE is now TOOLCHANGE_ZRAISE. Please update your configuration."
#elif defined(G0_FEEDRATE) && G0_FEEDRATE == 0 #elif defined(G0_FEEDRATE) && G0_FEEDRATE == 0
#error "G0_FEEDRATE is now used to set the G0 feedrate. Please update your configuration." #error "G0_FEEDRATE is now used to set the G0 feedrate. Please update your configuration."
#elif defined(MBL_Z_STEP)
#error "MBL_Z_STEP is now MESH_EDIT_Z_STEP. Please update your configuration."
#endif #endif
#define BOARD_MKS_13 -47 #define BOARD_MKS_13 -47

View File

@ -192,6 +192,15 @@
#ifndef MSG_EDITING_STOPPED #ifndef MSG_EDITING_STOPPED
#define MSG_EDITING_STOPPED _UxGT("Mesh Editing Stopped") #define MSG_EDITING_STOPPED _UxGT("Mesh Editing Stopped")
#endif #endif
#ifndef MSG_MESH_X
#define MSG_MESH_X _UxGT("Index X")
#endif
#ifndef MSG_MESH_Y
#define MSG_MESH_Y _UxGT("Index Y")
#endif
#ifndef MSG_MESH_EDIT_Z
#define MSG_MESH_EDIT_Z _UxGT("Z Value")
#endif
#ifndef MSG_USER_MENU #ifndef MSG_USER_MENU
#define MSG_USER_MENU _UxGT("Custom Commands") #define MSG_USER_MENU _UxGT("Custom Commands")
#endif #endif

View File

@ -120,7 +120,7 @@
// Encoder knob or keypad buttons adjust the Z position // Encoder knob or keypad buttons adjust the Z position
// //
if (encoderPosition) { if (encoderPosition) {
const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MBL_Z_STEP); const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MESH_EDIT_Z_STEP);
line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f)); line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f));
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
encoderPosition = 0; encoderPosition = 0;
@ -199,6 +199,25 @@
#endif // PROBE_MANUALLY || MESH_BED_LEVELING #endif // PROBE_MANUALLY || MESH_BED_LEVELING
#if ENABLED(MESH_EDIT_MENU)
inline void refresh_planner() {
set_current_from_steppers_for_axis(ALL_AXES);
sync_plan_position();
}
void menu_mbl_edit_mesh() {
static uint8_t xind, yind; // =0
START_MENU();
MENU_BACK(MSG_BED_LEVELING);
MENU_ITEM_EDIT(int8, MSG_MESH_X, &xind, 0, GRID_MAX_POINTS_X - 1);
MENU_ITEM_EDIT(int8, MSG_MESH_Y, &yind, 0, GRID_MAX_POINTS_Y - 1);
MENU_ITEM_EDIT_CALLBACK(float43, MSG_MESH_EDIT_Z, &Z_VALUES(xind, yind), -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5, refresh_planner);
END_MENU();
}
#endif // MESH_EDIT_MENU
/** /**
* Step 1: Bed Level entry-point * Step 1: Bed Level entry-point
* *
@ -233,6 +252,10 @@ void menu_bed_leveling() {
MENU_ITEM(gcode, MSG_LEVEL_BED, is_homed ? PSTR("G29") : PSTR("G28\nG29")); MENU_ITEM(gcode, MSG_LEVEL_BED, is_homed ? PSTR("G29") : PSTR("G28\nG29"));
#endif #endif
#if ENABLED(MESH_EDIT_MENU)
MENU_ITEM(submenu, MSG_EDIT_MESH, menu_mbl_edit_mesh);
#endif
// Homed and leveling is valid? Then leveling can be toggled. // Homed and leveling is valid? Then leveling can be toggled.
if (is_homed && leveling_is_valid()) { if (is_homed && leveling_is_valid()) {
bool new_level_state = planner.leveling_active; bool new_level_state = planner.leveling_active;
@ -245,7 +268,7 @@ void menu_bed_leveling() {
#endif #endif
// //
// MBL Z Offset // Mesh Bed Leveling 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);

View File

@ -84,7 +84,7 @@ exec_test $1 $2 "RAMPS with Servo Probe, 3-Point ABL, DEBUG_LEVELING_FEATURE, EE
# Test MESH_BED_LEVELING feature, with LCD # Test MESH_BED_LEVELING feature, with LCD
# #
restore_configs restore_configs
opt_enable MESH_BED_LEVELING G26_MESH_EDITING MESH_G28_REST_ORIGIN LCD_BED_LEVELING ULTIMAKERCONTROLLER opt_enable MESH_BED_LEVELING G26_MESH_EDITING MESH_G28_REST_ORIGIN LCD_BED_LEVELING MESH_EDIT_MENU ULTIMAKERCONTROLLER
exec_test $1 $2 "MESH_BED_LEVELING feature, with LCD" exec_test $1 $2 "MESH_BED_LEVELING feature, with LCD"
# #
@ -92,7 +92,7 @@ exec_test $1 $2 "MESH_BED_LEVELING feature, with LCD"
# #
restore_configs restore_configs
opt_set MOTHERBOARD BOARD_MINIRAMBO opt_set MOTHERBOARD BOARD_MINIRAMBO
opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR G26_MESH_EDITING LCD_BED_LEVELING \ opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR G26_MESH_EDITING LCD_BED_LEVELING MESH_EDIT_MENU \
EEPROM_SETTINGS EEPROM_CHITCHAT \ EEPROM_SETTINGS EEPROM_CHITCHAT \
M100_FREE_MEMORY_WATCHER M100_FREE_MEMORY_DUMPER M100_FREE_MEMORY_CORRUPTOR \ M100_FREE_MEMORY_WATCHER M100_FREE_MEMORY_DUMPER M100_FREE_MEMORY_CORRUPTOR \
INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \