UBL Mesh Wizard (#21556, #21791)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
Vert 2021-05-02 17:38:55 -04:00 committed by Scott Lahteine
parent 5cf0975913
commit 0b3420a012
7 changed files with 106 additions and 2 deletions

View File

@ -1491,6 +1491,8 @@
//#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used
// as the Z-Height correction value.
//#define UBL_MESH_WIZARD // Run several commands in a row to get a complete mesh
#elif ENABLED(MESH_BED_LEVELING)
//===========================================================================

View File

@ -35,6 +35,7 @@ unified_bed_leveling ubl;
#include "../../../module/planner.h"
#include "../../../module/motion.h"
#include "../../../module/probe.h"
#include "../../../module/temperature.h"
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
@ -254,4 +255,48 @@ bool unified_bed_leveling::sanity_check() {
return !!error_flag;
}
#if ENABLED(UBL_MESH_WIZARD)
/**
* M1004: UBL Mesh Wizard - One-click mesh creation with or without a probe
*/
void GcodeSuite::M1004() {
#define ALIGN_GCODE TERN(Z_STEPPER_AUTO_ALIGN, "G34", "")
#define PROBE_GCODE TERN(HAS_BED_PROBE, "G29P1\nG29P3", "G29P4R255")
#if HAS_HOTEND
if (parser.seenval('H')) { // Handle H# parameter to set Hotend temp
const celsius_t hotend_temp = parser.value_int(); // Marlin never sends itself F or K, always C
thermalManager.setTargetHotend(hotend_temp, 0);
thermalManager.wait_for_hotend(false);
}
#endif
#if HAS_HEATED_BED
if (parser.seenval('B')) { // Handle B# parameter to set Bed temp
const celsius_t bed_temp = parser.value_int(); // Marlin never sends itself F or K, always C
thermalManager.setTargetBed(bed_temp);
thermalManager.wait_for_bed(false);
}
#endif
process_subcommands_now_P(G28_STR); // Home
process_subcommands_now_P(PSTR(ALIGN_GCODE "\n" // Align multi z axis if available
PROBE_GCODE "\n" // Build mesh with available hardware
"G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice
if (parser.seenval('S')) {
char umw_gcode[32];
sprintf_P(umw_gcode, PSTR("G29S%i"), parser.value_int());
queue.inject(umw_gcode);
}
process_subcommands_now_P(PSTR("G29A\nG29F10\n" // Set UBL Active & Fade 10
"M140S0\nM104S0\n" // Turn off heaters
"M500")); // Store settings
}
#endif // UBL_MESH_WIZARD
#endif // AUTO_BED_LEVELING_UBL

View File

@ -987,6 +987,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 1002: M1002(); break; // M1002: [INTERNAL] Tool-change and Relative E Move
#endif
#if ENABLED(UBL_MESH_WIZARD)
case 1004: M1004(); break; // M1004: UBL Mesh Wizard
#endif
#if ENABLED(MAX7219_GCODE)
case 7219: M7219(); break; // M7219: Set LEDs, columns, and rows
#endif

View File

@ -1079,6 +1079,10 @@ private:
static void M1002();
#endif
#if ENABLED(UBL_MESH_WIZARD)
static void M1004();
#endif
#if ENABLED(MAX7219_GCODE)
static void M7219();
#endif

View File

@ -166,6 +166,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_UBL_LEVEL_BED = _UxGT("Unified Bed Leveling");
PROGMEM Language_Str MSG_LCD_TILTING_MESH = _UxGT("Tilting Point");
PROGMEM Language_Str MSG_UBL_MANUAL_MESH = _UxGT("Manually Build Mesh");
PROGMEM Language_Str MSG_UBL_MESH_WIZARD = _UxGT("UBL Mesh Wizard");
PROGMEM Language_Str MSG_UBL_BC_INSERT = _UxGT("Place Shim & Measure");
PROGMEM Language_Str MSG_UBL_BC_INSERT2 = _UxGT("Measure");
PROGMEM Language_Str MSG_UBL_BC_REMOVE = _UxGT("Remove & Measure Bed");

View File

@ -37,7 +37,7 @@
#include "../../feature/bedlevel/bedlevel.h"
static int16_t ubl_storage_slot = 0,
custom_hotend_temp = 190,
custom_hotend_temp = 150,
side_points = 3,
ubl_fillin_amount = 5,
ubl_height_amount = 1;
@ -603,6 +603,51 @@ void _menu_ubl_tools() {
#endif
#if ENABLED(UBL_MESH_WIZARD)
/**
* UBL Mesh Wizard - One-click mesh creation with or without a probe
*/
void _lcd_ubl_mesh_wizard() {
char ubl_lcd_gcode[30];
#if HAS_HEATED_BED && HAS_HOTEND
sprintf_P(ubl_lcd_gcode, PSTR("M1004B%iH%iS%i"), custom_bed_temp, custom_hotend_temp, ubl_storage_slot);
#elif HAS_HOTEND
sprintf_P(ubl_lcd_gcode, PSTR("M1004H%iS%i"), custom_hotend_temp, ubl_storage_slot);
#else
sprintf_P(ubl_lcd_gcode, PSTR("M1004S%i"), ubl_storage_slot);
#endif
queue.inject(ubl_lcd_gcode);
ui.return_to_status();
}
void _menu_ubl_mesh_wizard() {
const int16_t total_slots = settings.calc_num_meshes();
START_MENU();
BACK_ITEM(MSG_UBL_LEVEL_BED);
#if HAS_HOTEND
EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, HEATER_0_MINTEMP + 20, thermalManager.hotend_max_target(0));
#endif
#if HAS_HEATED_BED
EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP + 20, BED_MAX_TARGET);
#endif
EDIT_ITEM(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, total_slots);
ACTION_ITEM(MSG_UBL_MESH_WIZARD, _lcd_ubl_mesh_wizard);
#if ENABLED(G26_MESH_VALIDATION)
SUBMENU(MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
#endif
ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status);
END_MENU();
}
#endif
/**
* UBL System submenu
*
@ -626,6 +671,9 @@ void _lcd_ubl_level_bed() {
#if ENABLED(G26_MESH_VALIDATION)
SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
#endif
#if ENABLED(UBL_MESH_WIZARD)
SUBMENU(MSG_UBL_MESH_WIZARD, _menu_ubl_mesh_wizard);
#endif
ACTION_ITEM(MSG_UBL_MESH_EDIT, _ubl_goto_map_screen);
SUBMENU(MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);

View File

@ -24,7 +24,7 @@ opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \
L6470_CHAIN_SCK_PIN 53 L6470_CHAIN_MISO_PIN 49 L6470_CHAIN_MOSI_PIN 40 L6470_CHAIN_SS_PIN 42 \
'ENABLE_RESET_L64XX_CHIPS(V)' NOOP
opt_enable RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS EEPROM_CHITCHAT \
Z_PROBE_ALLEN_KEY AUTO_BED_LEVELING_UBL \
Z_PROBE_ALLEN_KEY AUTO_BED_LEVELING_UBL UBL_MESH_WIZARD \
OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY DELTA_CALIBRATION_MENU
exec_test $1 $2 "DELTA, RAMPS, L6470, UBL, Allen Key, EEPROM, OLED_PANEL_TINYBOY2..." "$3"