Browse Source

Fix boot screen warning

Scott Lahteine 6 years ago
parent
commit
5c0e5c599f
1 changed files with 10 additions and 9 deletions
  1. 10
    9
      Marlin/src/lcd/dogm/ultralcd_DOGM.cpp

+ 10
- 9
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp View File

@@ -168,14 +168,13 @@ bool MarlinUI::detected() { return true; }
168 168
     // Determine text space needed
169 169
     #ifndef STRING_SPLASH_LINE2
170 170
       constexpr u8g_uint_t text_total_height = MENU_FONT_HEIGHT,
171
-                           text_width_1 = u8g_uint_t(sizeof(STRING_SPLASH_LINE1) - 1) * u8g_uint_t(MENU_FONT_WIDTH),
172 171
                            text_width_2 = 0;
173 172
     #else
174
-      constexpr u8g_uint_t text_total_height = u8g_uint_t(MENU_FONT_HEIGHT) * 2,
175
-                           text_width_1 = u8g_uint_t(sizeof(STRING_SPLASH_LINE1) - 1) * u8g_uint_t(MENU_FONT_WIDTH),
176
-                           text_width_2 = u8g_uint_t(sizeof(STRING_SPLASH_LINE2) - 1) * u8g_uint_t(MENU_FONT_WIDTH);
173
+      constexpr u8g_uint_t text_total_height = (MENU_FONT_HEIGHT) * 2,
174
+                           text_width_2 = u8g_uint_t((sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH));
177 175
     #endif
178
-    constexpr u8g_uint_t text_max_width = _MAX(text_width_1, text_width_2),
176
+    constexpr u8g_uint_t text_width_1 = u8g_uint_t((sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)),
177
+                         text_max_width = _MAX(text_width_1, text_width_2),
179 178
                          rspace = width - (START_BMPWIDTH);
180 179
 
181 180
     u8g_int_t offx, offy, txt_base, txt_offx_1, txt_offx_2;
@@ -199,14 +198,16 @@ bool MarlinUI::detected() { return true; }
199 198
     NOLESS(offx, 0);
200 199
     NOLESS(offy, 0);
201 200
 
202
-    auto draw_bootscreen_bmp = [offx, offy, txt_base, txt_offx_1, txt_offx_2](const uint8_t *bitmap) {
201
+    auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
203 202
       u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
204 203
       set_font(FONT_MENU);
204
+      const u8g_pgm_uint8_t splash1[] U8G_PROGMEM  = STRING_SPLASH_LINE1;
205 205
       #ifndef STRING_SPLASH_LINE2
206
-        u8g.drawStr(txt_offx_1, txt_base, STRING_SPLASH_LINE1);
206
+        u8g.drawStrP(txt_offx_1, txt_base, splash1);
207 207
       #else
208
-        u8g.drawStr(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), STRING_SPLASH_LINE1);
209
-        u8g.drawStr(txt_offx_2, txt_base, STRING_SPLASH_LINE2);
208
+        const u8g_pgm_uint8_t splash2[] U8G_PROGMEM  = STRING_SPLASH_LINE2;
209
+        u8g.drawStrP(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), splash1);
210
+        u8g.drawStrP(txt_offx_2, txt_base, splash2);
210 211
       #endif
211 212
     };
212 213
 

Loading…
Cancel
Save