mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 07:17:59 +00:00
🚸 MarlinUI:: clear_for_drawing
This commit is contained in:
parent
bf1995140a
commit
1f9fc665ec
@ -1099,6 +1099,9 @@
|
||||
* - poweroff (for PSU_CONTROL and HAS_MARLINUI_MENU)
|
||||
*
|
||||
* ...and implements these MarlinUI methods:
|
||||
* - init_lcd
|
||||
* - clear_lcd
|
||||
* - clear_for_drawing
|
||||
* - zoffset_overlay (if BABYSTEP_GFX_OVERLAY or MESH_EDIT_GFX_OVERLAY are supported)
|
||||
* - draw_kill_screen
|
||||
* - kill_screen
|
||||
|
@ -557,8 +557,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_SD_DETECT && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2, HAS_U8GLIB_I2C_OLED)
|
||||
#define REINIT_NOISY_SPI_LCD 1 // Have LCDs with shared SPI re-init on SD insertion
|
||||
#if HAS_SD_DETECT && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2)
|
||||
#define REINIT_NOISY_LCD 1 // Have the LCD re-init on SD insertion
|
||||
#endif
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
|
@ -467,6 +467,7 @@ bool MarlinUI::detected() {
|
||||
#endif
|
||||
|
||||
void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
void MarlinUI::clear_for_drawing() { clear_lcd(); }
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
|
||||
@ -1515,7 +1516,7 @@ void MarlinUI::draw_status_screen() {
|
||||
lower_right.column = 0;
|
||||
lower_right.row = 0;
|
||||
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
|
||||
x_map_pixels = (HD44780_CHAR_WIDTH) * (MESH_MAP_COLS) - 2; // Minus 2 because we are drawing a box around the map
|
||||
y_map_pixels = (HD44780_CHAR_HEIGHT) * (MESH_MAP_ROWS) - 2;
|
||||
|
@ -376,6 +376,8 @@ void MarlinUI::clear_lcd() {
|
||||
lcd.clear_buffer();
|
||||
}
|
||||
|
||||
void MarlinUI::clear_for_drawing() { clear_lcd(); }
|
||||
|
||||
#if HAS_LCD_CONTRAST
|
||||
void MarlinUI::_set_contrast() { lcd.setContrast(contrast); }
|
||||
#endif
|
||||
|
@ -374,7 +374,19 @@ void MarlinUI::draw_kill_screen() {
|
||||
} while (u8g.nextPage());
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
// Erase the LCD contents by drawing an empty box.
|
||||
void MarlinUI::clear_lcd() {
|
||||
u8g.setColorIndex(0);
|
||||
u8g.firstPage();
|
||||
do {
|
||||
u8g.drawBox(0, 0, u8g.getWidth(), u8g.getHeight());
|
||||
} while (u8g.nextPage());
|
||||
}
|
||||
|
||||
// U8G displays are drawn over multiple loops so must do their own clearing.
|
||||
void MarlinUI::clear_for_drawing() {
|
||||
// Automatically cleared by Picture Loop
|
||||
}
|
||||
|
||||
#if HAS_DISPLAY_SLEEP
|
||||
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
|
||||
|
@ -1816,6 +1816,8 @@ void hmiSDCardInit() { card.cdroot(); }
|
||||
// Initialize or re-initialize the LCD
|
||||
void MarlinUI::init_lcd() { dwinStartup(); }
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
|
||||
void MarlinUI::update() {
|
||||
eachMomentUpdate(); // Status update
|
||||
hmiSDCardUpdate(); // SD card update
|
||||
|
@ -5155,6 +5155,8 @@ void MarlinUI::init_lcd() {
|
||||
jyersDWIN.redrawScreen();
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
|
||||
if (mode != PAUSE_MODE_SAME) pause_mode = mode;
|
||||
|
@ -90,6 +90,8 @@ void MarlinUI::clear_lcd() {
|
||||
did_first_redraw = false;
|
||||
}
|
||||
|
||||
void MarlinUI::clear_for_drawing() { clear_lcd(); }
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
@ -111,7 +113,7 @@ void MarlinUI::clear_lcd() {
|
||||
|
||||
dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
||||
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
|
||||
dwinIconShow(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
@ -132,7 +134,7 @@ void MarlinUI::clear_lcd() {
|
||||
|
||||
void MarlinUI::bootscreen_completion(const millis_t sofar) {
|
||||
if ((BOOTSCREEN_TIMEOUT) > sofar) safe_delay((BOOTSCREEN_TIMEOUT) - sofar);
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1913,6 +1913,8 @@ void MarlinUI::init_lcd() {
|
||||
dwinJPGCacheTo1(Language_English);
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
|
||||
void dwinInitScreen() {
|
||||
dwinSetColorDefaults();
|
||||
hmiInit(); // Draws boot screen
|
||||
|
@ -195,6 +195,7 @@ namespace ExtUI {
|
||||
void onPIDTuning(const pidresult_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
switch (rst) {
|
||||
default: break;
|
||||
#if ENABLED(PIDTEMP)
|
||||
case PID_STARTED: dwinPIDTuning(PIDTEMP_START); break;
|
||||
#endif
|
||||
|
@ -1279,6 +1279,9 @@ namespace ExtUI {
|
||||
#if DISABLED(HAS_DWIN_E3V2)
|
||||
void MarlinUI::init_lcd() { ExtUI::onStartup(); }
|
||||
|
||||
void MarlinUI::clear_lcd() {}
|
||||
void MarlinUI::clear_for_drawing() {}
|
||||
|
||||
void MarlinUI::update() { ExtUI::onIdle(); }
|
||||
|
||||
void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const component) {
|
||||
|
@ -226,6 +226,7 @@ void MarlinUI::init() {
|
||||
#endif
|
||||
|
||||
init_lcd();
|
||||
clear_lcd();
|
||||
|
||||
#if BUTTON_EXISTS(EN1)
|
||||
SET_INPUT_PULLUP(BTN_EN1);
|
||||
@ -1204,7 +1205,7 @@ void MarlinUI::init() {
|
||||
// Change state of drawing flag between screen updates
|
||||
if (!drawing_screen) switch (lcdDrawUpdate) {
|
||||
case LCDVIEW_CLEAR_CALL_REDRAW:
|
||||
clear_lcd(); break;
|
||||
clear_for_drawing(); break;
|
||||
case LCDVIEW_REDRAW_NOW:
|
||||
refresh(LCDVIEW_NONE);
|
||||
case LCDVIEW_NONE:
|
||||
|
@ -207,11 +207,14 @@ public:
|
||||
|
||||
#if HAS_DISPLAY || HAS_DWIN_E3V2
|
||||
static void init_lcd();
|
||||
// Erase the LCD contents. Do the lowest-level thing required to clear the LCD.
|
||||
static void clear_lcd();
|
||||
#else
|
||||
static void init_lcd() {}
|
||||
static void clear_lcd() {}
|
||||
#endif
|
||||
|
||||
static void reinit_lcd() { TERN_(REINIT_NOISY_SPI_LCD, init_lcd()); }
|
||||
static void reinit_lcd() { TERN_(REINIT_NOISY_LCD, init_lcd()); }
|
||||
|
||||
#if HAS_WIRED_LCD
|
||||
static bool detected();
|
||||
@ -246,9 +249,6 @@ public:
|
||||
static void update_indicators();
|
||||
#endif
|
||||
|
||||
// LCD implementations
|
||||
static void clear_lcd();
|
||||
|
||||
#if ALL(HAS_MARLINUI_MENU, TOUCH_SCREEN_CALIBRATION)
|
||||
static void check_touch_calibration() {
|
||||
if (touch_calibration.need_calibration()) currentScreen = touch_calibration_screen;
|
||||
@ -520,6 +520,9 @@ public:
|
||||
|
||||
#if HAS_DISPLAY
|
||||
|
||||
// Clear the LCD before new drawing. Some LCDs do nothing because they redraw frequently.
|
||||
static void clear_for_drawing();
|
||||
|
||||
static void abort_print();
|
||||
static void pause_print();
|
||||
static void resume_print();
|
||||
@ -630,6 +633,7 @@ public:
|
||||
|
||||
#else // No LCD
|
||||
|
||||
static void clear_for_drawing() {}
|
||||
static void kill_screen(FSTR_P const, FSTR_P const) {}
|
||||
|
||||
#endif
|
||||
|
@ -209,7 +209,7 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
|
||||
TERN_(AUTO_BED_LEVELING_UBL, bedlevel.lcd_map_control = false);
|
||||
}
|
||||
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
|
||||
// Re-initialize custom characters that may be re-used
|
||||
#if HAS_MARLINUI_HD44780
|
||||
|
@ -96,7 +96,7 @@ void _lcd_mesh_fine_tune(FSTR_P const fmsg) {
|
||||
// To capture encoder events UBL will also call ui.capture and ui.release.
|
||||
//
|
||||
void MarlinUI::ubl_mesh_edit_start(const_float_t initial) {
|
||||
TERN_(HAS_GRAPHICAL_TFT, clear_lcd());
|
||||
TERN_(HAS_GRAPHICAL_TFT, clear_for_drawing());
|
||||
mesh_edit_accumulator = initial;
|
||||
goto_screen([]{ _lcd_mesh_fine_tune(GET_TEXT_F(MSG_MESH_EDIT_Z)); });
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void Touch::touch(touch_control_t *control) {
|
||||
case HEATER:
|
||||
int8_t heater;
|
||||
heater = control->data;
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
#if HAS_HOTEND
|
||||
if (heater >= 0) { // HotEnd
|
||||
#if HOTENDS == 1
|
||||
@ -213,20 +213,20 @@ void Touch::touch(touch_control_t *control) {
|
||||
|
||||
break;
|
||||
case FAN:
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
static uint8_t fan, fan_speed;
|
||||
fan = 0;
|
||||
fan_speed = thermalManager.fan_speed[fan];
|
||||
MenuItem_percent::action(GET_TEXT_F(MSG_FIRST_FAN_SPEED), &fan_speed, 0, 255, []{ thermalManager.set_fan_speed(fan, fan_speed); TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_BIT_SYNC_FANS));});
|
||||
break;
|
||||
case FEEDRATE:
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX);
|
||||
break;
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
case FLOWRATE:
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
MenuItemBase::itemIndex = control->data;
|
||||
#if EXTRUDERS == 1
|
||||
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
|
||||
|
@ -79,7 +79,7 @@ void MarlinUI::tft_idle() {
|
||||
|
||||
void MarlinUI::bootscreen_completion(const millis_t sofar) {
|
||||
if ((BOOTSCREEN_TIMEOUT) > sofar) safe_delay((BOOTSCREEN_TIMEOUT) - sofar);
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -199,7 +199,7 @@ void moveAxis(const AxisEnum axis, const int8_t direction) {
|
||||
tft.queue.reset();
|
||||
if (!sleepCleared) {
|
||||
sleepCleared = true;
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
tft.queue.async();
|
||||
}
|
||||
touch.idle();
|
||||
@ -407,7 +407,7 @@ void MarlinUI::init_lcd() {
|
||||
tft.add_glyphs(EXTRA_FONT_NAME);
|
||||
#endif
|
||||
TERN_(TOUCH_SCREEN, touch.init());
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() {
|
||||
@ -421,6 +421,8 @@ void MarlinUI::clear_lcd() {
|
||||
cursor.set(0, 0);
|
||||
}
|
||||
|
||||
void MarlinUI::clear_for_drawing() { clear_lcd(); }
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
|
||||
void MarlinUI::_set_brightness() {
|
||||
@ -441,7 +443,7 @@ void MarlinUI::clear_lcd() {
|
||||
|
||||
if (stage == CALIBRATION_NONE) {
|
||||
defer_status_screen(true);
|
||||
clear_lcd();
|
||||
clear_for_drawing();
|
||||
stage = touch_calibration.calibration_start();
|
||||
}
|
||||
else {
|
||||
|
@ -133,7 +133,7 @@ void MarlinUI::move_axis_screen() {
|
||||
motionAxisState.blocked = false;
|
||||
TERN_(TOUCH_SCREEN, touch.enable());
|
||||
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
|
||||
TERN_(TOUCH_SCREEN, touch.clear());
|
||||
|
||||
|
@ -146,7 +146,7 @@ void MarlinUI::move_axis_screen() {
|
||||
motionAxisState.blocked = false;
|
||||
TERN_(TOUCH_SCREEN, touch.enable());
|
||||
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
|
||||
TERN_(TOUCH_SCREEN, touch.clear());
|
||||
|
||||
|
@ -146,7 +146,7 @@ void MarlinUI::move_axis_screen() {
|
||||
motionAxisState.blocked = false;
|
||||
TERN_(TOUCH_SCREEN, touch.enable());
|
||||
|
||||
ui.clear_lcd();
|
||||
ui.clear_for_drawing();
|
||||
|
||||
TERN_(TOUCH_SCREEN, touch.clear());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user