Group UBL parameters, add comments
This commit is contained in:
committed by
Scott Lahteine
parent
6b7a92035c
commit
af13128430
@@ -85,11 +85,6 @@
|
||||
typedef void (*screenFunc_t)();
|
||||
typedef void (*menuAction_t)();
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
void lcd_mesh_edit_setup(const float &initial);
|
||||
float lcd_mesh_edit();
|
||||
#endif
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
#endif // HAS_WIRED_LCD
|
||||
@@ -488,6 +483,11 @@ public:
|
||||
static void ubl_plot(const uint8_t x_plot, const uint8_t y_plot);
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
static void ubl_mesh_edit_start(const float &initial);
|
||||
static float ubl_mesh_value();
|
||||
#endif
|
||||
|
||||
static void draw_select_screen_prompt(PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr);
|
||||
|
||||
#elif HAS_WIRED_LCD
|
||||
|
@@ -56,12 +56,24 @@ inline float rounded_mesh_value() {
|
||||
return float(rounded - (rounded % 5L)) / 1000;
|
||||
}
|
||||
|
||||
static void _lcd_mesh_fine_tune(PGM_P const msg) {
|
||||
/**
|
||||
* This screen displays the temporary mesh value and updates it based on encoder
|
||||
* movement. While this screen is active ubl.fine_tune_mesh sits in a loop getting
|
||||
* the current value via ubl_mesh_value, moves the Z axis, and updates the mesh
|
||||
* value until the encoder button is pressed.
|
||||
*
|
||||
* - Update the 'mesh_edit_accumulator' from encoder rotation
|
||||
* - Draw the mesh value (with draw_edit_screen)
|
||||
* - Draw the graphical overlay, if enabled.
|
||||
* - Update the 'refresh' state according to the display type
|
||||
*/
|
||||
void _lcd_mesh_fine_tune(PGM_P const msg) {
|
||||
constexpr float mesh_edit_step = 1.0f / 200.0f;
|
||||
ui.defer_status_screen();
|
||||
if (ubl.encoder_diff) {
|
||||
mesh_edit_accumulator += TERN(IS_TFTGLCD_PANEL,
|
||||
ubl.encoder_diff * 0.005f / ENCODER_PULSES_PER_STEP,
|
||||
ubl.encoder_diff > 0 ? 0.005f : -0.005f
|
||||
ubl.encoder_diff * mesh_edit_step / ENCODER_PULSES_PER_STEP,
|
||||
ubl.encoder_diff > 0 ? mesh_edit_step : -mesh_edit_step
|
||||
);
|
||||
ubl.encoder_diff = 0;
|
||||
IF_DISABLED(IS_TFTGLCD_PANEL, ui.refresh(LCDVIEW_CALL_REDRAW_NEXT));
|
||||
@@ -77,29 +89,19 @@ static void _lcd_mesh_fine_tune(PGM_P const msg) {
|
||||
}
|
||||
|
||||
//
|
||||
// Called external to the menu system to acquire the result of an edit.
|
||||
// Init mesh editing and go to the fine tuning screen (ubl.fine_tune_mesh)
|
||||
// To capture encoder events UBL will also call ui.capture and ui.release.
|
||||
//
|
||||
float lcd_mesh_edit() { return rounded_mesh_value(); }
|
||||
|
||||
void lcd_mesh_edit_setup(const float &initial) {
|
||||
TERN_(HAS_GRAPHICAL_TFT, ui.clear_lcd());
|
||||
void MarlinUI::ubl_mesh_edit_start(const float &initial) {
|
||||
TERN_(HAS_GRAPHICAL_TFT, clear_lcd());
|
||||
mesh_edit_accumulator = initial;
|
||||
ui.goto_screen([]{ _lcd_mesh_fine_tune(GET_TEXT(MSG_MESH_EDIT_Z)); });
|
||||
goto_screen([]{ _lcd_mesh_fine_tune(GET_TEXT(MSG_MESH_EDIT_Z)); });
|
||||
}
|
||||
|
||||
void _lcd_z_offset_edit() {
|
||||
_lcd_mesh_fine_tune(GET_TEXT(MSG_UBL_Z_OFFSET));
|
||||
}
|
||||
|
||||
float lcd_z_offset_edit() {
|
||||
ui.goto_screen(_lcd_z_offset_edit);
|
||||
return rounded_mesh_value();
|
||||
}
|
||||
|
||||
void lcd_z_offset_edit_setup(const float &initial) {
|
||||
mesh_edit_accumulator = initial;
|
||||
ui.goto_screen(_lcd_z_offset_edit);
|
||||
}
|
||||
//
|
||||
// Get the mesh value within a Z adjustment loop (ubl.fine_tune_mesh)
|
||||
//
|
||||
float MarlinUI::ubl_mesh_value() { return rounded_mesh_value(); }
|
||||
|
||||
/**
|
||||
* UBL Build Custom Mesh Command
|
||||
|
Reference in New Issue
Block a user