Browse Source

Improves the custom bootscreen logo feature

João Brázio 8 years ago
parent
commit
fa4274cf4c
4 changed files with 36 additions and 99 deletions
  1. 16
    0
      Marlin/Configuration.h
  2. 0
    77
      Marlin/dogm_custom_bitmaps.h
  3. 17
    21
      Marlin/dogm_lcd_implementation.h
  4. 3
    1
      Marlin/macros.h

+ 16
- 0
Marlin/Configuration.h View File

@@ -100,6 +100,22 @@
100 100
 #define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1
101 101
 #define STRING_SPLASH_LINE2 WEBSITE_URL         // will be shown during bootup in line 2
102 102
 
103
+//
104
+// *** VENDORS PLEASE READ *****************************************************
105
+//
106
+// Marlin now allow you to have a vendor boot image to be displayed on machine
107
+// start. When SHOW_CUSTOM_BOOTSCREEN is defined Marlin will first show your
108
+// custom boot image and them the default Marlin boot image is shown.
109
+//
110
+// We suggest for you to take advantage of this new feature and keep the Marlin
111
+// boot image unmodified. For an example have a look at the bq Hephestos 2
112
+// example configuration folder.
113
+//
114
+//#define SHOW_CUSTOM_BOOTSCREEN
115
+#if ENABLED(SHOW_BOOTSCREEN) && ENABLED(SHOW_CUSTOM_BOOTSCREEN)
116
+  #include "_Bootscreen.h"
117
+#endif
118
+
103 119
 // @section machine
104 120
 
105 121
 // SERIAL_PORT selects which serial port should be used for communication with the host.

+ 0
- 77
Marlin/dogm_custom_bitmaps.h View File

@@ -1,77 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-/**
24
- * BitMap for custom splashscreen
25
- * Generated with: http://www.digole.com/tools/PicturetoC_Hex_converter.php
26
- */
27
-
28
-//#define CUSTOM_START_BMP
29
-
30
-#if ENABLED(CUSTOM_START_BMP)
31
-  
32
-  #define CUSTOM_START_BMP_DELAY     2000
33
-  #define CUSTOM_START_BMPWIDTH      112
34
-  #define CUSTOM_START_BMPHEIGHT      38
35
-  #define CUSTOM_START_BMPBYTEWIDTH   14
36
-  #define CUSTOM_START_BMPBYTES      532 // CUSTOM_START_BMPWIDTH * CUSTOM_START_BMPHEIGHT / 8
37
-
38
-  const unsigned char custom_start_bmp[CUSTOM_START_BMPBYTES] PROGMEM = {
39
-    0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
40
-    0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
41
-    0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF,
42
-    0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF,
43
-    0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF,
44
-    0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
45
-    0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF,
46
-    0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x3F, 0xFF,
47
-    0xC0, 0x0F, 0xC0, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x18, 0x00, 0x1F, 0xFF,
48
-    0xC0, 0x3F, 0xE1, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3C, 0x00, 0x0F, 0xFF,
49
-    0xC0, 0x7F, 0xF3, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3C, 0x00, 0x07, 0xFF,
50
-    0xC0, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3C, 0x00, 0x03, 0xFF,
51
-    0xC1, 0xF8, 0x7F, 0x87, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x01, 0xFF,
52
-    0xC1, 0xF0, 0x3F, 0x03, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xFF,
53
-    0xC1, 0xE0, 0x1E, 0x01, 0xE0, 0x1F, 0x00, 0x03, 0xE0, 0x78, 0x3C, 0x03, 0xF0, 0x7F,
54
-    0xC1, 0xE0, 0x1E, 0x01, 0xE0, 0x7F, 0xC0, 0x0F, 0xF8, 0x78, 0x3C, 0x07, 0xFC, 0x3F,
55
-    0xC1, 0xE0, 0x1E, 0x01, 0xE1, 0xFF, 0xE0, 0x1F, 0xFC, 0x78, 0x3C, 0x0F, 0xFE, 0x1F,
56
-    0xC1, 0xE0, 0x1E, 0x01, 0xE3, 0xFF, 0xF0, 0x3F, 0xFE, 0x78, 0x3C, 0x1F, 0xFE, 0x0F,
57
-    0xC1, 0xE0, 0x1E, 0x01, 0xE3, 0xF3, 0xF8, 0x3F, 0x3E, 0x78, 0x3C, 0x3F, 0x3F, 0x07,
58
-    0xC1, 0xE0, 0x1E, 0x01, 0xE7, 0xE0, 0xFC, 0x7C, 0x1F, 0x78, 0x3C, 0x3E, 0x1F, 0x07,
59
-    0xC1, 0xE0, 0x1E, 0x01, 0xE7, 0xC0, 0x7C, 0x7C, 0x0F, 0x78, 0x3C, 0x3C, 0x0F, 0x03,
60
-    0xC1, 0xE0, 0x1E, 0x01, 0xE7, 0x80, 0x7C, 0x78, 0x0F, 0x78, 0x3C, 0x3C, 0x0F, 0x03,
61
-    0xC1, 0xE0, 0x1E, 0x01, 0xE7, 0x80, 0x3C, 0x78, 0x00, 0x78, 0x3C, 0x3C, 0x0F, 0x03,
62
-    0xC1, 0xE0, 0x1E, 0x01, 0xE7, 0x80, 0x3C, 0x78, 0x00, 0x78, 0x3C, 0x3C, 0x0F, 0x03,
63
-    0xC1, 0xE0, 0x1E, 0x01, 0xE7, 0x80, 0x3C, 0x78, 0x00, 0x78, 0x3C, 0x3C, 0x0F, 0x03,
64
-    0xC1, 0xE0, 0x1E, 0x01, 0xE7, 0xC0, 0x3C, 0x78, 0x00, 0x78, 0x3C, 0x3C, 0x0F, 0x03,
65
-    0xC1, 0xE0, 0x1E, 0x01, 0xE3, 0xE0, 0x3C, 0x78, 0x00, 0x7C, 0x3C, 0x3C, 0x0F, 0x03,
66
-    0xC1, 0xE0, 0x1E, 0x01, 0xE3, 0xFF, 0x3F, 0xF8, 0x00, 0x7F, 0xBC, 0x3C, 0x0F, 0x03,
67
-    0xC1, 0xE0, 0x1E, 0x01, 0xE1, 0xFF, 0x3F, 0xF8, 0x00, 0x3F, 0xBF, 0xFC, 0x0F, 0x03,
68
-    0xC1, 0xE0, 0x1E, 0x01, 0xE0, 0xFF, 0x3F, 0xF8, 0x00, 0x1F, 0xBF, 0xFC, 0x0F, 0x03,
69
-    0xC1, 0xE0, 0x1E, 0x01, 0xE0, 0x7F, 0x3F, 0xF8, 0x00, 0x0F, 0xBF, 0xFC, 0x0F, 0x03,
70
-    0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
71
-    0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
72
-    0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E,
73
-    0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
74
-    0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
75
-    0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0,
76
-    0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80 };
77
-#endif

