Clean up LCD Manual Move / UBL Mesh Edit (#18373)

This commit is contained in:
Scott Lahteine
2020-07-03 09:53:22 -05:00
committed by GitHub
parent 2c15a787c7
commit f6a2b64091
14 changed files with 265 additions and 208 deletions

View File

@ -84,11 +84,7 @@
_GRIDPOS(Y, 12), _GRIDPOS(Y, 13), _GRIDPOS(Y, 14), _GRIDPOS(Y, 15)
);
#if HAS_LCD_MENU
bool unified_bed_leveling::lcd_map_control = false;
#endif
volatile int unified_bed_leveling::encoder_diff;
volatile int16_t unified_bed_leveling::encoder_diff;
unified_bed_leveling::unified_bed_leveling() {
reset();

View File

@ -111,9 +111,12 @@ class unified_bed_leveling {
#if HAS_LCD_MENU
static bool lcd_map_control;
static void steppers_were_disabled();
#else
static inline void steppers_were_disabled() {}
#endif
static volatile int encoder_diff; // Volatile because it's changed at interrupt time.
static volatile int16_t encoder_diff; // Volatile because buttons may changed it at interrupt time
unified_bed_leveling();

View File

@ -54,7 +54,18 @@
#define UBL_G29_P31
#if HAS_LCD_MENU
void _lcd_ubl_output_map_lcd();
bool unified_bed_leveling::lcd_map_control = false;
void unified_bed_leveling::steppers_were_disabled() {
if (lcd_map_control) {
lcd_map_control = false;
ui.defer_status_screen(false);
}
}
void ubl_map_screen();
#endif
#define SIZE_OF_LITTLE_RAISE 1
@ -789,11 +800,11 @@
bool click_and_hold(const clickFunc_t func=nullptr) {
if (ui.button_pressed()) {
ui.quick_feedback(false); // Preserve button state for click-and-hold
ui.quick_feedback(false); // Preserve button state for click-and-hold
const millis_t nxt = millis() + 1500UL;
while (ui.button_pressed()) { // Loop while the encoder is pressed. Uses hardware flag!
idle(); // idle, of course
if (ELAPSED(millis(), nxt)) { // After 1.5 seconds
while (ui.button_pressed()) { // Loop while the encoder is pressed. Uses hardware flag!
idle(); // idle, of course
if (ELAPSED(millis(), nxt)) { // After 1.5 seconds
ui.quick_feedback();
if (func) (*func)();
ui.wait_for_release();
@ -995,9 +1006,9 @@
lcd_mesh_edit_setup(new_z);
do {
idle();
new_z = lcd_mesh_edit();
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset + new_z)); // Move the nozzle as the point is edited
idle();
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} while (!ui.button_pressed());
@ -1022,7 +1033,7 @@
SERIAL_ECHOLNPGM("Done Editing Mesh");
if (lcd_map_control)
ui.goto_screen(_lcd_ubl_output_map_lcd);
ui.goto_screen(ubl_map_screen);
else
ui.return_to_status();
}