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.

marlinui_HD44780.cpp 51KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfigPre.h"
  23. #if HAS_MARLINUI_HD44780
  24. /**
  25. * marlinui_HD44780.cpp
  26. *
  27. * LCD display implementations for Hitachi HD44780.
  28. * These are the most common LCD character displays.
  29. */
  30. #include "marlinui_HD44780.h"
  31. #include "../marlinui.h"
  32. #include "../../libs/numtostr.h"
  33. #include "../../sd/cardreader.h"
  34. #include "../../module/temperature.h"
  35. #include "../../module/printcounter.h"
  36. #include "../../module/planner.h"
  37. #include "../../module/motion.h"
  38. #if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
  39. #include "../../feature/filwidth.h"
  40. #include "../../gcode/parser.h"
  41. #endif
  42. #if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
  43. #include "../../feature/cooler.h"
  44. #endif
  45. #if ENABLED(I2C_AMMETER)
  46. #include "../../feature/ammeter.h"
  47. #endif
  48. #if ENABLED(AUTO_BED_LEVELING_UBL)
  49. #include "../../feature/bedlevel/bedlevel.h"
  50. #endif
  51. #if HAS_CUTTER
  52. #include "../../feature/spindle_laser.h"
  53. #endif
  54. //
  55. // Create LCD instance and chipset-specific information
  56. //
  57. #if ENABLED(LCD_I2C_TYPE_PCF8575)
  58. LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7);
  59. #elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008)
  60. LCD_CLASS lcd(LCD_I2C_ADDRESS OPTARG(DETECT_I2C_LCD_DEVICE, 1));
  61. #elif ENABLED(LCD_I2C_TYPE_PCA8574)
  62. LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
  63. #elif ENABLED(SR_LCD_2W_NL)
  64. // 2 wire Non-latching LCD SR from:
  65. // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
  66. LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN
  67. #if PIN_EXISTS(SR_STROBE)
  68. , SR_STROBE_PIN
  69. #endif
  70. );
  71. #elif ENABLED(SR_LCD_3W_NL)
  72. // NewLiquidCrystal was not working
  73. // https://github.com/mikeshub/SailfishLCD
  74. // uses the code directly from Sailfish
  75. LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN);
  76. #elif ENABLED(LCM1602)
  77. LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
  78. #elif ENABLED(YHCB2004)
  79. LCD_CLASS lcd(YHCB2004_CLK, 20, 4, YHCB2004_MOSI, YHCB2004_MISO); // CLK, cols, rows, MOSI, MISO
  80. #else
  81. // Standard direct-connected LCD implementations
  82. LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7);
  83. #endif
  84. static void createChar_P(const char c, const byte * const ptr) {
  85. byte temp[8];
  86. LOOP_L_N(i, 8)
  87. temp[i] = pgm_read_byte(&ptr[i]);
  88. lcd.createChar(c, temp);
  89. }
  90. #if ENABLED(LCD_PROGRESS_BAR)
  91. #define LCD_STR_PROGRESS "\x03\x04\x05"
  92. #endif
  93. #if ENABLED(LCD_USE_I2C_BUZZER)
  94. void MarlinUI::buzz(const long duration, const uint16_t freq) {
  95. if (sound_on) lcd.buzz(duration, freq);
  96. }
  97. #endif
  98. void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARSET_INFO*/) {
  99. #if NONE(LCD_PROGRESS_BAR, SHOW_BOOTSCREEN)
  100. UNUSED(screen_charset);
  101. #endif
  102. // CHARSET_BOOT
  103. #if ENABLED(SHOW_BOOTSCREEN)
  104. const static PROGMEM byte corner[4][8] = { {
  105. B00000,
  106. B00000,
  107. B00000,
  108. B00000,
  109. B00001,
  110. B00010,
  111. B00100,
  112. B00100
  113. }, {
  114. B00000,
  115. B00000,
  116. B00000,
  117. B11100,
  118. B11100,
  119. B01100,
  120. B00100,
  121. B00100
  122. }, {
  123. B00100,
  124. B00010,
  125. B00001,
  126. B00000,
  127. B00000,
  128. B00000,
  129. B00000,
  130. B00000
  131. }, {
  132. B00100,
  133. B01000,
  134. B10000,
  135. B00000,
  136. B00000,
  137. B00000,
  138. B00000,
  139. B00000
  140. } };
  141. #endif // SHOW_BOOTSCREEN
  142. // CHARSET_INFO
  143. const static PROGMEM byte bedTemp[8] = {
  144. B00000,
  145. B11111,
  146. B10101,
  147. B10001,
  148. B10101,
  149. B11111,
  150. B00000,
  151. B00000
  152. };
  153. const static PROGMEM byte degree[8] = {
  154. B01100,
  155. B10010,
  156. B10010,
  157. B01100,
  158. B00000,
  159. B00000,
  160. B00000,
  161. B00000
  162. };
  163. const static PROGMEM byte thermometer[8] = {
  164. B00100,
  165. B01010,
  166. B01010,
  167. B01010,
  168. B01010,
  169. B10001,
  170. B10001,
  171. B01110
  172. };
  173. const static PROGMEM byte uplevel[8] = {
  174. B00100,
  175. B01110,
  176. B11111,
  177. B00100,
  178. B11100,
  179. B00000,
  180. B00000,
  181. B00000
  182. };
  183. const static PROGMEM byte feedrate[8] = {
  184. #if LCD_INFO_SCREEN_STYLE == 1
  185. B00000,
  186. B00100,
  187. B10010,
  188. B01001,
  189. B10010,
  190. B00100,
  191. B00000,
  192. B00000
  193. #else
  194. B11100,
  195. B10000,
  196. B11000,
  197. B10111,
  198. B00101,
  199. B00110,
  200. B00101,
  201. B00000
  202. #endif
  203. };
  204. const static PROGMEM byte clock[8] = {
  205. B00000,
  206. B01110,
  207. B10011,
  208. B10101,
  209. B10001,
  210. B01110,
  211. B00000,
  212. B00000
  213. };
  214. #if ENABLED(LCD_PROGRESS_BAR)
  215. // CHARSET_INFO
  216. const static PROGMEM byte progress[3][8] = { {
  217. B00000,
  218. B10000,
  219. B10000,
  220. B10000,
  221. B10000,
  222. B10000,
  223. B10000,
  224. B00000
  225. }, {
  226. B00000,
  227. B10100,
  228. B10100,
  229. B10100,
  230. B10100,
  231. B10100,
  232. B10100,
  233. B00000
  234. }, {
  235. B00000,
  236. B10101,
  237. B10101,
  238. B10101,
  239. B10101,
  240. B10101,
  241. B10101,
  242. B00000
  243. } };
  244. #endif // LCD_PROGRESS_BAR
  245. #if BOTH(SDSUPPORT, HAS_MARLINUI_MENU)
  246. // CHARSET_MENU
  247. const static PROGMEM byte refresh[8] = {
  248. B00000,
  249. B00110,
  250. B11001,
  251. B11000,
  252. B00011,
  253. B10011,
  254. B01100,
  255. B00000,
  256. };
  257. const static PROGMEM byte folder[8] = {
  258. B00000,
  259. B11100,
  260. B11111,
  261. B10001,
  262. B10001,
  263. B11111,
  264. B00000,
  265. B00000
  266. };
  267. #endif // SDSUPPORT
  268. #if ENABLED(SHOW_BOOTSCREEN)
  269. // Set boot screen corner characters
  270. if (screen_charset == CHARSET_BOOT) {
  271. for (uint8_t i = 4; i--;)
  272. createChar_P(i, corner[i]);
  273. }
  274. else
  275. #endif
  276. { // Info Screen uses 5 special characters
  277. createChar_P(LCD_STR_BEDTEMP[0], bedTemp);
  278. createChar_P(LCD_STR_DEGREE[0], degree);
  279. createChar_P(LCD_STR_THERMOMETER[0], thermometer);
  280. createChar_P(LCD_STR_FEEDRATE[0], feedrate);
  281. createChar_P(LCD_STR_CLOCK[0], clock);
  282. #if ENABLED(LCD_PROGRESS_BAR)
  283. if (screen_charset == CHARSET_INFO) { // 3 Progress bar characters for info screen
  284. for (int16_t i = 3; i--;)
  285. createChar_P(LCD_STR_PROGRESS[i], progress[i]);
  286. }
  287. else
  288. #endif
  289. {
  290. createChar_P(LCD_STR_UPLEVEL[0], uplevel);
  291. #if BOTH(SDSUPPORT, HAS_MARLINUI_MENU)
  292. // SD Card sub-menu special characters
  293. createChar_P(LCD_STR_REFRESH[0], refresh);
  294. createChar_P(LCD_STR_FOLDER[0], folder);
  295. #endif
  296. }
  297. }
  298. }
  299. void MarlinUI::init_lcd() {
  300. #if ENABLED(LCD_I2C_TYPE_PCF8575)
  301. lcd.begin(LCD_WIDTH, LCD_HEIGHT);
  302. #ifdef LCD_I2C_PIN_BL
  303. lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
  304. lcd.setBacklight(HIGH);
  305. #endif
  306. #elif ENABLED(LCD_I2C_TYPE_MCP23017)
  307. lcd.setMCPType(LTI_TYPE_MCP23017);
  308. lcd.begin(LCD_WIDTH, LCD_HEIGHT);
  309. update_indicators();
  310. #elif ENABLED(LCD_I2C_TYPE_MCP23008)
  311. lcd.setMCPType(LTI_TYPE_MCP23008);
  312. lcd.begin(LCD_WIDTH, LCD_HEIGHT);
  313. #elif ENABLED(LCD_I2C_TYPE_PCA8574)
  314. lcd.init();
  315. lcd.backlight();
  316. #else
  317. lcd.begin(LCD_WIDTH, LCD_HEIGHT);
  318. #endif
  319. set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU);
  320. lcd.clear();
  321. }
  322. bool MarlinUI::detected() {
  323. return TERN1(DETECT_I2C_LCD_DEVICE, lcd.LcdDetected() == 1);
  324. }
  325. #if HAS_SLOW_BUTTONS
  326. uint8_t MarlinUI::read_slow_buttons() {
  327. #if ENABLED(LCD_I2C_TYPE_MCP23017)
  328. // Reading these buttons is too slow for interrupt context
  329. // so they are read during LCD update in the main loop.
  330. uint8_t slow_bits = lcd.readButtons()
  331. #if !BUTTON_EXISTS(ENC)
  332. << B_I2C_BTN_OFFSET
  333. #endif
  334. ;
  335. #if ENABLED(LCD_I2C_VIKI)
  336. if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked
  337. slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
  338. #endif
  339. return slow_bits;
  340. #endif // LCD_I2C_TYPE_MCP23017
  341. }
  342. #endif
  343. void MarlinUI::clear_lcd() { lcd.clear(); }
  344. #if ENABLED(SHOW_BOOTSCREEN)
  345. void lcd_erase_line(const lcd_uint_t line) {
  346. lcd_moveto(0, line);
  347. for (uint8_t i = LCD_WIDTH + 1; --i;)
  348. lcd_put_lchar(' ');
  349. }
  350. // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
  351. void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, FSTR_P const ftxt, const uint8_t len, const int16_t time) {
  352. uint8_t slen = utf8_strlen(ftxt);
  353. if (slen < len) {
  354. lcd_put_u8str_max(col, line, ftxt, len);
  355. for (; slen < len; ++slen) lcd_put_lchar(' ');
  356. safe_delay(time);
  357. }
  358. else {
  359. PGM_P p = FTOP(ftxt);
  360. int dly = time / _MAX(slen, 1);
  361. LOOP_LE_N(i, slen) {
  362. // Print the text at the correct place
  363. lcd_put_u8str_max_P(col, line, p, len);
  364. // Fill with spaces
  365. for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_lchar(' ');
  366. // Delay
  367. safe_delay(dly);
  368. // Advance to the next UTF8 valid position
  369. p++;
  370. while (!START_OF_UTF8_CHAR(pgm_read_byte(p))) p++;
  371. }
  372. }
  373. }
  374. static void logo_lines(FSTR_P const extra) {
  375. int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2;
  376. lcd_put_lchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x01');
  377. lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra);
  378. lcd_put_lchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x03');
  379. }
  380. void MarlinUI::show_bootscreen() {
  381. set_custom_characters(CHARSET_BOOT);
  382. lcd.clear();
  383. #define LCD_EXTRA_SPACE (LCD_WIDTH-8)
  384. #define CENTER_OR_SCROLL(STRING,DELAY) { \
  385. lcd_erase_line(3); \
  386. const int len = utf8_strlen(STRING); \
  387. if (len <= LCD_WIDTH) { \
  388. lcd_put_u8str((LCD_WIDTH - len) / 2, 3, F(STRING)); \
  389. safe_delay(DELAY); \
  390. } \
  391. else \
  392. lcd_scroll(0, 3, F(STRING), LCD_WIDTH, DELAY); \
  393. }
  394. //
  395. // Show the Marlin logo with splash line 1
  396. //
  397. if (LCD_EXTRA_SPACE >= utf8_strlen(SHORT_BUILD_VERSION) + 1) {
  398. //
  399. // Show the Marlin logo, splash line1, and splash line 2
  400. //
  401. logo_lines(F(" " SHORT_BUILD_VERSION));
  402. CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 2000);
  403. }
  404. else {
  405. //
  406. // Show the Marlin logo and short build version
  407. // After a delay show the website URL
  408. //
  409. logo_lines(FPSTR(NUL_STR));
  410. CENTER_OR_SCROLL(SHORT_BUILD_VERSION, 1500);
  411. CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 1500);
  412. #ifdef STRING_SPLASH_LINE3
  413. CENTER_OR_SCROLL(STRING_SPLASH_LINE3, 1500);
  414. #endif
  415. }
  416. }
  417. void MarlinUI::bootscreen_completion(const millis_t) {
  418. lcd.clear();
  419. safe_delay(100);
  420. set_custom_characters(CHARSET_INFO);
  421. lcd.clear();
  422. }
  423. #endif // SHOW_BOOTSCREEN
  424. void MarlinUI::draw_kill_screen() {
  425. lcd_uint_t x = 0, y = 0;
  426. lcd_put_u8str(x, y, status_message);
  427. y = 2;
  428. #if LCD_HEIGHT >= 4
  429. lcd_put_u8str(x, y++, GET_TEXT_F(MSG_HALTED));
  430. #endif
  431. lcd_put_u8str(x, y, GET_TEXT_F(MSG_PLEASE_RESET));
  432. }
  433. //
  434. // Before homing, blink '123' <-> '???'.
  435. // Homed but unknown... '123' <-> ' '.
  436. // Homed and known, display constantly.
  437. //
  438. FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
  439. lcd_put_lchar('X' + uint8_t(axis));
  440. if (blink)
  441. lcd_put_u8str(value);
  442. else if (axis_should_home(axis))
  443. while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
  444. else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
  445. #ifdef Z_AXIS
  446. lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
  447. #else
  448. lcd_put_u8str(F(" "));
  449. #endif
  450. else
  451. lcd_put_u8str(value);
  452. }
  453. FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) {
  454. #if HAS_HEATED_BED
  455. const bool isBed = TERN(HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0);
  456. const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)),
  457. t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
  458. #else
  459. const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
  460. #endif
  461. if (prefix >= 0) lcd_put_lchar(prefix);
  462. lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
  463. lcd_put_lchar('/');
  464. #if !HEATER_IDLE_HANDLER
  465. UNUSED(blink);
  466. #else
  467. if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
  468. lcd_put_lchar(' ');
  469. if (t2 >= 10) lcd_put_lchar(' ');
  470. if (t2 >= 100) lcd_put_lchar(' ');
  471. }
  472. else
  473. #endif
  474. lcd_put_u8str(i16tostr3left(t2));
  475. if (prefix >= 0) {
  476. lcd_put_lchar(LCD_STR_DEGREE[0]);
  477. lcd_put_lchar(' ');
  478. if (t2 < 10) lcd_put_lchar(' ');
  479. }
  480. }
  481. #if HAS_COOLER
  482. FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
  483. const celsius_t t2 = thermalManager.degTargetCooler();
  484. if (prefix >= 0) lcd_put_lchar(prefix);
  485. lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
  486. lcd_put_lchar('/');
  487. #if !HEATER_IDLE_HANDLER
  488. UNUSED(blink);
  489. #else
  490. if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
  491. lcd_put_lchar(' ');
  492. if (t2 >= 10) lcd_put_lchar(' ');
  493. if (t2 >= 100) lcd_put_lchar(' ');
  494. }
  495. else
  496. #endif
  497. lcd_put_u8str(i16tostr3left(t2));
  498. if (prefix >= 0) {
  499. lcd_put_lchar(LCD_STR_DEGREE[0]);
  500. lcd_put_lchar(' ');
  501. if (t2 < 10) lcd_put_lchar(' ');
  502. }
  503. }
  504. #endif
  505. #if ENABLED(LASER_COOLANT_FLOW_METER)
  506. FORCE_INLINE void _draw_flowmeter_status() {
  507. lcd_put_u8str("~");
  508. lcd_put_u8str(ftostr11ns(cooler.flowrate));
  509. lcd_put_lchar('L');
  510. }
  511. #endif
  512. #if ENABLED(I2C_AMMETER)
  513. FORCE_INLINE void _draw_ammeter_status() {
  514. lcd_put_u8str(" ");
  515. ammeter.read();
  516. if (ammeter.current <= 0.999f) {
  517. lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f)));
  518. lcd_put_u8str("mA");
  519. }
  520. else {
  521. lcd_put_u8str(ftostr12ns(ammeter.current));
  522. lcd_put_lchar('A');
  523. }
  524. }
  525. #endif
  526. FORCE_INLINE void _draw_bed_status(const bool blink) {
  527. _draw_heater_status(H_BED, TERN0(HAS_LEVELING, blink && planner.leveling_active) ? '_' : LCD_STR_BEDTEMP[0], blink);
  528. }
  529. #ifdef HAS_CUTTER
  530. FORCE_INLINE void _draw_cutter_status() {
  531. #if ENABLED(LASER_FEATURE)
  532. lcd_put_u8str("Laser:");
  533. #else
  534. lcd_put_u8str("Cutter:");
  535. #endif
  536. lcd_put_u8str(" ");
  537. #if CUTTER_UNIT_IS(PERCENT)
  538. lcd_put_u8str(cutter_power2str(cutter.unitPower));
  539. lcd_put_lchar('%');
  540. #elif CUTTER_UNIT_IS(RPM)
  541. lcd_put_u8str(ftostr61rj(float(cutter.unitPower) / 1000));
  542. lcd_put_lchar('K');
  543. #else
  544. lcd_put_u8str(cutter_power2str(cutter.unitPower));
  545. #endif
  546. lcd_put_u8str(" ");
  547. if (cutter.enabled()) {
  548. lcd_put_u8str("On");
  549. } else {
  550. lcd_put_u8str("Off");
  551. }
  552. lcd_put_u8str(" ");
  553. switch (cutter.cutter_mode) {
  554. case CUTTER_MODE_STANDARD:
  555. lcd_put_u8str("S");
  556. break;
  557. case CUTTER_MODE_CONTINUOUS:
  558. lcd_put_u8str("C");
  559. break;
  560. case CUTTER_MODE_DYNAMIC:
  561. lcd_put_u8str("D");
  562. break;
  563. case CUTTER_MODE_ERROR:
  564. lcd_put_u8str("!");
  565. break;
  566. }
  567. }
  568. #endif
  569. #if ENABLED(LCD_PROGRESS_BAR)
  570. void MarlinUI::draw_progress_bar(const uint8_t percent) {
  571. const int16_t tix = int16_t(percent * (LCD_WIDTH) * 3) / 100,
  572. cel = tix / 3,
  573. rem = tix % 3;
  574. uint8_t i = LCD_WIDTH;
  575. char msg[LCD_WIDTH + 1], b = ' ';
  576. msg[LCD_WIDTH] = '\0';
  577. while (i--) {
  578. if (i == cel - 1)
  579. b = LCD_STR_PROGRESS[2];
  580. else if (i == cel && rem != 0)
  581. b = LCD_STR_PROGRESS[rem - 1];
  582. msg[i] = b;
  583. }
  584. lcd_put_u8str(msg);
  585. }
  586. #endif // LCD_PROGRESS_BAR
  587. void MarlinUI::draw_status_message(const bool blink) {
  588. lcd_moveto(0, LCD_HEIGHT - 1);
  589. #if ENABLED(LCD_PROGRESS_BAR)
  590. // Draw the progress bar if the message has shown long enough
  591. // or if there is no message set.
  592. if (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !has_status()) {
  593. const uint8_t progress = get_progress_percent();
  594. if (progress > 2) return draw_progress_bar(progress);
  595. }
  596. #elif BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
  597. // Alternate Status message and Filament display
  598. if (ELAPSED(millis(), next_filament_display)) {
  599. lcd_put_u8str(F("Dia "));
  600. lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
  601. lcd_put_u8str(F(" V"));
  602. lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
  603. lcd_put_lchar('%');
  604. return;
  605. }
  606. #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
  607. #if ENABLED(STATUS_MESSAGE_SCROLLING)
  608. static bool last_blink = false;
  609. // Get the UTF8 character count of the string
  610. uint8_t slen = utf8_strlen(status_message);
  611. // If the string fits into the LCD, just print it and do not scroll it
  612. if (slen <= LCD_WIDTH) {
  613. // The string isn't scrolling and may not fill the screen
  614. lcd_put_u8str(status_message);
  615. // Fill the rest with spaces
  616. while (slen < LCD_WIDTH) { lcd_put_lchar(' '); ++slen; }
  617. }
  618. else {
  619. // String is larger than the available space in screen.
  620. // Get a pointer to the next valid UTF8 character
  621. // and the string remaining length
  622. uint8_t rlen;
  623. const char *stat = status_and_len(rlen);
  624. lcd_put_u8str_max(stat, LCD_WIDTH); // The string leaves space
  625. // If the remaining string doesn't completely fill the screen
  626. if (rlen < LCD_WIDTH) {
  627. uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
  628. lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space
  629. if (--chars) { // Draw a second space if there's room
  630. lcd_put_lchar(' ');
  631. if (--chars) { // Draw a third space if there's room
  632. lcd_put_lchar(' ');
  633. if (--chars)
  634. lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
  635. }
  636. }
  637. }
  638. if (last_blink != blink) {
  639. last_blink = blink;
  640. advance_status_scroll();
  641. }
  642. }
  643. #else
  644. UNUSED(blink);
  645. // Get the UTF8 character count of the string
  646. uint8_t slen = utf8_strlen(status_message);
  647. // Just print the string to the LCD
  648. lcd_put_u8str_max(status_message, LCD_WIDTH);
  649. // Fill the rest with spaces if there are missing spaces
  650. while (slen < LCD_WIDTH) {
  651. lcd_put_lchar(' ');
  652. ++slen;
  653. }
  654. #endif
  655. }
  656. #if HAS_PRINT_PROGRESS
  657. #define TPOFFSET (LCD_WIDTH - 1)
  658. static uint8_t timepos = TPOFFSET - 6;
  659. static char buffer[14];
  660. static lcd_uint_t pc, pr;
  661. #if ENABLED(SHOW_PROGRESS_PERCENT)
  662. void MarlinUI::drawPercent() {
  663. const uint8_t progress = ui.get_progress_percent();
  664. if (progress) {
  665. lcd_moveto(pc, pr);
  666. lcd_put_u8str(F(TERN(IS_SD_PRINTING, "SD", "P:")));
  667. lcd_put_u8str(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(ui.get_progress_permyriad()), ui8tostr3rj(progress)));
  668. lcd_put_lchar('%');
  669. }
  670. }
  671. #endif
  672. #if ENABLED(SHOW_REMAINING_TIME)
  673. void MarlinUI::drawRemain() {
  674. const duration_t remaint = ui.get_remaining_time();
  675. if (printJobOngoing()) {
  676. timepos = TPOFFSET - remaint.toDigital(buffer);
  677. lcd_put_lchar(TERN(LCD_INFO_SCREEN_STYLE, 11, timepos), 2, 'R');
  678. lcd_put_u8str(buffer);
  679. }
  680. }
  681. #endif
  682. #if ENABLED(SHOW_INTERACTION_TIME)
  683. void MarlinUI::drawInter() {
  684. const duration_t interactt = ui.interaction_time;
  685. if (printingIsActive() && interactt.value) {
  686. timepos = TPOFFSET - interactt.toDigital(buffer);
  687. lcd_put_lchar(TERN(LCD_INFO_SCREEN_STYLE, 11, timepos), 2, 'C');
  688. lcd_put_u8str(buffer);
  689. }
  690. }
  691. #endif
  692. #if ENABLED(SHOW_ELAPSED_TIME)
  693. void MarlinUI::drawElapsed() {
  694. const duration_t elapsedt = print_job_timer.duration();
  695. if (printJobOngoing()) {
  696. timepos = TPOFFSET - elapsedt.toDigital(buffer);
  697. lcd_put_lchar(TERN(LCD_INFO_SCREEN_STYLE, 11, timepos), 2, 'E');
  698. //lcd_put_lchar(timepos, 2, LCD_STR_CLOCK[0]);
  699. lcd_put_u8str(buffer);
  700. }
  701. }
  702. #endif
  703. #endif // HAS_PRINT_PROGRESS
  704. /**
  705. * LCD_INFO_SCREEN_STYLE 0 : Classic Status Screen
  706. *
  707. * 16x2 |000/000 B000/000|
  708. * |0123456789012345|
  709. *
  710. * 16x4 |000/000 B000/000|
  711. * |SD---% Z 000.00|
  712. * |F---% T--:--|
  713. * |0123456789012345|
  714. *
  715. * 20x2 |T000/000° B000/000° |
  716. * |01234567890123456789|
  717. *
  718. * 20x4 |T000/000° B000/000° |
  719. * |X 000 Y 000 Z000.000|
  720. * |F---% SD---% T--:--|
  721. * |01234567890123456789|
  722. *
  723. * LCD_INFO_SCREEN_STYLE 1 : Průša-style Status Screen
  724. *
  725. * |T000/000° Z 000.00 |
  726. * |B000/000° F---% |
  727. * |SD---% T--:-- |
  728. * |01234567890123456789|
  729. *
  730. * |T000/000° Z 000.00 |
  731. * |T000/000° F---% |
  732. * |B000/000° SD---% |
  733. * |01234567890123456789|
  734. */
  735. void MarlinUI::draw_status_screen() {
  736. const bool blink = get_blink();
  737. lcd_moveto(0, 0);
  738. #if LCD_INFO_SCREEN_STYLE == 0
  739. // ========== Line 1 ==========
  740. #if LCD_WIDTH < 20
  741. //
  742. // Hotend 0 Temperature
  743. //
  744. #if HAS_HOTEND
  745. _draw_heater_status(H_E0, -1, blink);
  746. //
  747. // Hotend 1 or Bed Temperature
  748. //
  749. #if HAS_MULTI_HOTEND
  750. lcd_moveto(8, 0);
  751. _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
  752. #elif HAS_HEATED_BED
  753. lcd_moveto(8, 0);
  754. _draw_bed_status(blink);
  755. #endif
  756. #elif HAS_CUTTER
  757. lcd_moveto(0, 0);
  758. _draw_cutter_status();
  759. #endif
  760. #else // LCD_WIDTH >= 20
  761. //
  762. // Hotend 0 Temperature
  763. //
  764. #if HAS_HOTEND
  765. _draw_heater_status(H_E0, LCD_STR_THERMOMETER[0], blink);
  766. //
  767. // Hotend 1 or Bed Temperature
  768. //
  769. #if HAS_MULTI_HOTEND
  770. lcd_moveto(10, 0);
  771. _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
  772. #elif HAS_HEATED_BED
  773. lcd_moveto(10, 0);
  774. _draw_bed_status(blink);
  775. #endif
  776. #elif HAS_CUTTER
  777. lcd_moveto(0, 0);
  778. _draw_cutter_status();
  779. #endif
  780. TERN_(HAS_COOLER, _draw_cooler_status('*', blink));
  781. TERN_(LASER_COOLANT_FLOW_METER, _draw_flowmeter_status());
  782. TERN_(I2C_AMMETER, _draw_ammeter_status());
  783. #endif // LCD_WIDTH >= 20
  784. // ========== Line 2 ==========
  785. #if LCD_HEIGHT > 2
  786. #if LCD_WIDTH < 20
  787. #if HAS_PRINT_PROGRESS
  788. pc = 0, pr = 2;
  789. rotate_progress();
  790. #endif
  791. #else // LCD_WIDTH >= 20
  792. lcd_moveto(0, 1);
  793. // If the first line has two extruder temps,
  794. // show more temperatures on the next line
  795. #if HOTENDS > 2 || (HAS_MULTI_HOTEND && HAS_HEATED_BED)
  796. #if HOTENDS > 2
  797. _draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink);
  798. lcd_moveto(10, 1);
  799. #endif
  800. _draw_bed_status(blink);
  801. #else // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED)
  802. #if HAS_DUAL_MIXING
  803. // Two-component mix / gradient instead of XY
  804. char mixer_messages[12];
  805. const char *mix_label;
  806. #if ENABLED(GRADIENT_MIX)
  807. if (mixer.gradient.enabled) {
  808. mixer.update_mix_from_gradient();
  809. mix_label = "Gr";
  810. }
  811. else
  812. #endif
  813. {
  814. mixer.update_mix_from_vtool();
  815. mix_label = "Mx";
  816. }
  817. sprintf_P(mixer_messages, PSTR("%s %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
  818. lcd_put_u8str(mixer_messages);
  819. #else // !HAS_DUAL_MIXING
  820. const bool show_e_total = TERN0(LCD_SHOW_E_TOTAL, printingIsActive());
  821. if (show_e_total) {
  822. #if ENABLED(LCD_SHOW_E_TOTAL)
  823. char tmp[20];
  824. const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
  825. sprintf_P(tmp, PSTR("E %ld%cm "), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
  826. lcd_put_u8str(tmp);
  827. #endif
  828. }
  829. else {
  830. const xy_pos_t lpos = current_position.asLogical();
  831. _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
  832. lcd_put_lchar(' ');
  833. _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
  834. }
  835. #endif // !HAS_DUAL_MIXING
  836. #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED)
  837. #endif // LCD_WIDTH >= 20
  838. #ifdef Z_AXIS
  839. lcd_moveto(LCD_WIDTH - 8, 1);
  840. _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
  841. #endif
  842. #if HAS_LEVELING && !HAS_HEATED_BED
  843. lcd_put_lchar(planner.leveling_active || blink ? '_' : ' ');
  844. #endif
  845. #endif // LCD_HEIGHT > 2
  846. // ========== Line 3 ==========
  847. #if LCD_HEIGHT > 3
  848. lcd_put_lchar(0, 2, LCD_STR_FEEDRATE[0]);
  849. lcd_put_u8str(i16tostr3rj(feedrate_percentage));
  850. lcd_put_lchar('%');
  851. #if LCD_WIDTH >= 20
  852. #if HAS_PRINT_PROGRESS
  853. pc = timepos - 7, pr = 2;
  854. rotate_progress();
  855. #else
  856. char c;
  857. uint16_t per;
  858. #if HAS_FAN0
  859. if (true
  860. #if EXTRUDERS && ENABLED(ADAPTIVE_FAN_SLOWING)
  861. && (blink || thermalManager.fan_speed_scaler[0] < 128)
  862. #endif
  863. ) {
  864. uint16_t spd = thermalManager.fan_speed[0];
  865. if (blink) c = 'F';
  866. #if ENABLED(ADAPTIVE_FAN_SLOWING)
  867. else { c = '*'; spd = thermalManager.scaledFanSpeed(0, spd); }
  868. #endif
  869. per = thermalManager.pwmToPercent(spd);
  870. }
  871. else
  872. #endif
  873. {
  874. #if HAS_EXTRUDERS
  875. c = 'E';
  876. per = planner.flow_percentage[0];
  877. #endif
  878. }
  879. lcd_put_lchar(c);
  880. lcd_put_u8str(i16tostr3rj(per));
  881. lcd_put_lchar('%');
  882. #endif
  883. #endif
  884. #endif // LCD_HEIGHT > 3
  885. #elif LCD_INFO_SCREEN_STYLE == 1
  886. // ========== Line 1 ==========
  887. //
  888. // Hotend 0 Temperature
  889. //
  890. _draw_heater_status(H_E0, LCD_STR_THERMOMETER[0], blink);
  891. //
  892. // Z Coordinate
  893. //
  894. #ifdef Z_AXIS
  895. lcd_moveto(LCD_WIDTH - 9, 0);
  896. _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
  897. #endif
  898. #if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
  899. lcd_put_lchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
  900. #endif
  901. // ========== Line 2 ==========
  902. //
  903. // Hotend 1 or Bed Temperature
  904. //
  905. lcd_moveto(0, 1);
  906. #if HAS_MULTI_HOTEND
  907. _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
  908. #elif HAS_HEATED_BED
  909. _draw_bed_status(blink);
  910. #endif
  911. lcd_put_lchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
  912. lcd_put_u8str(i16tostr3rj(feedrate_percentage));
  913. lcd_put_lchar('%');
  914. // ========== Line 3 ==========
  915. //
  916. // Progress percent, Hotend 2, or Bed
  917. //
  918. lcd_moveto(0, 2);
  919. #if HOTENDS > 2
  920. _draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink);
  921. #elif HAS_MULTI_HOTEND && HAS_HEATED_BED
  922. _draw_bed_status(blink);
  923. #elif HAS_PRINT_PROGRESS
  924. #define DREW_PRINT_PROGRESS 1
  925. pc = 0, pr = 2;
  926. rotate_progress();
  927. #endif
  928. //
  929. // All progress strings
  930. //
  931. #if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
  932. pc = LCD_WIDTH - 9, pr = 2;
  933. rotate_progress();
  934. #endif
  935. #endif // LCD_INFO_SCREEN_STYLE 1
  936. // ========= Last Line ========
  937. //
  938. // Status Message (which may be a Progress Bar or Filament display)
  939. //
  940. draw_status_message(blink);
  941. }
  942. #if HAS_MARLINUI_MENU
  943. #include "../menu/menu.h"
  944. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  945. void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
  946. if (row < LCD_HEIGHT) {
  947. lcd_moveto(LCD_WIDTH - 9, row);
  948. _draw_heater_status((heater_id_t)extruder, LCD_STR_THERMOMETER[0], get_blink());
  949. }
  950. }
  951. #endif // ADVANCED_PAUSE_FEATURE
  952. // Draw a static item with no left-right margin required. Centered by default.
  953. void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) {
  954. int8_t n = LCD_WIDTH;
  955. lcd_moveto(0, row);
  956. const int8_t plen = fstr ? utf8_strlen(fstr) : 0,
  957. vlen = vstr ? utf8_strlen(vstr) : 0;
  958. if (style & SS_CENTER) {
  959. int8_t pad = (LCD_WIDTH - plen - vlen) / 2;
  960. while (--pad >= 0) { lcd_put_lchar(' '); n--; }
  961. }
  962. if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
  963. if (vlen) n -= lcd_put_u8str_max(vstr, n);
  964. for (; n > 0; --n) lcd_put_lchar(' ');
  965. }
  966. // Draw a generic menu item with pre_char (if selected) and post_char
  967. void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) {
  968. lcd_put_lchar(0, row, sel ? pre_char : ' ');
  969. uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2);
  970. for (; n; --n) lcd_put_lchar(' ');
  971. lcd_put_lchar(post_char);
  972. }
  973. // Draw a menu item with a (potentially) editable value
  974. void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
  975. const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
  976. lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
  977. uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen);
  978. if (vlen) {
  979. lcd_put_lchar(':');
  980. for (; n; --n) lcd_put_lchar(' ');
  981. if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
  982. }
  983. }
  984. // Low-level draw_edit_screen can be used to draw an edit screen from anyplace
  985. void MenuEditItemBase::draw_edit_screen(FSTR_P const ftpl, const char * const value/*=nullptr*/) {
  986. ui.encoder_direction_normal();
  987. uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1);
  988. if (value) {
  989. lcd_put_lchar(':'); n--;
  990. const uint8_t len = utf8_strlen(value) + 1; // Plus one for a leading space
  991. const lcd_uint_t valrow = n < len ? 2 : 1; // Value on the next row if it won't fit
  992. lcd_put_lchar(LCD_WIDTH - len, valrow, ' '); // Right-justified, padded, leading space
  993. lcd_put_u8str(value);
  994. }
  995. }
  996. // The Select Screen presents a prompt and two "buttons"
  997. void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) {
  998. ui.draw_select_screen_prompt(pref, string, suff);
  999. if (no) {
  1000. SETCURSOR(0, LCD_HEIGHT - 1);
  1001. lcd_put_lchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_lchar(yesno ? ' ' : ']');
  1002. }
  1003. if (yes) {
  1004. SETCURSOR_RJ(utf8_strlen(yes) + 2, LCD_HEIGHT - 1);
  1005. lcd_put_lchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_lchar(yesno ? ']' : ' ');
  1006. }
  1007. }
  1008. #if ENABLED(SDSUPPORT)
  1009. void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
  1010. lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
  1011. constexpr uint8_t maxlen = LCD_WIDTH - 2;
  1012. uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
  1013. for (; n; --n) lcd_put_lchar(' ');
  1014. lcd_put_lchar(isDir ? LCD_STR_FOLDER[0] : ' ');
  1015. }
  1016. #endif
  1017. #if ENABLED(LCD_HAS_STATUS_INDICATORS)
  1018. void MarlinUI::update_indicators() {
  1019. // Set the LEDS - referred to as backlights by the LiquidTWI2 library
  1020. static uint8_t ledsprev = 0;
  1021. uint8_t leds = 0;
  1022. if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) leds |= LED_A;
  1023. if (TERN0(HAS_HOTEND, thermalManager.degTargetHotend(0) > 0)) leds |= LED_B;
  1024. #if HAS_FAN
  1025. if ( TERN0(HAS_FAN0, thermalManager.fan_speed[0])
  1026. || TERN0(HAS_FAN1, thermalManager.fan_speed[1])
  1027. || TERN0(HAS_FAN2, thermalManager.fan_speed[2])
  1028. || TERN0(HAS_FAN3, thermalManager.fan_speed[3])
  1029. || TERN0(HAS_FAN4, thermalManager.fan_speed[4])
  1030. || TERN0(HAS_FAN5, thermalManager.fan_speed[5])
  1031. || TERN0(HAS_FAN6, thermalManager.fan_speed[6])
  1032. || TERN0(HAS_FAN7, thermalManager.fan_speed[7])
  1033. ) leds |= LED_C;
  1034. #endif // HAS_FAN
  1035. if (TERN0(HAS_MULTI_HOTEND, thermalManager.degTargetHotend(1) > 0)) leds |= LED_C;
  1036. if (leds != ledsprev) {
  1037. lcd.setBacklight(leds);
  1038. ledsprev = leds;
  1039. }
  1040. }
  1041. #endif // LCD_HAS_STATUS_INDICATORS
  1042. #if ENABLED(AUTO_BED_LEVELING_UBL)
  1043. #define HD44780_CHAR_WIDTH 5
  1044. #define HD44780_CHAR_HEIGHT 8
  1045. #define MESH_MAP_COLS 7
  1046. #define MESH_MAP_ROWS 4
  1047. #define CHAR_LINE_TOP 0
  1048. #define CHAR_LINE_BOT 1
  1049. #define CHAR_EDGE_L 2
  1050. #define CHAR_EDGE_R 3
  1051. #define CHAR_UL_UL 4
  1052. #define CHAR_LR_UL 5
  1053. #define CHAR_UL_LR 6
  1054. #define CHAR_LR_LR 7
  1055. #define TOP_LEFT _BV(0)
  1056. #define TOP_RIGHT _BV(1)
  1057. #define LOWER_LEFT _BV(2)
  1058. #define LOWER_RIGHT _BV(3)
  1059. /**
  1060. * Possible map screens:
  1061. *
  1062. * 16x2 |X000.00 Y000.00|
  1063. * |(00,00) Z00.000|
  1064. *
  1065. * 20x2 | X:000.00 Y:000.00 |
  1066. * | (00,00) Z:00.000 |
  1067. *
  1068. * 16x4 |+-------+(00,00)|
  1069. * || |X000.00|
  1070. * || |Y000.00|
  1071. * |+-------+Z00.000|
  1072. *
  1073. * 20x4 | +-------+ (00,00) |
  1074. * | | | X:000.00|
  1075. * | | | Y:000.00|
  1076. * | +-------+ Z:00.000|
  1077. */
  1078. typedef struct {
  1079. uint8_t custom_char_bits[HD44780_CHAR_HEIGHT];
  1080. } custom_char;
  1081. typedef struct {
  1082. lcd_uint_t column, row,
  1083. x_pixel_offset, y_pixel_offset;
  1084. uint8_t x_pixel_mask;
  1085. } coordinate;
  1086. void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location);
  1087. FORCE_INLINE static void clear_custom_char(custom_char * const cc) { ZERO(cc->custom_char_bits); }
  1088. coordinate pixel_location(int16_t x, int16_t y) {
  1089. coordinate ret_val;
  1090. int16_t xp, yp, r, c;
  1091. x++; y++; // +1 because lines on the left and top
  1092. c = x / (HD44780_CHAR_WIDTH);
  1093. r = y / (HD44780_CHAR_HEIGHT);
  1094. ret_val.column = c;
  1095. ret_val.row = r;
  1096. xp = x - c * (HD44780_CHAR_WIDTH); // Get the pixel offsets into the character cell
  1097. xp = HD44780_CHAR_WIDTH - 1 - xp; // Column within relevant character cell (0 on the right)
  1098. yp = y - r * (HD44780_CHAR_HEIGHT);
  1099. ret_val.x_pixel_mask = _BV(xp);
  1100. ret_val.x_pixel_offset = xp;
  1101. ret_val.y_pixel_offset = yp;
  1102. return ret_val;
  1103. }
  1104. inline coordinate pixel_location(const lcd_uint_t x, const lcd_uint_t y) { return pixel_location((int16_t)x, (int16_t)y); }
  1105. void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
  1106. add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
  1107. lcd.createChar(c, (uint8_t*)&chrdata);
  1108. lcd_put_lchar(x, y, c);
  1109. }
  1110. void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
  1111. #if LCD_WIDTH >= 20
  1112. #define _LCD_W_POS 12
  1113. #define _PLOT_X 1
  1114. #define _MAP_X 3
  1115. #define _LABEL(C,X,Y) lcd_put_u8str_P(X, Y, C)
  1116. #define _XLABEL(X,Y) _LABEL(X_LBL,X,Y)
  1117. #define _YLABEL(X,Y) _LABEL(Y_LBL,X,Y)
  1118. #define _ZLABEL(X,Y) _LABEL(Z_LBL,X,Y)
  1119. #else
  1120. #define _LCD_W_POS 8
  1121. #define _PLOT_X 0
  1122. #define _MAP_X 1
  1123. #define _LABEL(X,Y,C) lcd_put_lchar(X, Y, C)
  1124. #define _XLABEL(X,Y) _LABEL('X',X,Y)
  1125. #define _YLABEL(X,Y) _LABEL('Y',X,Y)
  1126. #define _ZLABEL(X,Y) _LABEL('Z',X,Y)
  1127. #endif
  1128. #if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
  1129. /**
  1130. * Show X and Y positions
  1131. */
  1132. _XLABEL(_PLOT_X, 0);
  1133. lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(bedlevel.get_mesh_x(x_plot))));
  1134. _YLABEL(_LCD_W_POS, 0);
  1135. lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(bedlevel.get_mesh_y(y_plot))));
  1136. lcd_moveto(_PLOT_X, 0);
  1137. #else // 16x4 or 20x4 display
  1138. coordinate upper_left, lower_right, bottom_right_corner;
  1139. custom_char new_char;
  1140. uint8_t i, n, n_rows, n_cols;
  1141. lcd_uint_t j, k, l, m, bottom_line, right_edge,
  1142. x_map_pixels, y_map_pixels,
  1143. pixels_per_x_mesh_pnt, pixels_per_y_mesh_pnt,
  1144. suppress_x_offset = 0, suppress_y_offset = 0;
  1145. const uint8_t y_plot_inv = (GRID_MAX_POINTS_Y) - 1 - y_plot;
  1146. upper_left.column = 0;
  1147. upper_left.row = 0;
  1148. lower_right.column = 0;
  1149. lower_right.row = 0;
  1150. clear_lcd();
  1151. x_map_pixels = (HD44780_CHAR_WIDTH) * (MESH_MAP_COLS) - 2; // Minus 2 because we are drawing a box around the map
  1152. y_map_pixels = (HD44780_CHAR_HEIGHT) * (MESH_MAP_ROWS) - 2;
  1153. pixels_per_x_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X);
  1154. pixels_per_y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y);
  1155. if (pixels_per_x_mesh_pnt >= HD44780_CHAR_WIDTH) { // There are only 2 custom characters available, so the X
  1156. pixels_per_x_mesh_pnt = HD44780_CHAR_WIDTH; // Size of the mesh point needs to fit within them independent
  1157. suppress_x_offset = 1; // Of where the starting pixel is located.
  1158. }
  1159. if (pixels_per_y_mesh_pnt >= HD44780_CHAR_HEIGHT) { // There are only 2 custom characters available, so the Y
  1160. pixels_per_y_mesh_pnt = HD44780_CHAR_HEIGHT; // Size of the mesh point needs to fit within them independent
  1161. suppress_y_offset = 1; // Of where the starting pixel is located.
  1162. }
  1163. x_map_pixels = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X); // Now we have the right number of pixels to make both
  1164. y_map_pixels = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y); // Directions fit nicely
  1165. right_edge = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X) + 1; // Find location of right edge within the character cell
  1166. bottom_line = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 1; // Find location of bottom line within the character cell
  1167. n_rows = bottom_line / (HD44780_CHAR_HEIGHT) + 1;
  1168. n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
  1169. for (i = 0; i < n_cols; i++) {
  1170. lcd_put_lchar(i, 0, CHAR_LINE_TOP); // Box Top line
  1171. lcd_put_lchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line
  1172. }
  1173. for (j = 0; j < n_rows; j++) {
  1174. lcd_put_lchar(0, j, CHAR_EDGE_L); // Box Left edge
  1175. lcd_put_lchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge
  1176. }
  1177. /**
  1178. * If the entire 4th row is not in use, do not put vertical bars all the way down to the bottom of the display
  1179. */
  1180. k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
  1181. l = (HD44780_CHAR_HEIGHT) * n_rows;
  1182. if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
  1183. lcd_put_lchar(0, n_rows - 1, ' '); // Box Left edge
  1184. lcd_put_lchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge
  1185. }
  1186. clear_custom_char(&new_char);
  1187. new_char.custom_char_bits[0] = 0b11111U; // Char #0 is used for the box top line
  1188. lcd.createChar(CHAR_LINE_TOP, (uint8_t*)&new_char);
  1189. clear_custom_char(&new_char);
  1190. k = (GRID_MAX_POINTS_Y) * pixels_per_y_mesh_pnt + 1; // Row of pixels for the bottom box line
  1191. l = k % (HD44780_CHAR_HEIGHT); // Row within relevant character cell
  1192. new_char.custom_char_bits[l] = 0b11111U; // Char #1 is used for the box bottom line
  1193. lcd.createChar(CHAR_LINE_BOT, (uint8_t*)&new_char);
  1194. clear_custom_char(&new_char);
  1195. for (j = 0; j < HD44780_CHAR_HEIGHT; j++)
  1196. new_char.custom_char_bits[j] = 0b10000U; // Char #2 is used for the box left edge
  1197. lcd.createChar(CHAR_EDGE_L, (uint8_t*)&new_char);
  1198. clear_custom_char(&new_char);
  1199. m = (GRID_MAX_POINTS_X) * pixels_per_x_mesh_pnt + 1; // Column of pixels for the right box line
  1200. n = m % (HD44780_CHAR_WIDTH); // Column within relevant character cell
  1201. i = HD44780_CHAR_WIDTH - 1 - n; // Column within relevant character cell (0 on the right)
  1202. for (j = 0; j < HD44780_CHAR_HEIGHT; j++)
  1203. new_char.custom_char_bits[j] = (uint8_t)_BV(i); // Char #3 is used for the box right edge
  1204. lcd.createChar(CHAR_EDGE_R, (uint8_t*)&new_char);
  1205. i = x_plot * pixels_per_x_mesh_pnt - suppress_x_offset;
  1206. j = y_plot_inv * pixels_per_y_mesh_pnt - suppress_y_offset;
  1207. upper_left = pixel_location(i, j);
  1208. k = (x_plot + 1) * pixels_per_x_mesh_pnt - 1 - suppress_x_offset;
  1209. l = (y_plot_inv + 1) * pixels_per_y_mesh_pnt - 1 - suppress_y_offset;
  1210. lower_right = pixel_location(k, l);
  1211. bottom_right_corner = pixel_location(x_map_pixels, y_map_pixels);
  1212. /**
  1213. * First, handle the simple case where everything is within a single character cell.
  1214. * If part of the Mesh Plot is outside of this character cell, we will follow up
  1215. * and deal with that next.
  1216. */
  1217. clear_custom_char(&new_char);
  1218. const lcd_uint_t ypix = _MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, HD44780_CHAR_HEIGHT);
  1219. for (j = upper_left.y_pixel_offset; j < ypix; j++) {
  1220. i = upper_left.x_pixel_mask;
  1221. for (k = 0; k < pixels_per_x_mesh_pnt; k++) {
  1222. new_char.custom_char_bits[j] |= i;
  1223. i >>= 1;
  1224. }
  1225. }
  1226. prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, TOP_LEFT, CHAR_UL_UL, upper_left.column, upper_left.row);
  1227. /**
  1228. * Next, check for two side by side character cells being used to display the Mesh Point
  1229. * If found... do the right hand character cell next.
  1230. */
  1231. if (upper_left.column == lower_right.column - 1) {
  1232. l = upper_left.x_pixel_offset;
  1233. clear_custom_char(&new_char);
  1234. for (j = upper_left.y_pixel_offset; j < ypix; j++) {
  1235. i = _BV(HD44780_CHAR_WIDTH - 1); // Fill in the left side of the right character cell
  1236. for (k = 0; k < pixels_per_x_mesh_pnt - 1 - l; k++) {
  1237. new_char.custom_char_bits[j] |= i;
  1238. i >>= 1;
  1239. }
  1240. }
  1241. prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, TOP_RIGHT, CHAR_LR_UL, lower_right.column, upper_left.row);
  1242. }
  1243. /**
  1244. * Next, check for two character cells stacked on top of each other being used to display the Mesh Point
  1245. */
  1246. if (upper_left.row == lower_right.row - 1) {
  1247. l = HD44780_CHAR_HEIGHT - upper_left.y_pixel_offset; // Number of pixel rows in top character cell
  1248. k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell
  1249. clear_custom_char(&new_char);
  1250. for (j = 0; j < k; j++) {
  1251. i = upper_left.x_pixel_mask;
  1252. for (m = 0; m < pixels_per_x_mesh_pnt; m++) { // Fill in the top side of the bottom character cell
  1253. new_char.custom_char_bits[j] |= i;
  1254. if (!(i >>= 1)) break;
  1255. }
  1256. }
  1257. prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, LOWER_LEFT, CHAR_UL_LR, upper_left.column, lower_right.row);
  1258. }
  1259. /**
  1260. * Next, check for four character cells being used to display the Mesh Point. If that is
  1261. * what is here, we work to fill in the character cell that is down one and to the right one
  1262. * from the upper_left character cell.
  1263. */
  1264. if (upper_left.column == lower_right.column - 1 && upper_left.row == lower_right.row - 1) {
  1265. l = HD44780_CHAR_HEIGHT - upper_left.y_pixel_offset; // Number of pixel rows in top character cell
  1266. k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell
  1267. clear_custom_char(&new_char);
  1268. for (j = 0; j < k; j++) {
  1269. l = upper_left.x_pixel_offset;
  1270. i = _BV(HD44780_CHAR_WIDTH - 1); // Fill in the left side of the right character cell
  1271. for (m = 0; m < pixels_per_x_mesh_pnt - 1 - l; m++) { // Fill in the top side of the bottom character cell
  1272. new_char.custom_char_bits[j] |= i;
  1273. i >>= 1;
  1274. }
  1275. }
  1276. prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, LOWER_RIGHT, CHAR_LR_LR, lower_right.column, lower_right.row);
  1277. }
  1278. #endif
  1279. /**
  1280. * Print plot position
  1281. */
  1282. lcd_put_lchar(_LCD_W_POS, 0, '(');
  1283. lcd_put_u8str(ui8tostr3rj(x_plot));
  1284. lcd_put_lchar(',');
  1285. lcd_put_u8str(ui8tostr3rj(y_plot));
  1286. lcd_put_lchar(')');
  1287. #if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
  1288. /**
  1289. * Print Z values
  1290. */
  1291. _ZLABEL(_LCD_W_POS, 1);
  1292. if (!isnan(bedlevel.z_values[x_plot][y_plot]))
  1293. lcd_put_u8str(ftostr43sign(bedlevel.z_values[x_plot][y_plot]));
  1294. else
  1295. lcd_put_u8str(F(" -----"));
  1296. #else // 16x4 or 20x4 display
  1297. /**
  1298. * Show all values at right of screen
  1299. */
  1300. _XLABEL(_LCD_W_POS, 1);
  1301. lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(bedlevel.get_mesh_x(x_plot))));
  1302. _YLABEL(_LCD_W_POS, 2);
  1303. lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(bedlevel.get_mesh_y(y_plot))));
  1304. /**
  1305. * Show the location value
  1306. */
  1307. _ZLABEL(_LCD_W_POS, 3);
  1308. if (!isnan(bedlevel.z_values[x_plot][y_plot]))
  1309. lcd_put_u8str(ftostr43sign(bedlevel.z_values[x_plot][y_plot]));
  1310. else
  1311. lcd_put_u8str(F(" -----"));
  1312. #endif // LCD_HEIGHT > 3
  1313. }
  1314. void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location) {
  1315. uint8_t i, k;
  1316. int16_t n_rows = lr.row - ul.row + 1,
  1317. n_cols = lr.column - ul.column + 1;
  1318. /**
  1319. * Check if Top line of box needs to be filled in
  1320. */
  1321. if (ul.row == 0 && (cell_location & (TOP_LEFT|TOP_RIGHT))) { // Only fill in the top line for the top character cells
  1322. if (n_cols == 1) {
  1323. if (ul.column != brc.column)
  1324. custom.custom_char_bits[0] = 0xFF; // Single column in middle
  1325. else
  1326. for (i = brc.x_pixel_offset; i < HD44780_CHAR_WIDTH; i++) // Single column on right side
  1327. SBI(custom.custom_char_bits[0], i);
  1328. }
  1329. else if ((cell_location & TOP_LEFT) || lr.column != brc.column) // Multiple column in the middle or with right cell in middle
  1330. custom.custom_char_bits[0] = 0xFF;
  1331. else
  1332. for (i = brc.x_pixel_offset; i < HD44780_CHAR_WIDTH; i++)
  1333. SBI(custom.custom_char_bits[0], i);
  1334. }
  1335. /**
  1336. * Check if left line of box needs to be filled in
  1337. */
  1338. if (cell_location & (TOP_LEFT|LOWER_LEFT)) {
  1339. if (ul.column == 0) { // Left column of characters on LCD Display
  1340. k = ul.row == brc.row ? brc.y_pixel_offset : HD44780_CHAR_HEIGHT; // If it isn't the last row... do the full character cell
  1341. for (i = 0; i < k; i++)
  1342. SBI(custom.custom_char_bits[i], HD44780_CHAR_WIDTH - 1);
  1343. }
  1344. }
  1345. /**
  1346. * Check if bottom line of box needs to be filled in
  1347. */
  1348. // Single row of mesh plot cells
  1349. if (n_rows == 1 /* && (cell_location & (TOP_LEFT|TOP_RIGHT)) */ && ul.row == brc.row) {
  1350. if (n_cols == 1) // Single row, single column case
  1351. k = ul.column == brc.column ? brc.x_pixel_mask : 0x01;
  1352. else if (cell_location & TOP_RIGHT) // Single row, multiple column case
  1353. k = lr.column == brc.column ? brc.x_pixel_mask : 0x01;
  1354. else // Single row, left of multiple columns
  1355. k = 0x01;
  1356. while (k < _BV(HD44780_CHAR_WIDTH)) {
  1357. custom.custom_char_bits[brc.y_pixel_offset] |= k;
  1358. k <<= 1;
  1359. }
  1360. }
  1361. // Double row of characters on LCD Display
  1362. // And this is a bottom custom character
  1363. if (n_rows == 2 && (cell_location & (LOWER_LEFT|LOWER_RIGHT)) && lr.row == brc.row) {
  1364. if (n_cols == 1) // Double row, single column case
  1365. k = ul.column == brc.column ? brc.x_pixel_mask : 0x01;
  1366. else if (cell_location & LOWER_RIGHT) // Double row, multiple column case
  1367. k = lr.column == brc.column ? brc.x_pixel_mask : 0x01;
  1368. else // Double row, left of multiple columns
  1369. k = 0x01;
  1370. while (k < _BV(HD44780_CHAR_WIDTH)) {
  1371. custom.custom_char_bits[brc.y_pixel_offset] |= k;
  1372. k <<= 1;
  1373. }
  1374. }
  1375. /**
  1376. * Check if right line of box needs to be filled in
  1377. */
  1378. // Nothing to do if the lower right part of the mesh pnt isn't in the same column as the box line
  1379. if (lr.column == brc.column) {
  1380. // This mesh point is in the same character cell as the right box line
  1381. if (ul.column == brc.column || (cell_location & (TOP_RIGHT|LOWER_RIGHT))) {
  1382. // If not the last row... do the full character cell
  1383. k = ul.row == brc.row ? brc.y_pixel_offset : HD44780_CHAR_HEIGHT;
  1384. for (i = 0; i < k; i++) custom.custom_char_bits[i] |= brc.x_pixel_mask;
  1385. }
  1386. }
  1387. }
  1388. #endif // AUTO_BED_LEVELING_UBL
  1389. #endif // HAS_MARLINUI_MENU
  1390. #endif // HAS_MARLINUI_HD44780