From 90f5f82926a38451bc243fa7e72839b9d0575426 Mon Sep 17 00:00:00 2001 From: Tannoo Date: Mon, 5 Jun 2017 22:03:22 -0600 Subject: [PATCH 1/4] Step-by-Step Menu addition --- Marlin/language_en.h | 3 +++ Marlin/ultralcd.cpp | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Marlin/language_en.h b/Marlin/language_en.h index 17d7e77d2..e18812f7c 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -334,6 +334,9 @@ #ifndef MSG_UBL_Z_OFFSET_STOPPED #define MSG_UBL_Z_OFFSET_STOPPED _UxGT("Z-Offset Stopped") #endif +#ifndef MSG_UBL_STEP_BY_STEP_MENU + #define MSG_UBL_STEP_BY_STEP_MENU _UxGT("Step-By-Step UBL") +#endif #ifndef MSG_MOVING #define MSG_MOVING _UxGT("Moving...") diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index fe90b3734..b5283f821 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2302,6 +2302,22 @@ void kill_screen(const char* lcd_msg) { END_MENU(); } + /** + * UBL Step-By-Step submenu + */ + void _lcd_ubl_step_by_step() { + START_MENU(); + MENU_BACK(MSG_UBL_LEVEL_BED); + MENU_ITEM(gcode, "1 " MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1")); + MENU_ITEM(function, "2 " MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd); + MENU_ITEM(submenu, "3 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + MENU_ITEM(gcode, "4 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); + MENU_ITEM(submenu, "5 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + MENU_ITEM(gcode, "6 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); + MENU_ITEM(function, "7 " MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd); + END_MENU(); + } + /** * UBL System submenu * @@ -2310,6 +2326,26 @@ void kill_screen(const char* lcd_msg) { * - Manually Build Mesh * - Activate UBL * - Deactivate UBL + * - Step-By-Step UBL + * 1 Build Cold Mesh + * 2 Smart Fill-in + * - 3 Validate Mesh + * PLA Mesh Validation + * ABS Mesh Validation + * - Custom Mesh Validation + * Hotend Temp: + * Bed Temp: + * Validate Mesh + * 4 Fine Tune All + * - 5 Validate Mesh + * PLA Mesh Validation + * ABS Mesh Validation + * - Custom Mesh Validation + * Hotend Temp: + * Bed Temp: + * Validate Mesh + * 6 Fine Tune All + * 7 Save Bed Mesh * - Mesh Storage * Memory Slot: * Load Bed Mesh @@ -2367,6 +2403,7 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM(gcode, MSG_UBL_MANUAL_MESH, PSTR("G29 I999\nG29 P2 B T0")); MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); + MENU_ITEM(submenu, MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu); From 499bb85a9560a0009a4f32b603712f61a926b284 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 19 Jun 2017 21:37:21 -0500 Subject: [PATCH 2/4] Clean up, put ubl menu itemization closer at hand --- Marlin/ultralcd.cpp | 177 +++++++++++++++++++++++--------------------- 1 file changed, 94 insertions(+), 83 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index b5283f821..4adca82cc 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1754,15 +1754,16 @@ void kill_screen(const char* lcd_msg) { /** * Step 1: Bed Level entry-point - * - Cancel - * - Auto Home (if homing needed) - * - Leveling On/Off (if data exists, and homed) - * - Level Bed > - * - Fade Height (Req: ENABLE_LEVELING_FADE_HEIGHT) - * - Mesh Z Offset (Req: MESH_BED_LEVELING) - * - Z Probe Offset (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) - * - Load Settings (Req: EEPROM_SETTINGS) - * - Save Settings (Req: EEPROM_SETTINGS) + * + * << Prepare + * Auto Home (if homing needed) + * Leveling On/Off (if data exists, and homed) + * Level Bed + * Fade Height: --- (Req: ENABLE_LEVELING_FADE_HEIGHT) + * Mesh Z Offset: --- (Req: MESH_BED_LEVELING) + * Z Probe Offset: --- (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) + * Load Settings (Req: EEPROM_SETTINGS) + * Save Settings (Req: EEPROM_SETTINGS) */ void lcd_bed_leveling() { START_MENU(); @@ -1833,6 +1834,11 @@ void kill_screen(const char* lcd_msg) { /** * UBL Custom Mesh submenu + * + * << Build Mesh + * Hotend Temp: --- + * Bed Temp: --- + * Build Custom Mesh */ void _lcd_ubl_custom_mesh() { START_MENU(); @@ -1858,6 +1864,11 @@ void kill_screen(const char* lcd_msg) { /** * UBL Adjust Mesh Height submenu + * + * << Edit Mesh + * Height Amount: --- + * Adjust Mesh Height + * << Info Screen */ void _lcd_ubl_height_adjust_menu() { START_MENU(); @@ -1870,6 +1881,12 @@ void kill_screen(const char* lcd_msg) { /** * UBL Edit Mesh submenu + * + * << UBL Tools + * Fine Tune All + * Fine Tune Closest + * - Adjust Mesh Height >> + * << Info Screen */ void _lcd_ubl_edit_mesh() { START_MENU(); @@ -1899,6 +1916,12 @@ void kill_screen(const char* lcd_msg) { /** * UBL Validate Mesh submenu + * + * << UBL Tools + * PLA Mesh Validation + * ABS Mesh Validation + * Validate Custom Mesh + * << Info Screen */ void _lcd_ubl_validate_mesh() { START_MENU(); @@ -1926,6 +1949,10 @@ void kill_screen(const char* lcd_msg) { /** * UBL Grid Leveling submenu + * + * << UBL Tools + * Side points: --- + * Level Mesh */ void _lcd_ubl_grid_level() { START_MENU(); @@ -1937,6 +1964,11 @@ void kill_screen(const char* lcd_msg) { /** * UBL Mesh Leveling submenu + * + * << UBL Tools + * 3-Point Mesh Leveling + * - Grid Mesh Leveling >> + * << Info Screen */ void _lcd_ubl_mesh_leveling() { START_MENU(); @@ -1967,6 +1999,13 @@ void kill_screen(const char* lcd_msg) { /** * UBL Fill-in Mesh submenu + * + * << Build Mesh + * Fill-in Amount: --- + * Fill-in Mesh + * Smart Fill-in + * Manual Fill-in + * << Info Screen */ void _lcd_ubl_fillin_menu() { START_MENU(); @@ -1986,6 +2025,17 @@ void kill_screen(const char* lcd_msg) { /** * UBL Build Mesh submenu + * + * << UBL Tools + * Build PLA Mesh + * Build ABS Mesh + * - Build Custom Mesh >> + * Build Cold Mesh + * - Fill-in Mesh >> + * Continue Bed Mesh + * Invalidate All + * Invalidate Closest + * << Info Screen */ void _lcd_ubl_build_mesh() { START_MENU(); @@ -2051,6 +2101,11 @@ void kill_screen(const char* lcd_msg) { /** * UBL Mesh Storage submenu + * + * << Unified Bed Leveling + * Memory Slot: --- + * Load Bed Mesh + * Save Bed Mesh */ void _lcd_ubl_storage_mesh() { START_MENU(); @@ -2278,6 +2333,12 @@ void kill_screen(const char* lcd_msg) { /** * UBL Output map submenu + * + * << Unified Bed Leveling + * Output for Host + * Output for CSV + * Off Printer Backup + * Output Mesh Map */ void _lcd_ubl_output_map() { START_MENU(); @@ -2291,6 +2352,12 @@ void kill_screen(const char* lcd_msg) { /** * UBL Tools submenu + * + * << Unified Bed Leveling + * - Build Mesh >> + * - Validate Mesh >> + * - Edit Mesh >> + * - Mesh Leveling >> */ void _lcd_ubl_tools_menu() { START_MENU(); @@ -2304,6 +2371,15 @@ void kill_screen(const char* lcd_msg) { /** * UBL Step-By-Step submenu + * + * << Unified Bed Leveling + * 1 Build Cold Mesh + * 2 Smart Fill-in + * - 3 Validate Mesh >> + * 4 Fine Tune All + * - 5 Validate Mesh >> + * 6 Fine Tune All + * 7 Save Bed Mesh */ void _lcd_ubl_step_by_step() { START_MENU(); @@ -2321,80 +2397,15 @@ void kill_screen(const char* lcd_msg) { /** * UBL System submenu * - * Prepare - * - Unified Bed Leveling - * - Manually Build Mesh - * - Activate UBL - * - Deactivate UBL - * - Step-By-Step UBL - * 1 Build Cold Mesh - * 2 Smart Fill-in - * - 3 Validate Mesh - * PLA Mesh Validation - * ABS Mesh Validation - * - Custom Mesh Validation - * Hotend Temp: - * Bed Temp: - * Validate Mesh - * 4 Fine Tune All - * - 5 Validate Mesh - * PLA Mesh Validation - * ABS Mesh Validation - * - Custom Mesh Validation - * Hotend Temp: - * Bed Temp: - * Validate Mesh - * 6 Fine Tune All - * 7 Save Bed Mesh - * - Mesh Storage - * Memory Slot: - * Load Bed Mesh - * Save Bed Mesh - * - Output Map - * Topography to Host - * CSV for Spreadsheet - * Mesh Output Backup - * Output to LCD Grid - * - UBL Tools - * - Build Mesh - * Build PLA Mesh - * Build ABS Mesh - * - Build Custom Mesh - * Hotend Temp: - * Bed Temp: - * Build Custom Mesh - * Info Screen - * - Build Cold Mesh - * - Fill-in Mesh - * Fill-in Mesh - * Smart Fill-in - * Manual Fill-in - * Info Screen - * Continue Bed Mesh - * Invalidate All - * Invalidate Closest - * - Validate Mesh - * PLA Mesh Validation - * ABS Mesh Validation - * - Custom Mesh Validation - * Hotend Temp: - * Bed Temp: - * Validate Mesh - * Info Screen - * - Edit Mesh - * Fine Tune All - * Fine Tune Closest - * - Adjust Mesh Height - * Height Amount: - * Adjust Mesh Height - * Info Screen - * - Mesh Leveling - * 3-Point Mesh Leveling - * - Grid Mesh Leveling - * Side points: - * Level Mesh - * Info Screen - * - Output UBL Info + * << Prepare + * - Manually Build Mesh >> + * - Activate UBL >> + * - Deactivate UBL >> + * - Step-By-Step UBL >> + * - Mesh Storage >> + * - Output Map >> + * - UBL Tools >> + * - Output UBL Info >> */ void _lcd_ubl_level_bed() { From 725d9d9a56d9cfdf720a739eae56fb7c38f7696e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 19 Jun 2017 21:53:06 -0500 Subject: [PATCH 3/4] Fix and improve LCD value editing display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix: When "100.0" changes to "99.0" the LCD shows "199.0" - Use 2 rows if needed on character LCD, (allowing longer labels… Germany, et. al.) - Known issue: A certain length label combined with a certain value drawing function could, for example, display 99.0 on 1 line, but 100.0 on two lines. Workaround would be to pass a nominal value size argument. --- Marlin/ultralcd_impl_DOGM.h | 17 +++++++++++------ Marlin/ultralcd_impl_HD44780.h | 4 +++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index 5ffe11020..b7a000229 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -871,7 +871,7 @@ static void lcd_implementation_status_screen() { #if ENABLED(USE_BIG_EDIT_FONT) uint8_t lcd_width, char_width; if (labellen <= LCD_WIDTH_EDIT - 1) { - if (labellen >= LCD_WIDTH_EDIT - vallen) rows = 2; + if (labellen + vallen + 2 >= LCD_WIDTH_EDIT) rows = 2; lcd_width = LCD_WIDTH_EDIT + 1; char_width = DOG_CHAR_WIDTH_EDIT; lcd_setFont(FONT_MENU_EDIT); @@ -890,16 +890,21 @@ static void lcd_implementation_status_screen() { const uint8_t segmentHeight = u8g.getHeight() / (rows + 1); // 1 / (rows+1) = 1/2 or 1/3 uint8_t baseline = segmentHeight + (DOG_CHAR_HEIGHT_EDIT + 1) / 2; - if (PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline)) { + bool onpage = PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline); + if (onpage) { u8g.setPrintPos(0, baseline); lcd_printPGM(pstr); } if (value != NULL) { - baseline += (rows - 1) * segmentHeight; - if (PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline)) { - u8g.print(':'); - u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, baseline); + u8g.print(':'); + if (rows == 2) { + baseline += segmentHeight; + onpage = PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline); + } + if (onpage) { + u8g.setPrintPos(((lcd_width - 1) - (vallen + 1)) * char_width, baseline); // Right-justified, leaving padded by spaces + u8g.print(' '); // overwrite char if value gets shorter lcd_print(value); } } diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index 65ad28165..9ec03f0c8 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -978,7 +978,9 @@ static void lcd_implementation_status_screen() { lcd_printPGM(pstr); if (value != NULL) { lcd.print(':'); - lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1); + const uint8_t valrow = (lcd_strlen_P(pstr) + 1 + lcd_strlen(value) + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit + lcd.setCursor((LCD_WIDTH - 1) - (lcd_strlen(value) + 1), valrow); // Right-justified, padded by spaces + lcd.print(' '); // overwrite char if value gets shorter lcd_print(value); } } From 8a51e2960cd86b0087cfedd4e23f76ad03aadb67 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 19 Jun 2017 21:53:26 -0500 Subject: [PATCH 4/4] Improve the experience of editing steps_per_mm --- Marlin/ultralcd.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 4adca82cc..dc9096702 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -3311,25 +3311,25 @@ void kill_screen(const char* lcd_msg) { START_MENU(); MENU_BACK(MSG_MOTION); - MENU_ITEM_EDIT_CALLBACK(float62, MSG_XSTEPS, &planner.axis_steps_per_mm[X_AXIS], 5, 9999, _planner_refresh_positioning); - MENU_ITEM_EDIT_CALLBACK(float62, MSG_YSTEPS, &planner.axis_steps_per_mm[Y_AXIS], 5, 9999, _planner_refresh_positioning); - MENU_ITEM_EDIT_CALLBACK(float62, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_XSTEPS, &planner.axis_steps_per_mm[X_AXIS], 5, 9999, _planner_refresh_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_YSTEPS, &planner.axis_steps_per_mm[Y_AXIS], 5, 9999, _planner_refresh_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning); #if ENABLED(DISTINCT_E_FACTORS) - MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS + active_extruder], 5, 9999, _planner_refresh_positioning); - MENU_ITEM_EDIT_CALLBACK(float62, MSG_E1STEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_e0_positioning); - MENU_ITEM_EDIT_CALLBACK(float62, MSG_E2STEPS, &planner.axis_steps_per_mm[E_AXIS + 1], 5, 9999, _planner_refresh_e1_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS + active_extruder], 5, 9999, _planner_refresh_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E1STEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_e0_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E2STEPS, &planner.axis_steps_per_mm[E_AXIS + 1], 5, 9999, _planner_refresh_e1_positioning); #if E_STEPPERS > 2 - MENU_ITEM_EDIT_CALLBACK(float62, MSG_E3STEPS, &planner.axis_steps_per_mm[E_AXIS + 2], 5, 9999, _planner_refresh_e2_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E3STEPS, &planner.axis_steps_per_mm[E_AXIS + 2], 5, 9999, _planner_refresh_e2_positioning); #if E_STEPPERS > 3 - MENU_ITEM_EDIT_CALLBACK(float62, MSG_E4STEPS, &planner.axis_steps_per_mm[E_AXIS + 3], 5, 9999, _planner_refresh_e3_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E4STEPS, &planner.axis_steps_per_mm[E_AXIS + 3], 5, 9999, _planner_refresh_e3_positioning); #if E_STEPPERS > 4 - MENU_ITEM_EDIT_CALLBACK(float62, MSG_E5STEPS, &planner.axis_steps_per_mm[E_AXIS + 4], 5, 9999, _planner_refresh_e4_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E5STEPS, &planner.axis_steps_per_mm[E_AXIS + 4], 5, 9999, _planner_refresh_e4_positioning); #endif // E_STEPPERS > 4 #endif // E_STEPPERS > 3 #endif // E_STEPPERS > 2 #else - MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); #endif END_MENU();