Merge pull request #7098 from thinkyhead/bf_ubl_steps

Step-by-Step Menu addition
This commit is contained in:
Scott Lahteine 2017-06-19 23:12:52 -05:00 committed by GitHub
commit d5368461f9
4 changed files with 138 additions and 80 deletions

View file

@ -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...")

View file

@ -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();
@ -2302,63 +2369,43 @@ void kill_screen(const char* lcd_msg) {
END_MENU();
}
/**
* 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();
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
*
* Prepare
* - Unified Bed Leveling
* - Manually Build Mesh
* - Activate UBL
* - Deactivate UBL
* - 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() {
@ -2367,6 +2414,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);
@ -3263,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();

View file

@ -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);
}
}

View file

@ -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);
}
}