My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

status_screen_DOGM.cpp 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  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. //
  23. // status_screen_DOGM.cpp
  24. // Standard Status Screen for Graphical Display
  25. //
  26. #include "../../inc/MarlinConfigPre.h"
  27. #if HAS_MARLINUI_U8GLIB && DISABLED(LIGHTWEIGHT_UI)
  28. #include "dogm_Statusscreen.h"
  29. #include "marlinui_DOGM.h"
  30. #include "../marlinui.h"
  31. #include "../lcdprint.h"
  32. #include "../../libs/numtostr.h"
  33. #include "../../module/motion.h"
  34. #include "../../module/temperature.h"
  35. #include "../../gcode/parser.h" // for units (and volumetric)
  36. #if ENABLED(LCD_SHOW_E_TOTAL)
  37. #include "../../MarlinCore.h" // for printingIsActive(), marlin_state and MF_SD_COMPLETE
  38. #endif
  39. #if ENABLED(FILAMENT_LCD_DISPLAY)
  40. #include "../../feature/filwidth.h"
  41. #include "../../module/planner.h"
  42. #endif
  43. #if HAS_CUTTER
  44. #include "../../feature/spindle_laser.h"
  45. #endif
  46. #if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
  47. #include "../../feature/cooler.h"
  48. #endif
  49. #if HAS_POWER_MONITOR
  50. #include "../../feature/power_monitor.h"
  51. #endif
  52. #if ENABLED(SDSUPPORT)
  53. #include "../../sd/cardreader.h"
  54. #endif
  55. #if HAS_PRINT_PROGRESS
  56. #include "../../module/printcounter.h"
  57. #endif
  58. #if HAS_DUAL_MIXING
  59. #include "../../feature/mixing.h"
  60. #endif
  61. #define X_LABEL_POS 3
  62. #define X_VALUE_POS 11
  63. #define XYZ_SPACING 37
  64. #define X_LABEL_POS_IN (X_LABEL_POS - 2)
  65. #define X_VALUE_POS_IN (X_VALUE_POS - 5)
  66. #define XYZ_SPACING_IN (XYZ_SPACING + 9)
  67. #define XYZ_BASELINE (30 + INFO_FONT_ASCENT)
  68. #define EXTRAS_BASELINE (40 + INFO_FONT_ASCENT)
  69. #define STATUS_BASELINE (LCD_PIXEL_HEIGHT - INFO_FONT_DESCENT)
  70. #if ANIM_HBCC
  71. enum HeatBits : uint8_t {
  72. DRAWBIT_HOTEND,
  73. DRAWBIT_BED = HOTENDS,
  74. DRAWBIT_CHAMBER,
  75. DRAWBIT_CUTTER
  76. };
  77. IF<(DRAWBIT_CUTTER > 7), uint16_t, uint8_t>::type draw_bits;
  78. #endif
  79. #if ANIM_HOTEND
  80. #define HOTEND_ALT(N) TEST(draw_bits, DRAWBIT_HOTEND + N)
  81. #else
  82. #define HOTEND_ALT(N) false
  83. #endif
  84. #if ANIM_BED
  85. #define BED_ALT() TEST(draw_bits, DRAWBIT_BED)
  86. #else
  87. #define BED_ALT() false
  88. #endif
  89. #if ANIM_CHAMBER
  90. #define CHAMBER_ALT() TEST(draw_bits, DRAWBIT_CHAMBER)
  91. #else
  92. #define CHAMBER_ALT() false
  93. #endif
  94. #if ANIM_CUTTER
  95. #define CUTTER_ALT(N) TEST(draw_bits, DRAWBIT_CUTTER)
  96. #else
  97. #define CUTTER_ALT() false
  98. #endif
  99. #if DO_DRAW_HOTENDS
  100. #define MAX_HOTEND_DRAW _MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE)))
  101. #endif
  102. #if EITHER(DO_DRAW_BED, DO_DRAW_HOTENDS)
  103. #define STATUS_HEATERS_BOT (STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1)
  104. #endif
  105. #if HAS_POWER_MONITOR
  106. void display_power_monitor(const uint8_t x, const uint8_t y) {
  107. lcd_moveto(x, y);
  108. #if HAS_POWER_MONITOR_WATTS
  109. const bool wflag = power_monitor.power_display_enabled();
  110. #endif
  111. #if ENABLED(POWER_MONITOR_CURRENT)
  112. const bool iflag = power_monitor.current_display_enabled();
  113. #endif
  114. #if ENABLED(POWER_MONITOR_VOLTAGE)
  115. const bool vflag = power_monitor.voltage_display_enabled();
  116. #endif
  117. #if HAS_POWER_MONITOR_WATTS
  118. // Cycle between current, voltage, and power
  119. if (ELAPSED(millis(), power_monitor.display_item_ms)) {
  120. power_monitor.display_item_ms = millis() + 1000UL;
  121. ++power_monitor.display_item;
  122. }
  123. #elif ENABLED(POWER_MONITOR_CURRENT)
  124. power_monitor.display_item = 0;
  125. #elif ENABLED(POWER_MONITOR_VOLTAGE)
  126. power_monitor.display_item = 1;
  127. #endif
  128. // ensure we have the right one selected for display
  129. for (uint8_t i = 0; i < 3; i++) {
  130. #if ENABLED(POWER_MONITOR_CURRENT)
  131. if (power_monitor.display_item == 0 && !iflag) ++power_monitor.display_item;
  132. #endif
  133. #if ENABLED(POWER_MONITOR_VOLTAGE)
  134. if (power_monitor.display_item == 1 && !vflag) ++power_monitor.display_item;
  135. #endif
  136. #if HAS_POWER_MONITOR_WATTS
  137. if (power_monitor.display_item == 2 && !wflag) ++power_monitor.display_item;
  138. #endif
  139. if (power_monitor.display_item >= 3) power_monitor.display_item = 0;
  140. }
  141. switch (power_monitor.display_item) {
  142. #if ENABLED(POWER_MONITOR_CURRENT) // Current
  143. case 0: if (iflag) power_monitor.draw_current(); break;
  144. #endif
  145. #if ENABLED(POWER_MONITOR_VOLTAGE) // Voltage
  146. case 1: if (vflag) power_monitor.draw_voltage(); break;
  147. #endif
  148. #if HAS_POWER_MONITOR_WATTS // Power
  149. case 2: if (wflag) power_monitor.draw_power(); break;
  150. #endif
  151. default: break;
  152. }
  153. }
  154. #endif
  155. #define PROGRESS_BAR_X 54
  156. #define PROGRESS_BAR_Y (EXTRAS_BASELINE + 1)
  157. #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)
  158. FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
  159. const char *str = i16tostr3rj(temp);
  160. const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
  161. lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
  162. lcd_put_wchar(LCD_STR_DEGREE[0]);
  163. }
  164. #if DO_DRAW_FLOWMETER
  165. FORCE_INLINE void _draw_centered_flowrate(const float flow, const uint8_t tx, const uint8_t ty) {
  166. const char *str = ftostr11ns(flow);
  167. const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
  168. lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
  169. lcd_put_u8str("L");
  170. }
  171. #endif
  172. #if DO_DRAW_HOTENDS
  173. // Draw hotend bitmap with current and target temperatures
  174. FORCE_INLINE void _draw_hotend_status(const heater_id_t heater_id, const bool blink) {
  175. #if !HEATER_IDLE_HANDLER
  176. UNUSED(blink);
  177. #endif
  178. const bool isHeat = HOTEND_ALT(heater_id);
  179. const uint8_t tx = STATUS_HOTEND_TEXT_X(heater_id);
  180. const celsius_t temp = thermalManager.wholeDegHotend(heater_id),
  181. target = thermalManager.degTargetHotend(heater_id);
  182. #if DISABLED(STATUS_HOTEND_ANIM)
  183. #define STATIC_HOTEND true
  184. #define HOTEND_DOT isHeat
  185. #else
  186. #define STATIC_HOTEND false
  187. #define HOTEND_DOT false
  188. #endif
  189. #if ANIM_HOTEND && BOTH(STATUS_HOTEND_INVERTED, STATUS_HOTEND_NUMBERLESS)
  190. #define OFF_BMP(N) status_hotend_b_bmp
  191. #define ON_BMP(N) status_hotend_a_bmp
  192. #elif ANIM_HOTEND && DISABLED(STATUS_HOTEND_INVERTED) && ENABLED(STATUS_HOTEND_NUMBERLESS)
  193. #define OFF_BMP(N) status_hotend_a_bmp
  194. #define ON_BMP(N) status_hotend_b_bmp
  195. #elif BOTH(ANIM_HOTEND, STATUS_HOTEND_INVERTED)
  196. #define OFF_BMP(N) status_hotend##N##_b_bmp
  197. #define ON_BMP(N) status_hotend##N##_a_bmp
  198. #else
  199. #define OFF_BMP(N) status_hotend##N##_a_bmp
  200. #define ON_BMP(N) status_hotend##N##_b_bmp
  201. #endif
  202. #if STATUS_HOTEND_BITMAPS > 1
  203. static const unsigned char* const status_hotend_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, OFF_BMP(1), OFF_BMP(2), OFF_BMP(3), OFF_BMP(4), OFF_BMP(5), OFF_BMP(6));
  204. #if ANIM_HOTEND
  205. static const unsigned char* const status_hotend_on_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, ON_BMP(1), ON_BMP(2), ON_BMP(3), ON_BMP(4), ON_BMP(5), ON_BMP(6));
  206. #define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr((S) ? &status_hotend_on_gfx[(N) % (STATUS_HOTEND_BITMAPS)] : &status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
  207. #else
  208. #define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr(&status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
  209. #endif
  210. #elif ANIM_HOTEND
  211. #define HOTEND_BITMAP(N,S) ((S) ? ON_BMP() : OFF_BMP())
  212. #else
  213. #define HOTEND_BITMAP(N,S) status_hotend_a_bmp
  214. #endif
  215. if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_BOT)) {
  216. #define BAR_TALL (STATUS_HEATERS_HEIGHT - 2)
  217. const float prop = target - 20,
  218. perc = prop > 0 && temp >= 20 ? (temp - 20) / prop : 0;
  219. uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f);
  220. NOMORE(tall, BAR_TALL);
  221. #if ANIM_HOTEND
  222. // Draw hotend bitmap, either whole or split by the heating percent
  223. const uint8_t hx = STATUS_HOTEND_X(heater_id),
  224. bw = STATUS_HOTEND_BYTEWIDTH(heater_id);
  225. #if ENABLED(STATUS_HEAT_PERCENT)
  226. if (isHeat && tall <= BAR_TALL) {
  227. const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall;
  228. u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(heater_id, false));
  229. u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(heater_id, true) + ph * bw);
  230. }
  231. else
  232. #endif
  233. u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(heater_id, isHeat));
  234. #endif
  235. } // PAGE_CONTAINS
  236. if (PAGE_UNDER(7)) {
  237. #if HEATER_IDLE_HANDLER
  238. const bool dodraw = (blink || !thermalManager.heater_idle[heater_id].timed_out);
  239. #else
  240. constexpr bool dodraw = true;
  241. #endif
  242. if (dodraw) _draw_centered_temp(target, tx, 7);
  243. }
  244. if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
  245. _draw_centered_temp(temp, tx, 28);
  246. if (STATIC_HOTEND && HOTEND_DOT && PAGE_CONTAINS(17, 19)) {
  247. u8g.setColorIndex(0); // set to white on black
  248. u8g.drawBox(tx, 20 - 3, 2, 2);
  249. u8g.setColorIndex(1); // restore black on white
  250. }
  251. }
  252. #endif // DO_DRAW_HOTENDS
  253. #if DO_DRAW_BED
  254. // Draw bed bitmap with current and target temperatures
  255. FORCE_INLINE void _draw_bed_status(const bool blink) {
  256. #if !HEATER_IDLE_HANDLER
  257. UNUSED(blink);
  258. #endif
  259. const uint8_t tx = STATUS_BED_TEXT_X;
  260. const celsius_t temp = thermalManager.wholeDegBed(),
  261. target = thermalManager.degTargetBed();
  262. #if ENABLED(STATUS_HEAT_PERCENT) || DISABLED(STATUS_BED_ANIM)
  263. const bool isHeat = BED_ALT();
  264. #endif
  265. #if DISABLED(STATUS_BED_ANIM)
  266. #define STATIC_BED true
  267. #define BED_DOT isHeat
  268. #else
  269. #define STATIC_BED false
  270. #define BED_DOT false
  271. #endif
  272. if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_BOT)) {
  273. #define BAR_TALL (STATUS_HEATERS_HEIGHT - 2)
  274. const float prop = target - 20,
  275. perc = prop > 0 && temp >= 20 ? (temp - 20) / prop : 0;
  276. uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f);
  277. NOMORE(tall, BAR_TALL);
  278. // Draw a heating progress bar, if specified
  279. #if ENABLED(STATUS_HEAT_PERCENT)
  280. if (isHeat) {
  281. const uint8_t bx = STATUS_BED_X + STATUS_BED_WIDTH;
  282. u8g.drawFrame(bx, STATUS_HEATERS_Y, 3, STATUS_HEATERS_HEIGHT);
  283. if (tall) {
  284. const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall;
  285. if (PAGE_OVER(STATUS_HEATERS_Y + ph))
  286. u8g.drawVLine(bx + 1, STATUS_HEATERS_Y + ph, tall);
  287. }
  288. }
  289. #endif
  290. } // PAGE_CONTAINS
  291. if (PAGE_UNDER(7)) {
  292. #if HEATER_IDLE_HANDLER
  293. const bool dodraw = (blink || !thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out);
  294. #else
  295. constexpr bool dodraw = true;
  296. #endif
  297. if (dodraw) _draw_centered_temp(target, tx, 7);
  298. }
  299. if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
  300. _draw_centered_temp(temp, tx, 28);
  301. if (STATIC_BED && BED_DOT && PAGE_CONTAINS(17, 19)) {
  302. u8g.setColorIndex(0); // set to white on black
  303. u8g.drawBox(tx, 20 - 2, 2, 2);
  304. u8g.setColorIndex(1); // restore black on white
  305. }
  306. }
  307. #endif // DO_DRAW_BED
  308. #if DO_DRAW_CHAMBER
  309. FORCE_INLINE void _draw_chamber_status() {
  310. #if HAS_HEATED_CHAMBER
  311. if (PAGE_UNDER(7))
  312. _draw_centered_temp(thermalManager.degTargetChamber(), STATUS_CHAMBER_TEXT_X, 7);
  313. #endif
  314. if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
  315. _draw_centered_temp(thermalManager.wholeDegChamber(), STATUS_CHAMBER_TEXT_X, 28);
  316. }
  317. #endif
  318. #if DO_DRAW_COOLER
  319. FORCE_INLINE void _draw_cooler_status() {
  320. if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
  321. _draw_centered_temp(thermalManager.wholeDegCooler(), STATUS_COOLER_TEXT_X, 28);
  322. }
  323. #endif
  324. #if DO_DRAW_FLOWMETER
  325. FORCE_INLINE void _draw_flowmeter_status() {
  326. if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
  327. _draw_centered_flowrate(cooler.flowrate, STATUS_FLOWMETER_TEXT_X, 28);
  328. }
  329. #endif
  330. //
  331. // Before homing, blink '123' <-> '???'.
  332. // Homed but unknown... '123' <-> ' '.
  333. // Homed and known, display constantly.
  334. //
  335. FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
  336. const bool is_inch = parser.using_inch_units();
  337. const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
  338. const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING);
  339. lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, axis_codes[axis]);
  340. lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE);
  341. if (blink)
  342. lcd_put_u8str(value);
  343. else if (axis_should_home(axis))
  344. while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
  345. else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
  346. lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
  347. else
  348. lcd_put_u8str(value);
  349. }
  350. /**
  351. * Draw the Status Screen for a 128x64 DOGM (U8glib) display.
  352. *
  353. * Called as needed to update the current display stripe.
  354. * Use the PAGE_CONTAINS macros to avoid pointless draw calls.
  355. */
  356. void MarlinUI::draw_status_screen() {
  357. constexpr int xystorage = TERN(INCH_MODE_SUPPORT, 8, 5);
  358. static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, xystorage)], ystring[xystorage], zstring[8];
  359. #if ENABLED(FILAMENT_LCD_DISPLAY)
  360. static char wstring[5], mstring[4];
  361. #endif
  362. #if HAS_PRINT_PROGRESS
  363. #if DISABLED(DOGM_SD_PERCENT)
  364. #define _SD_INFO_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2)
  365. #else
  366. #define _SD_INFO_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
  367. #endif
  368. #if ENABLED(DOGM_SD_PERCENT)
  369. static char progress_string[5];
  370. #endif
  371. static uint8_t lastElapsed = 0xFF, lastProgress = 0xFF;
  372. static u8g_uint_t elapsed_x_pos = 0, progress_bar_solid_width = 0;
  373. static char elapsed_string[16];
  374. #if ENABLED(SHOW_REMAINING_TIME)
  375. static u8g_uint_t estimation_x_pos = 0;
  376. static char estimation_string[10];
  377. #if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
  378. static u8g_uint_t progress_x_pos = 0;
  379. static uint8_t progress_state = 0;
  380. static bool prev_blink = 0;
  381. #endif
  382. #endif
  383. #endif
  384. const bool show_e_total = TERN0(LCD_SHOW_E_TOTAL, printingIsActive() || marlin_state == MF_SD_COMPLETE);
  385. // At the first page, generate new display values
  386. if (first_page) {
  387. #if ANIM_HBCC
  388. uint8_t new_bits = 0;
  389. #if ANIM_HOTEND
  390. HOTEND_LOOP() if (thermalManager.isHeatingHotend(e)) SBI(new_bits, DRAWBIT_HOTEND + e);
  391. #endif
  392. if (TERN0(ANIM_BED, thermalManager.isHeatingBed())) SBI(new_bits, DRAWBIT_BED);
  393. #if DO_DRAW_CHAMBER && HAS_HEATED_CHAMBER
  394. if (thermalManager.isHeatingChamber()) SBI(new_bits, DRAWBIT_CHAMBER);
  395. #endif
  396. if (TERN0(ANIM_CUTTER, cutter.enabled())) SBI(new_bits, DRAWBIT_CUTTER);
  397. draw_bits = new_bits;
  398. #endif
  399. const xyz_pos_t lpos = current_position.asLogical();
  400. const bool is_inch = parser.using_inch_units();
  401. strcpy(zstring, is_inch ? ftostr42_52(LINEAR_UNIT(lpos.z)) : ftostr52sp(lpos.z));
  402. if (show_e_total) {
  403. #if ENABLED(LCD_SHOW_E_TOTAL)
  404. const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
  405. sprintf_P(xstring, PSTR("%ld%cm"), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
  406. #endif
  407. }
  408. else {
  409. strcpy(xstring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.x)) : ftostr4sign(lpos.x));
  410. strcpy(ystring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.y)) : ftostr4sign(lpos.y));
  411. }
  412. #if ENABLED(FILAMENT_LCD_DISPLAY)
  413. strcpy(wstring, ftostr12ns(filwidth.measured_mm));
  414. strcpy(mstring, i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
  415. #endif
  416. // Progress / elapsed / estimation updates and string formatting to avoid float math on each LCD draw
  417. #if HAS_PRINT_PROGRESS
  418. const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
  419. duration_t elapsed = print_job_timer.duration();
  420. const uint8_t p = progress & 0xFF, ev = elapsed.value & 0xFF;
  421. if (p != lastProgress) {
  422. lastProgress = p;
  423. progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * (progress / (PROGRESS_SCALE)) * 0.01f);
  424. #if ENABLED(DOGM_SD_PERCENT)
  425. if (progress == 0) {
  426. progress_string[0] = '\0';
  427. #if ENABLED(SHOW_REMAINING_TIME)
  428. estimation_string[0] = '\0';
  429. estimation_x_pos = _SD_INFO_X(0);
  430. #endif
  431. }
  432. else
  433. strcpy(progress_string, TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
  434. #if BOTH(SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) // Tri-state progress display mode
  435. progress_x_pos = _SD_INFO_X(strlen(progress_string) + 1);
  436. #endif
  437. #endif
  438. }
  439. constexpr bool can_show_days = DISABLED(DOGM_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
  440. if (ev != lastElapsed) {
  441. lastElapsed = ev;
  442. const uint8_t len = elapsed.toDigital(elapsed_string, can_show_days && elapsed.value >= 60*60*24L);
  443. elapsed_x_pos = _SD_INFO_X(len);
  444. #if ENABLED(SHOW_REMAINING_TIME)
  445. if (!(ev & 0x3)) {
  446. uint32_t timeval = (0
  447. #if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
  448. + get_remaining_time()
  449. #endif
  450. );
  451. if (!timeval && progress > 0) timeval = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
  452. if (!timeval) {
  453. estimation_string[0] = '\0';
  454. estimation_x_pos = _SD_INFO_X(0);
  455. }
  456. else {
  457. duration_t estimation = timeval;
  458. const uint8_t len = estimation.toDigital(estimation_string, can_show_days && estimation.value >= 60*60*24L);
  459. estimation_x_pos = _SD_INFO_X(len
  460. #if !BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
  461. + 1
  462. #endif
  463. );
  464. }
  465. }
  466. #endif
  467. }
  468. #endif
  469. }
  470. const bool blink = get_blink();
  471. // Status Menu Font
  472. set_font(FONT_STATUSMENU);
  473. #if DO_DRAW_LOGO
  474. if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1))
  475. u8g.drawBitmapP(STATUS_LOGO_X, STATUS_LOGO_Y, STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, status_logo_bmp);
  476. #endif
  477. #if STATUS_HEATERS_WIDTH
  478. // Draw all heaters (and maybe the bed) in one go
  479. if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1))
  480. u8g.drawBitmapP(STATUS_HEATERS_X, STATUS_HEATERS_Y, STATUS_HEATERS_BYTEWIDTH, STATUS_HEATERS_HEIGHT, status_heaters_bmp);
  481. #endif
  482. #if DO_DRAW_CUTTER && DISABLED(STATUS_COMBINE_HEATERS)
  483. #if ANIM_CUTTER
  484. #define CUTTER_BITMAP(S) ((S) ? status_cutter_on_bmp : status_cutter_bmp)
  485. #else
  486. #define CUTTER_BITMAP(S) status_cutter_bmp
  487. #endif
  488. const uint8_t cuttery = STATUS_CUTTER_Y(CUTTER_ALT()),
  489. cutterh = STATUS_CUTTER_HEIGHT(CUTTER_ALT());
  490. if (PAGE_CONTAINS(cuttery, cuttery + cutterh - 1))
  491. u8g.drawBitmapP(STATUS_CUTTER_X, cuttery, STATUS_CUTTER_BYTEWIDTH, cutterh, CUTTER_BITMAP(CUTTER_ALT()));
  492. #endif
  493. #if DO_DRAW_BED && DISABLED(STATUS_COMBINE_HEATERS)
  494. #if ANIM_BED
  495. #define BED_BITMAP(S) ((S) ? status_bed_on_bmp : status_bed_bmp)
  496. #else
  497. #define BED_BITMAP(S) status_bed_bmp
  498. #endif
  499. const uint8_t bedy = STATUS_BED_Y(BED_ALT()),
  500. bedh = STATUS_BED_HEIGHT(BED_ALT());
  501. if (PAGE_CONTAINS(bedy, bedy + bedh - 1))
  502. u8g.drawBitmapP(STATUS_BED_X, bedy, STATUS_BED_BYTEWIDTH, bedh, BED_BITMAP(BED_ALT()));
  503. #endif
  504. #if DO_DRAW_CHAMBER && DISABLED(STATUS_COMBINE_HEATERS)
  505. #if ANIM_CHAMBER
  506. #define CHAMBER_BITMAP(S) ((S) ? status_chamber_on_bmp : status_chamber_bmp)
  507. #else
  508. #define CHAMBER_BITMAP(S) status_chamber_bmp
  509. #endif
  510. const uint8_t chambery = STATUS_CHAMBER_Y(CHAMBER_ALT()),
  511. chamberh = STATUS_CHAMBER_HEIGHT(CHAMBER_ALT());
  512. if (PAGE_CONTAINS(chambery, chambery + chamberh - 1))
  513. u8g.drawBitmapP(STATUS_CHAMBER_X, chambery, STATUS_CHAMBER_BYTEWIDTH, chamberh, CHAMBER_BITMAP(CHAMBER_ALT()));
  514. #endif
  515. #if DO_DRAW_FAN
  516. #if STATUS_FAN_FRAMES > 2
  517. static bool old_blink;
  518. static uint8_t fan_frame;
  519. if (old_blink != blink) {
  520. old_blink = blink;
  521. if (!thermalManager.fan_speed[0] || ++fan_frame >= STATUS_FAN_FRAMES) fan_frame = 0;
  522. }
  523. #endif
  524. if (PAGE_CONTAINS(STATUS_FAN_Y, STATUS_FAN_Y + STATUS_FAN_HEIGHT - 1))
  525. u8g.drawBitmapP(STATUS_FAN_X, STATUS_FAN_Y, STATUS_FAN_BYTEWIDTH, STATUS_FAN_HEIGHT,
  526. #if STATUS_FAN_FRAMES > 2
  527. fan_frame == 1 ? status_fan1_bmp :
  528. fan_frame == 2 ? status_fan2_bmp :
  529. #if STATUS_FAN_FRAMES > 3
  530. fan_frame == 3 ? status_fan3_bmp :
  531. #endif
  532. #elif STATUS_FAN_FRAMES > 1
  533. blink && thermalManager.fan_speed[0] ? status_fan1_bmp :
  534. #endif
  535. status_fan0_bmp
  536. );
  537. #endif
  538. //
  539. // Temperature Graphics and Info
  540. //
  541. if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) {
  542. // Extruders
  543. #if DO_DRAW_HOTENDS
  544. LOOP_L_N(e, MAX_HOTEND_DRAW)
  545. _draw_hotend_status((heater_id_t)e, blink);
  546. #endif
  547. // Laser / Spindle
  548. #if DO_DRAW_CUTTER
  549. if (cutter.isReady && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) {
  550. #if CUTTER_UNIT_IS(PERCENT)
  551. lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
  552. #elif CUTTER_UNIT_IS(RPM)
  553. lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr51rj(float(cutter.unitPower) / 1000));
  554. lcd_put_wchar('K');
  555. #else
  556. lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
  557. #endif
  558. }
  559. #endif
  560. // Laser Cooler
  561. #if DO_DRAW_COOLER
  562. const uint8_t coolery = STATUS_COOLER_Y(status_cooler_bmp1),
  563. coolerh = STATUS_COOLER_HEIGHT(status_cooler_bmp1);
  564. if (PAGE_CONTAINS(coolery, coolery + coolerh - 1))
  565. u8g.drawBitmapP(STATUS_COOLER_X, coolery, STATUS_COOLER_BYTEWIDTH, coolerh, blink && cooler.enabled ? status_cooler_bmp2 : status_cooler_bmp1);
  566. #endif
  567. // Laser Cooler Flow Meter
  568. #if DO_DRAW_FLOWMETER
  569. const uint8_t flowmetery = STATUS_FLOWMETER_Y(status_flowmeter_bmp1),
  570. flowmeterh = STATUS_FLOWMETER_HEIGHT(status_flowmeter_bmp1);
  571. if (PAGE_CONTAINS(flowmetery, flowmetery + flowmeterh - 1))
  572. u8g.drawBitmapP(STATUS_FLOWMETER_X, flowmetery, STATUS_FLOWMETER_BYTEWIDTH, flowmeterh, blink && cooler.flowpulses ? status_flowmeter_bmp2 : status_flowmeter_bmp1);
  573. #endif
  574. // Heated Bed
  575. TERN_(DO_DRAW_BED, _draw_bed_status(blink));
  576. // Heated Chamber
  577. TERN_(DO_DRAW_CHAMBER, _draw_chamber_status());
  578. // Cooler
  579. TERN_(DO_DRAW_COOLER, _draw_cooler_status());
  580. // Flowmeter
  581. TERN_(DO_DRAW_FLOWMETER, _draw_flowmeter_status());
  582. // Fan, if a bitmap was provided
  583. #if DO_DRAW_FAN
  584. if (PAGE_CONTAINS(STATUS_FAN_TEXT_Y - INFO_FONT_ASCENT, STATUS_FAN_TEXT_Y - 1)) {
  585. char c = '%';
  586. uint16_t spd = thermalManager.fan_speed[0];
  587. if (spd) {
  588. #if ENABLED(ADAPTIVE_FAN_SLOWING)
  589. if (!blink && thermalManager.fan_speed_scaler[0] < 128) {
  590. spd = thermalManager.scaledFanSpeed(0, spd);
  591. c = '*';
  592. }
  593. #endif
  594. lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd)));
  595. lcd_put_wchar(c);
  596. }
  597. }
  598. #endif
  599. }
  600. #if ENABLED(SDSUPPORT)
  601. //
  602. // SD Card Symbol
  603. //
  604. if (card.isFileOpen() && PAGE_CONTAINS(42, 51)) {
  605. // Upper box
  606. u8g.drawBox(42, 42, 8, 7); // 42-48 (or 41-47)
  607. // Right edge
  608. u8g.drawBox(50, 44, 2, 5); // 44-48 (or 43-47)
  609. // Bottom hollow box
  610. u8g.drawFrame(42, 49, 10, 4); // 49-52 (or 48-51)
  611. // Corner pixel
  612. u8g.drawPixel(50, 43); // 43 (or 42)
  613. }
  614. #endif // SDSUPPORT
  615. #if HAS_PRINT_PROGRESS
  616. //
  617. // Progress bar frame
  618. //
  619. if (PAGE_CONTAINS(PROGRESS_BAR_Y, PROGRESS_BAR_Y + 3))
  620. u8g.drawFrame(PROGRESS_BAR_X, PROGRESS_BAR_Y, PROGRESS_BAR_WIDTH, 4);
  621. //
  622. // Progress bar solid part
  623. //
  624. if (PAGE_CONTAINS(PROGRESS_BAR_Y + 1, PROGRESS_BAR_Y + 2))
  625. u8g.drawBox(PROGRESS_BAR_X + 1, PROGRESS_BAR_Y + 1, progress_bar_solid_width, 2);
  626. if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
  627. #if ALL(DOGM_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY)
  628. if (prev_blink != blink) {
  629. prev_blink = blink;
  630. if (++progress_state >= 3) progress_state = 0;
  631. }
  632. if (progress_state == 0) {
  633. if (progress_string[0]) {
  634. lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
  635. lcd_put_wchar('%');
  636. }
  637. }
  638. else if (progress_state == 2 && estimation_string[0]) {
  639. lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, PSTR("R:"));
  640. lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
  641. }
  642. else if (elapsed_string[0]) {
  643. lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, E_LBL);
  644. lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
  645. }
  646. #else // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
  647. //
  648. // SD Percent Complete
  649. //
  650. #if ENABLED(DOGM_SD_PERCENT)
  651. if (progress_string[0]) {
  652. lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
  653. lcd_put_wchar('%');
  654. }
  655. #endif
  656. //
  657. // Elapsed Time
  658. //
  659. #if ENABLED(SHOW_REMAINING_TIME)
  660. if (blink && estimation_string[0]) {
  661. lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
  662. lcd_put_u8str(estimation_string);
  663. }
  664. else
  665. #endif
  666. lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
  667. #endif // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
  668. }
  669. #endif // HAS_PRINT_PROGRESS
  670. //
  671. // XYZ Coordinates
  672. //
  673. #if EITHER(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME)
  674. #define XYZ_FRAME_TOP 29
  675. #define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 3
  676. #else
  677. #define XYZ_FRAME_TOP 30
  678. #define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 1
  679. #endif
  680. if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) {
  681. #if DISABLED(XYZ_NO_FRAME)
  682. #if ENABLED(XYZ_HOLLOW_FRAME)
  683. u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39
  684. #else
  685. u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37
  686. #endif
  687. #endif
  688. if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_ASCENT - 1), XYZ_BASELINE)) {
  689. #if NONE(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME)
  690. u8g.setColorIndex(0); // white on black
  691. #endif
  692. #if HAS_DUAL_MIXING
  693. // Two-component mix / gradient instead of XY
  694. char mixer_messages[15];
  695. PGM_P mix_label;
  696. #if ENABLED(GRADIENT_MIX)
  697. if (mixer.gradient.enabled) {
  698. mixer.update_mix_from_gradient();
  699. mix_label = PSTR("Gr");
  700. }
  701. else
  702. #endif
  703. {
  704. mixer.update_mix_from_vtool();
  705. mix_label = PSTR("Mx");
  706. }
  707. #if GCC_VERSION <= 50000
  708. #pragma GCC diagnostic push
  709. #pragma GCC diagnostic ignored "-Wformat-overflow"
  710. #endif
  711. sprintf_P(mixer_messages, PSTR(S_FMT " %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
  712. lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages);
  713. #if GCC_VERSION <= 50000
  714. #pragma GCC diagnostic pop
  715. #endif
  716. #else
  717. if (show_e_total) {
  718. _draw_axis_value(E_AXIS, xstring, true);
  719. lcd_put_u8str_P(PSTR(" "));
  720. }
  721. else {
  722. _draw_axis_value(X_AXIS, xstring, blink);
  723. _draw_axis_value(Y_AXIS, ystring, blink);
  724. }
  725. #endif
  726. _draw_axis_value(Z_AXIS, zstring, blink);
  727. #if NONE(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME)
  728. u8g.setColorIndex(1); // black on white
  729. #endif
  730. }
  731. }
  732. //
  733. // Feedrate
  734. //
  735. #define EXTRAS_2_BASELINE (EXTRAS_BASELINE + 3)
  736. if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
  737. set_font(FONT_MENU);
  738. lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
  739. set_font(FONT_STATUSMENU);
  740. lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
  741. lcd_put_wchar('%');
  742. //
  743. // Filament sensor display if SD is disabled
  744. //
  745. #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
  746. lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
  747. lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
  748. lcd_put_wchar('%');
  749. set_font(FONT_MENU);
  750. lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
  751. lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
  752. #endif
  753. }
  754. //
  755. // Status line
  756. //
  757. if (PAGE_CONTAINS(STATUS_BASELINE - INFO_FONT_ASCENT, STATUS_BASELINE + INFO_FONT_DESCENT)) {
  758. lcd_moveto(0, STATUS_BASELINE);
  759. #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
  760. // Alternate Status message and Filament display
  761. if (ELAPSED(millis(), next_filament_display)) {
  762. lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
  763. lcd_put_wchar(':');
  764. lcd_put_u8str(wstring);
  765. lcd_put_u8str_P(PSTR(" " LCD_STR_FILAM_MUL));
  766. lcd_put_wchar(':');
  767. lcd_put_u8str(mstring);
  768. lcd_put_wchar('%');
  769. return;
  770. }
  771. #endif
  772. draw_status_message(blink);
  773. }
  774. }
  775. /**
  776. * Draw the Status Message area
  777. */
  778. void MarlinUI::draw_status_message(const bool blink) {
  779. // Get the UTF8 character count of the string
  780. uint8_t lcd_width = LCD_WIDTH, pixel_width = LCD_PIXEL_WIDTH,
  781. slen = utf8_strlen(status_message);
  782. #if HAS_POWER_MONITOR
  783. if (power_monitor.display_enabled()) {
  784. // make room at the end of the status line for the power monitor reading
  785. lcd_width -= 6;
  786. pixel_width -= (MENU_FONT_WIDTH) * 6;
  787. }
  788. #endif
  789. #if ENABLED(STATUS_MESSAGE_SCROLLING)
  790. static bool last_blink = false;
  791. if (slen <= lcd_width) {
  792. // The string fits within the line. Print with no scrolling
  793. lcd_put_u8str(status_message);
  794. while (slen < lcd_width) { lcd_put_wchar(' '); ++slen; }
  795. }
  796. else {
  797. // String is longer than the available space
  798. if (blink != last_blink) {
  799. last_blink = blink;
  800. advance_status_scroll();
  801. }
  802. // Get a pointer to the next valid UTF8 character
  803. // and the string remaining length
  804. uint8_t rlen;
  805. const char *stat = status_and_len(rlen);
  806. lcd_put_u8str_max(stat, pixel_width);
  807. // If the remaining string doesn't completely fill the screen
  808. if (rlen < lcd_width) {
  809. uint8_t chars = lcd_width - rlen; // Amount of space left in characters
  810. lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
  811. if (--chars) { // Draw a second space if there's room
  812. lcd_put_wchar(' ');
  813. if (--chars) { // Draw a third space if there's room
  814. lcd_put_wchar(' ');
  815. if (--chars) { // Print a second copy of the message
  816. lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
  817. lcd_put_wchar(' ');
  818. }
  819. }
  820. }
  821. }
  822. }
  823. #else // !STATUS_MESSAGE_SCROLLING
  824. UNUSED(blink);
  825. // Just print the string to the LCD
  826. lcd_put_u8str_max(status_message, pixel_width);
  827. // Fill the rest with spaces
  828. for (; slen < lcd_width; ++slen) lcd_put_wchar(' ');
  829. #endif // !STATUS_MESSAGE_SCROLLING
  830. #if HAS_POWER_MONITOR
  831. display_power_monitor(pixel_width + MENU_FONT_WIDTH, STATUS_BASELINE);
  832. #endif
  833. }
  834. #endif // HAS_MARLINUI_U8GLIB && !LIGHTWEIGHT_UI