diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 9ff3d71d4..17b93efae 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8414,7 +8414,7 @@ inline void gcode_M18_M84() { } #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) // Only needed with an LCD - ubl_lcd_map_control = defer_return_to_status = false; + ubl.lcd_map_control = defer_return_to_status = false; #endif } } @@ -13483,7 +13483,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { disable_e_steppers(); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) // Only needed with an LCD - ubl_lcd_map_control = defer_return_to_status = false; + ubl.lcd_map_control = defer_return_to_status = false; #endif } diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 90e46ac83..d6cc306ac 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -54,6 +54,10 @@ #include "cardreader.h" #include "speed_lookuptable.h" +#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL) + #include "ubl.h" +#endif + #if HAS_DIGIPOTSS #include #endif @@ -62,10 +66,6 @@ Stepper stepper; // Singleton // public: -#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL) - extern bool ubl_lcd_map_control; -#endif - block_t* Stepper::current_block = NULL; // A pointer to the block currently being traced #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) @@ -1224,7 +1224,7 @@ void Stepper::finish_and_disable() { void Stepper::quick_stop() { #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL) - if (!ubl_lcd_map_control) + if (!ubl.lcd_map_control) cleaning_buffer_counter = 5000; #else cleaning_buffer_counter = 5000; diff --git a/Marlin/ubl.cpp b/Marlin/ubl.cpp index 86d1cf817..0f7b3b4f8 100644 --- a/Marlin/ubl.cpp +++ b/Marlin/ubl.cpp @@ -73,6 +73,10 @@ bool unified_bed_leveling::g26_debug_flag = false, unified_bed_leveling::has_control_of_lcd_panel = false; + #if ENABLED(ULTIPANEL) + bool unified_bed_leveling::lcd_map_control = false; + #endif + volatile int unified_bed_leveling::encoder_diff; unified_bed_leveling::unified_bed_leveling() { diff --git a/Marlin/ubl.h b/Marlin/ubl.h index 9e963b0ac..9f949bc39 100644 --- a/Marlin/ubl.h +++ b/Marlin/ubl.h @@ -46,9 +46,9 @@ // ubl.cpp -void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y); -void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y); -bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y); + void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y); + void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y); + bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y); // ubl_motion.cpp @@ -191,6 +191,10 @@ bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y); static bool g26_debug_flag, has_control_of_lcd_panel; + #if ENABLED(ULTIPANEL) + static bool lcd_map_control; + #endif + static volatile int encoder_diff; // Volatile because it's changed at interrupt time. unified_bed_leveling(); diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 9fd2e534d..471a7d475 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -1526,7 +1526,7 @@ idle(); } while (!ubl_lcd_clicked()); - if (!ubl_lcd_map_control) lcd_return_to_status(); + if (!lcd_map_control) lcd_return_to_status(); // The technique used here generates a race condition for the encoder click. // It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune) or here. @@ -1571,7 +1571,7 @@ LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH); SERIAL_ECHOLNPGM("Done Editing Mesh"); - if (ubl_lcd_map_control) + if (lcd_map_control) lcd_goto_screen(_lcd_ubl_output_map_lcd); else lcd_return_to_status(); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 6ae5d1ede..e30cfc672 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -50,7 +50,6 @@ #if ENABLED(AUTO_BED_LEVELING_UBL) #include "ubl.h" - bool ubl_lcd_map_control = false; #elif HAS_ABL #include "planner.h" #elif ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING) @@ -514,14 +513,14 @@ uint16_t max_display_update_time = 0; if (screen == lcd_status_screen) { defer_return_to_status = false; #if ENABLED(AUTO_BED_LEVELING_UBL) - ubl_lcd_map_control = false; + ubl.lcd_map_control = false; #endif screen_history_depth = 0; } lcd_implementation_clear(); // Re-initialize custom characters that may be re-used #if DISABLED(DOGLCD) && ENABLED(AUTO_BED_LEVELING_UBL) - if (!ubl_lcd_map_control) { + if (!ubl.lcd_map_control) { lcd_set_custom_characters( #if ENABLED(LCD_PROGRESS_BAR) screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU @@ -2358,7 +2357,7 @@ void kill_screen(const char* lcd_msg) { void _lcd_ubl_map_homing() { defer_return_to_status = true; - ubl_lcd_map_control = true; // Return to the map screen + ubl.lcd_map_control = true; // Return to the map screen if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT < 3 ? 0 : (LCD_HEIGHT > 4 ? 2 : 1), PSTR(MSG_LEVEL_BED_HOMING)); lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW; if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 611656320..db52bb0e6 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -193,7 +193,6 @@ void lcd_reset_status(); #if ENABLED(AUTO_BED_LEVELING_UBL) - extern bool ubl_lcd_map_control; void lcd_mesh_edit_setup(float initial); float lcd_mesh_edit(); void lcd_z_offset_edit_setup(float);