My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ultralcd.h 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "../inc/MarlinConfig.h"
  24. #if HAS_BUZZER
  25. #include "../libs/buzzer.h"
  26. #endif
  27. #define HAS_DIGITAL_BUTTONS (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL) || BUTTON_EXISTS(EN1, EN2) || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT))
  28. #define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL))))
  29. #define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTON_EXISTS(EN1, EN2))
  30. #define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
  31. // I2C buttons must be read in the main thread
  32. #define HAS_SLOW_BUTTONS EITHER(LCD_I2C_VIKI, LCD_I2C_PANELOLU2)
  33. #if HAS_SPI_LCD
  34. #include "../Marlin.h"
  35. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  36. #include "../feature/pause.h"
  37. #include "../module/motion.h" // for active_extruder
  38. #endif
  39. enum LCDViewAction : uint8_t {
  40. LCDVIEW_NONE,
  41. LCDVIEW_REDRAW_NOW,
  42. LCDVIEW_CALL_REDRAW_NEXT,
  43. LCDVIEW_CLEAR_CALL_REDRAW,
  44. LCDVIEW_CALL_NO_REDRAW
  45. };
  46. #if HAS_ADC_BUTTONS
  47. uint8_t get_ADC_keyValue();
  48. #endif
  49. #if ENABLED(TOUCH_BUTTONS)
  50. #define LCD_UPDATE_INTERVAL 50
  51. #else
  52. #define LCD_UPDATE_INTERVAL 100
  53. #endif
  54. #if HAS_LCD_MENU
  55. #if HAS_GRAPHICAL_LCD
  56. #define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
  57. #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
  58. #define LCDPRINT(p) u8g.print(p)
  59. #define LCDWRITE(c) u8g.print(c)
  60. #else
  61. #define SETCURSOR(col, row) lcd_moveto(col, row)
  62. #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - (len), row)
  63. #define LCDPRINT(p) lcd_put_u8str(p)
  64. #define LCDWRITE(c) lcd_put_wchar(c)
  65. #endif
  66. #include "lcdprint.h"
  67. void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap=false);
  68. inline void wrap_string_P(uint8_t &col, uint8_t &row, PGM_P const pstr, const bool wordwrap=false) { _wrap_string(col, row, pstr, read_byte_rom, wordwrap); }
  69. inline void wrap_string(uint8_t &col, uint8_t &row, const char * const string, const bool wordwrap=false) { _wrap_string(col, row, string, read_byte_ram, wordwrap); }
  70. #if ENABLED(SDSUPPORT)
  71. #include "../sd/cardreader.h"
  72. #endif
  73. typedef void (*screenFunc_t)();
  74. typedef void (*menuAction_t)();
  75. // Manual Movement
  76. constexpr float manual_feedrate_mm_m[XYZE] = MANUAL_FEEDRATE;
  77. extern float move_menu_scale;
  78. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  79. void lcd_pause_show_message(const PauseMessage message,
  80. const PauseMode mode=PAUSE_MODE_SAME,
  81. const uint8_t extruder=active_extruder);
  82. #endif
  83. #if ENABLED(AUTO_BED_LEVELING_UBL)
  84. void lcd_mesh_edit_setup(const float &initial);
  85. float lcd_mesh_edit();
  86. #endif
  87. #endif // HAS_LCD_MENU
  88. #endif
  89. // REPRAPWORLD_KEYPAD (and ADC_KEYPAD)
  90. #if ENABLED(REPRAPWORLD_KEYPAD)
  91. #define BTN_OFFSET 0 // Bit offset into buttons for shift register values
  92. #define BLEN_KEYPAD_F3 0
  93. #define BLEN_KEYPAD_F2 1
  94. #define BLEN_KEYPAD_F1 2
  95. #define BLEN_KEYPAD_DOWN 3
  96. #define BLEN_KEYPAD_RIGHT 4
  97. #define BLEN_KEYPAD_MIDDLE 5
  98. #define BLEN_KEYPAD_UP 6
  99. #define BLEN_KEYPAD_LEFT 7
  100. #define EN_KEYPAD_F1 _BV(BTN_OFFSET + BLEN_KEYPAD_F1)
  101. #define EN_KEYPAD_F2 _BV(BTN_OFFSET + BLEN_KEYPAD_F2)
  102. #define EN_KEYPAD_F3 _BV(BTN_OFFSET + BLEN_KEYPAD_F3)
  103. #define EN_KEYPAD_DOWN _BV(BTN_OFFSET + BLEN_KEYPAD_DOWN)
  104. #define EN_KEYPAD_RIGHT _BV(BTN_OFFSET + BLEN_KEYPAD_RIGHT)
  105. #define EN_KEYPAD_MIDDLE _BV(BTN_OFFSET + BLEN_KEYPAD_MIDDLE)
  106. #define EN_KEYPAD_UP _BV(BTN_OFFSET + BLEN_KEYPAD_UP)
  107. #define EN_KEYPAD_LEFT _BV(BTN_OFFSET + BLEN_KEYPAD_LEFT)
  108. #define RRK(B) (keypad_buttons & (B))
  109. #ifdef EN_C
  110. #define BUTTON_CLICK() ((buttons & EN_C) || RRK(EN_KEYPAD_MIDDLE))
  111. #else
  112. #define BUTTON_CLICK() RRK(EN_KEYPAD_MIDDLE)
  113. #endif
  114. #endif
  115. #if HAS_DIGITAL_BUTTONS
  116. // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
  117. #define BLEN_A 0
  118. #define BLEN_B 1
  119. #define EN_A _BV(BLEN_A)
  120. #define EN_B _BV(BLEN_B)
  121. #define BUTTON_PRESSED(BN) !READ(BTN_## BN)
  122. #if BUTTON_EXISTS(ENC) || ENABLED(TOUCH_BUTTONS)
  123. #define BLEN_C 2
  124. #define EN_C _BV(BLEN_C)
  125. #endif
  126. #if ENABLED(LCD_I2C_VIKI)
  127. #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
  128. // button and encoder bit positions within 'buttons'
  129. #define B_LE (BUTTON_LEFT << B_I2C_BTN_OFFSET) // The remaining normalized buttons are all read via I2C
  130. #define B_UP (BUTTON_UP << B_I2C_BTN_OFFSET)
  131. #define B_MI (BUTTON_SELECT << B_I2C_BTN_OFFSET)
  132. #define B_DW (BUTTON_DOWN << B_I2C_BTN_OFFSET)
  133. #define B_RI (BUTTON_RIGHT << B_I2C_BTN_OFFSET)
  134. #if BUTTON_EXISTS(ENC) // The pause/stop/restart button is connected to BTN_ENC when used
  135. #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name
  136. #define BUTTON_CLICK() (buttons & (B_MI|B_RI|B_ST)) // Pause/stop also acts as click until a proper pause/stop is implemented.
  137. #else
  138. #define BUTTON_CLICK() (buttons & (B_MI|B_RI))
  139. #endif
  140. // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
  141. #elif ENABLED(LCD_I2C_PANELOLU2)
  142. #if !BUTTON_EXISTS(ENC) // Use I2C if not directly connected to a pin
  143. #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
  144. #define B_MI (PANELOLU2_ENCODER_C << B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
  145. #define BUTTON_CLICK() (buttons & B_MI)
  146. #endif
  147. #endif
  148. #else
  149. #undef BUTTON_EXISTS
  150. #define BUTTON_EXISTS(...) false
  151. // Shift register bits correspond to buttons:
  152. #define BL_LE 7 // Left
  153. #define BL_UP 6 // Up
  154. #define BL_MI 5 // Middle
  155. #define BL_DW 4 // Down
  156. #define BL_RI 3 // Right
  157. #define BL_ST 2 // Red Button
  158. #define B_LE (_BV(BL_LE))
  159. #define B_UP (_BV(BL_UP))
  160. #define B_MI (_BV(BL_MI))
  161. #define B_DW (_BV(BL_DW))
  162. #define B_RI (_BV(BL_RI))
  163. #define B_ST (_BV(BL_ST))
  164. #ifndef BUTTON_CLICK
  165. #define BUTTON_CLICK() (buttons & (B_MI|B_ST))
  166. #endif
  167. #endif
  168. #if BUTTON_EXISTS(BACK) || ENABLED(TOUCH_BUTTONS)
  169. #define BLEN_D 3
  170. #define EN_D _BV(BLEN_D)
  171. #define LCD_BACK_CLICKED() (buttons & EN_D)
  172. #else
  173. #define LCD_BACK_CLICKED() false
  174. #endif
  175. #ifndef BUTTON_CLICK
  176. #ifdef EN_C
  177. #define BUTTON_CLICK() (buttons & EN_C)
  178. #else
  179. #define BUTTON_CLICK() false
  180. #endif
  181. #endif
  182. #if HAS_GRAPHICAL_LCD
  183. enum MarlinFont : uint8_t {
  184. FONT_STATUSMENU = 1,
  185. FONT_EDIT,
  186. FONT_MENU
  187. };
  188. #else
  189. enum HD44780CharSet : uint8_t {
  190. CHARSET_MENU,
  191. CHARSET_INFO,
  192. CHARSET_BOOT
  193. };
  194. #endif
  195. ////////////////////////////////////////////
  196. //////////// MarlinUI Singleton ////////////
  197. ////////////////////////////////////////////
  198. class MarlinUI {
  199. public:
  200. MarlinUI() {
  201. #if HAS_LCD_MENU
  202. currentScreen = status_screen;
  203. #endif
  204. }
  205. #if HAS_BUZZER
  206. static void buzz(const long duration, const uint16_t freq);
  207. #endif
  208. #if ENABLED(LCD_HAS_STATUS_INDICATORS)
  209. static void update_indicators();
  210. #endif
  211. // LCD implementations
  212. static void clear_lcd();
  213. static void init_lcd();
  214. #if HAS_DISPLAY
  215. static void init();
  216. static void update();
  217. static void set_alert_status_P(PGM_P message);
  218. static char status_message[];
  219. static bool has_status();
  220. static uint8_t alert_level; // Higher levels block lower levels
  221. static inline void reset_alert_level() { alert_level = 0; }
  222. #if ENABLED(STATUS_MESSAGE_SCROLLING)
  223. static uint8_t status_scroll_offset;
  224. static void advance_status_scroll();
  225. static char* status_and_len(uint8_t &len);
  226. #endif
  227. static void abort_print();
  228. static void pause_print();
  229. static void resume_print();
  230. #if HAS_PRINT_PROGRESS
  231. #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
  232. static uint8_t progress_bar_percent;
  233. static void set_progress(const uint8_t progress) { progress_bar_percent = _MIN(progress, 100); }
  234. static void set_progress_done() { set_progress(0x80 + 100); }
  235. static void progress_reset() { if (progress_bar_percent & 0x80) set_progress(0); }
  236. #endif
  237. static uint8_t get_progress();
  238. #else
  239. static constexpr uint8_t get_progress() { return 0; }
  240. #endif
  241. #if HAS_SPI_LCD
  242. static millis_t next_button_update_ms;
  243. static bool detected();
  244. static LCDViewAction lcdDrawUpdate;
  245. static inline bool should_draw() { return bool(lcdDrawUpdate); }
  246. static inline void refresh(const LCDViewAction type) { lcdDrawUpdate = type; }
  247. static inline void refresh() { refresh(LCDVIEW_CLEAR_CALL_REDRAW); }
  248. #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
  249. static void draw_custom_bootscreen(const uint8_t frame=0);
  250. static void show_custom_bootscreen();
  251. #endif
  252. #if ENABLED(SHOW_BOOTSCREEN)
  253. static void draw_marlin_bootscreen(const bool line2=false);
  254. static void show_marlin_bootscreen();
  255. static void show_bootscreen();
  256. #endif
  257. #if HAS_GRAPHICAL_LCD
  258. static bool drawing_screen, first_page;
  259. static void set_font(const MarlinFont font_nr);
  260. #else
  261. static constexpr bool drawing_screen = false, first_page = true;
  262. static void set_custom_characters(const HD44780CharSet screen_charset=CHARSET_INFO);
  263. #if ENABLED(LCD_PROGRESS_BAR)
  264. static millis_t progress_bar_ms; // Start time for the current progress bar cycle
  265. static void draw_progress_bar(const uint8_t percent);
  266. #if PROGRESS_MSG_EXPIRE > 0
  267. static millis_t expire_status_ms; // = 0
  268. static inline void reset_progress_bar_timeout() { expire_status_ms = 0; }
  269. #endif
  270. #endif
  271. #endif
  272. static uint8_t lcd_status_update_delay;
  273. #if HAS_LCD_CONTRAST
  274. static int16_t contrast;
  275. static void set_contrast(const int16_t value);
  276. static inline void refresh_contrast() { set_contrast(contrast); }
  277. #endif
  278. #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
  279. static millis_t next_filament_display;
  280. #endif
  281. static void quick_feedback(const bool clear_buttons=true);
  282. #if HAS_BUZZER
  283. static void completion_feedback(const bool good=true);
  284. #endif
  285. #if DISABLED(LIGHTWEIGHT_UI)
  286. static void draw_status_message(const bool blink);
  287. #endif
  288. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  289. static void draw_hotend_status(const uint8_t row, const uint8_t extruder);
  290. #endif
  291. static void status_screen();
  292. #else
  293. static void refresh() {}
  294. #endif
  295. static bool get_blink();
  296. static void kill_screen(PGM_P const lcd_msg);
  297. static void draw_kill_screen();
  298. static void set_status(const char* const message, const bool persist=false);
  299. static void set_status_P(PGM_P const message, const int8_t level=0);
  300. static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
  301. static void reset_status();
  302. #else // No LCD
  303. static inline void init() {}
  304. static inline void update() {}
  305. static inline void refresh() {}
  306. static inline void return_to_status() {}
  307. static inline void set_alert_status_P(PGM_P message) { UNUSED(message); }
  308. static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
  309. static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
  310. static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
  311. static inline void reset_status() {}
  312. static inline void reset_alert_level() {}
  313. static constexpr bool has_status() { return false; }
  314. #endif
  315. #if HAS_LCD_MENU
  316. #if ENABLED(ENCODER_RATE_MULTIPLIER)
  317. static bool encoderRateMultiplierEnabled;
  318. static millis_t lastEncoderMovementMillis;
  319. static void enable_encoder_multiplier(const bool onoff);
  320. #endif
  321. #if ENABLED(SDSUPPORT)
  322. #if ENABLED(SCROLL_LONG_FILENAMES)
  323. static uint8_t filename_scroll_pos, filename_scroll_max;
  324. #endif
  325. static const char * scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll);
  326. #endif
  327. #if IS_KINEMATIC
  328. static bool processing_manual_move;
  329. #else
  330. static constexpr bool processing_manual_move = false;
  331. #endif
  332. #if E_MANUAL > 1
  333. static int8_t manual_move_e_index;
  334. #else
  335. static constexpr int8_t manual_move_e_index = 0;
  336. #endif
  337. static int16_t preheat_hotend_temp[2], preheat_bed_temp[2];
  338. static uint8_t preheat_fan_speed[2];
  339. // Select Screen (modal NO/YES style dialog)
  340. static bool selection;
  341. static void set_selection(const bool sel) { selection = sel; }
  342. static bool update_selection();
  343. static void manage_manual_move();
  344. static bool lcd_clicked;
  345. static bool use_click();
  346. static void synchronize(PGM_P const msg=nullptr);
  347. static screenFunc_t currentScreen;
  348. static void goto_screen(const screenFunc_t screen, const uint16_t encoder=0, const uint8_t top=0, const uint8_t items=0);
  349. static void save_previous_screen();
  350. static void goto_previous_screen(
  351. #if ENABLED(TURBO_BACK_MENU_ITEM)
  352. const bool is_back
  353. #endif
  354. );
  355. #if ENABLED(TURBO_BACK_MENU_ITEM)
  356. // Various menu items require a "void (*)()" to point to
  357. // this function so a default argument *won't* work
  358. static inline void goto_previous_screen() { goto_previous_screen(false); }
  359. #endif
  360. static void return_to_status();
  361. static inline bool on_status_screen() { return currentScreen == status_screen; }
  362. static inline void run_current_screen() { (*currentScreen)(); }
  363. #if ENABLED(LIGHTWEIGHT_UI)
  364. static void lcd_in_status(const bool inStatus);
  365. #endif
  366. static inline void defer_status_screen(const bool defer=true) {
  367. #if LCD_TIMEOUT_TO_STATUS
  368. defer_return_to_status = defer;
  369. #else
  370. UNUSED(defer);
  371. #endif
  372. }
  373. static inline void goto_previous_screen_no_defer() {
  374. defer_status_screen(false);
  375. goto_previous_screen();
  376. }
  377. #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
  378. static void reselect_last_file();
  379. #endif
  380. #if ENABLED(G26_MESH_VALIDATION)
  381. static inline void chirp() {
  382. #if HAS_BUZZER
  383. buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
  384. #endif
  385. }
  386. #endif
  387. #if ENABLED(AUTO_BED_LEVELING_UBL)
  388. static void ubl_plot(const uint8_t x_plot, const uint8_t y_plot);
  389. #endif
  390. static void draw_select_screen_prompt(PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr);
  391. #elif HAS_SPI_LCD
  392. static constexpr bool lcd_clicked = false;
  393. static constexpr bool on_status_screen() { return true; }
  394. static inline void run_current_screen() { status_screen(); }
  395. #endif
  396. #if ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)
  397. static bool wait_for_bl_move;
  398. #else
  399. static constexpr bool wait_for_bl_move = false;
  400. #endif
  401. #if HAS_LCD_MENU && EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
  402. static bool external_control;
  403. FORCE_INLINE static void capture() { external_control = true; }
  404. FORCE_INLINE static void release() { external_control = false; }
  405. #else
  406. static constexpr bool external_control = false;
  407. #endif
  408. #if HAS_ENCODER_ACTION
  409. static volatile uint8_t buttons;
  410. #if ENABLED(REPRAPWORLD_KEYPAD)
  411. static volatile uint8_t keypad_buttons;
  412. static bool handle_keypad();
  413. #endif
  414. #if HAS_SLOW_BUTTONS
  415. static volatile uint8_t slow_buttons;
  416. static uint8_t read_slow_buttons();
  417. #endif
  418. static void update_buttons();
  419. static inline bool button_pressed() { return BUTTON_CLICK(); }
  420. #if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
  421. static void wait_for_release();
  422. #endif
  423. static uint16_t encoderPosition;
  424. #if ENABLED(REVERSE_ENCODER_DIRECTION)
  425. #define ENCODERBASE -1
  426. #else
  427. #define ENCODERBASE +1
  428. #endif
  429. #if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION)
  430. static int8_t encoderDirection;
  431. static inline void encoder_direction_normal() { encoderDirection = ENCODERBASE; }
  432. #else
  433. static constexpr int8_t encoderDirection = ENCODERBASE;
  434. static inline void encoder_direction_normal() {}
  435. #endif
  436. #if ENABLED(REVERSE_MENU_DIRECTION)
  437. static inline void encoder_direction_menus() { encoderDirection = -(ENCODERBASE); }
  438. #else
  439. static inline void encoder_direction_menus() {}
  440. #endif
  441. #if ENABLED(REVERSE_SELECT_DIRECTION)
  442. static inline void encoder_direction_select() { encoderDirection = -(ENCODERBASE); }
  443. #else
  444. static inline void encoder_direction_select() {}
  445. #endif
  446. #else
  447. static inline void update_buttons() {}
  448. #endif
  449. private:
  450. static void _synchronize();
  451. #if HAS_DISPLAY
  452. static void finish_status(const bool persist);
  453. #endif
  454. #if HAS_SPI_LCD
  455. #if HAS_LCD_MENU
  456. #if LCD_TIMEOUT_TO_STATUS
  457. static bool defer_return_to_status;
  458. #else
  459. static constexpr bool defer_return_to_status = false;
  460. #endif
  461. #endif
  462. static void draw_status_screen();
  463. #endif
  464. };
  465. extern MarlinUI ui;
  466. #define LCD_MESSAGEPGM(x) ui.set_status_P(PSTR(x))
  467. #define LCD_ALERTMESSAGEPGM(x) ui.set_alert_status_P(PSTR(x))