+ 17
- 21
Marlin/dogm_lcd_implementation.h View File

@@ -53,8 +53,6 @@
53 53
 
54 54
 #include <U8glib.h>
55 55
 #include "dogm_bitmaps.h"
56
-#include "dogm_custom_bitmaps.h"
57
-
58 56
 
59 57
 #include "ultralcd.h"
60 58
 #include "ultralcd_st7920_u8glib_rrd.h"
@@ -220,10 +218,6 @@ char lcd_printPGM(const char* str) {
220 218
   return n;
221 219
 }
222 220
 
223
-#if ENABLED(SHOW_BOOTSCREEN)
224
-  static bool show_bootscreen = true;
225
-#endif
226
-
227 221
 /* Warning: This function is called from interrupt context */
228 222
 static void lcd_implementation_init() {
229 223
 
@@ -241,11 +235,6 @@ static void lcd_implementation_init() {
241 235
     u8g.setContrast(lcd_contrast);
242 236
   #endif
243 237
 
244
-  // FIXME: remove this workaround
245
-  // Uncomment this if you have the first generation (V1.10) of STBs board
246
-  // pinMode(17, OUTPUT); // Enable LCD backlight
247
-  // digitalWrite(17, HIGH);
248
-
249 238
   #if ENABLED(LCD_SCREEN_ROT_90)
250 239
     u8g.setRot90();   // Rotate screen by 90°
251 240
   #elif ENABLED(LCD_SCREEN_ROT_180)
@@ -255,16 +244,23 @@ static void lcd_implementation_init() {
255 244
   #endif
256 245
 
257 246
   #if ENABLED(SHOW_BOOTSCREEN)
258
-    #if ENABLED(CUSTOM_START_BMP)
247
+    static bool show_bootscreen = true;
248
+
249
+    #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
259 250
       if (show_bootscreen) {
260 251
         u8g.firstPage();
261 252
         do {
262
-            u8g.drawBitmapP((128-(CUSTOM_START_BMPWIDTH))/2, (64 - (CUSTOM_START_BMPHEIGHT))/2, CUSTOM_START_BMPBYTEWIDTH, CUSTOM_START_BMPHEIGHT, custom_start_bmp);
253
+          u8g.drawBitmapP(
254
+            (128 - (CUSTOM_BOOTSCREEN_BMPWIDTH))  /2,
255
+            ( 64 - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) /2,
256
+            CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, custom_start_bmp);
263 257
         } while (u8g.nextPage());
264
-        delay(CUSTOM_START_BMP_DELAY);
258
+        safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
265 259
       }
266
-    #endif
260
+    #endif // SHOW_CUSTOM_BOOTSCREEN
261
+
267 262
     int offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;
263
+
268 264
     #if ENABLED(START_BMPHIGH)
269 265
       int offy = 0;
270 266
     #else
@@ -273,9 +269,9 @@ static void lcd_implementation_init() {
273 269
 
274 270
     int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
275 271
 
276
-    u8g.firstPage();
277
-    do {
278
-      if (show_bootscreen) {
272
+    if (show_bootscreen) {
273
+      u8g.firstPage();
274
+      do {
279 275
         u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
280 276
         lcd_setFont(FONT_MENU);
281 277
         #ifndef STRING_SPLASH_LINE2
@@ -285,12 +281,12 @@ static void lcd_implementation_init() {
285 281
           u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
286 282
           u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
287 283
         #endif
288
-      }
289
-    } while (u8g.nextPage());
284
+      } while (u8g.nextPage());
285
+    }
290 286
 
291 287
     show_bootscreen = false;
292 288
 
293
-  #endif
289
+  #endif // SHOW_BOOTSCREEN
294 290
 }
295 291
 
296 292
 void lcd_kill_screen() {

+ 3
- 1
Marlin/macros.h View File

@@ -97,6 +97,8 @@
97 97
 #define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)
98 98
 #define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))
99 99
 
100
-#define NOOP do{}while(0)
100
+#define NOOP do{} while(0)
101
+
102
+#define CEILING(x,y) (((x) + (y) - 1) / (y))
101 103
 
102 104
 #endif //__MACROS_H

Loading…
Cancel
Save