Просмотр исходного кода

Make bootscreen configurable for the graphic displays

Saves about 473 byte of progmem and 28 bytes of RAM.
AnHardt 8 лет назад
Родитель
Сommit
4f46df5dab
3 измененных файлов: 109 добавлений и 101 удалений
  1. 0
    1
      Marlin/Marlin_main.cpp
  2. 72
    70
      Marlin/dogm_bitmaps.h
  3. 37
    30
      Marlin/dogm_lcd_implementation.h

+ 0
- 1
Marlin/Marlin_main.cpp Просмотреть файл

@@ -666,7 +666,6 @@ void setup() {
666 666
   Config_RetrieveSettings();
667 667
 
668 668
   lcd_init();
669
-  _delay_ms(1000);  // wait 1sec to display the splash screen
670 669
 
671 670
   tp_init();    // Initialize temperature loop
672 671
   plan_init();  // Initialize planner;

+ 72
- 70
Marlin/dogm_bitmaps.h Просмотреть файл

@@ -3,77 +3,79 @@
3 3
 // Please note that using the high-res version takes 402Bytes of PROGMEM. 
4 4
 //#define START_BMPHIGH
5 5
 
6
-#if ENABLED(START_BMPHIGH)
7
-  #define START_BMPWIDTH      112
8
-  #define START_BMPHEIGHT      38
9
-  #define START_BMPBYTEWIDTH   14
10
-  #define START_BMPBYTES      532 // START_BMPWIDTH * START_BMPHEIGHT / 8
11
-  
12
-  const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
13
-     0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
14
-    ,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
15
-    ,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff
16
-    ,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff
17
-    ,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff
18
-    ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff
19
-    ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff
20
-    ,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x3f,0xff
21
-    ,0xc0,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x00,0x00,0x78,0x18,0x00,0x1f,0xff
22
-    ,0xc0,0x3f,0xe1,0xff,0x00,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x0f,0xff
23
-    ,0xc0,0x7f,0xf3,0xff,0x80,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x07,0xff
24
-    ,0xc0,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x03,0xff
25
-    ,0xc1,0xf8,0x7f,0x87,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xff
26
-    ,0xc1,0xf0,0x3f,0x03,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xff
27
-    ,0xc1,0xe0,0x1e,0x01,0xe0,0x1f,0x00,0x03,0xe0,0x78,0x3c,0x03,0xf0,0x7f
28
-    ,0xc1,0xe0,0x1e,0x01,0xe0,0x7f,0xc0,0x0f,0xf8,0x78,0x3c,0x07,0xfc,0x3f
29
-    ,0xc1,0xe0,0x1e,0x01,0xe1,0xff,0xe0,0x1f,0xfc,0x78,0x3c,0x0f,0xfe,0x1f
30
-    ,0xc1,0xe0,0x1e,0x01,0xe3,0xff,0xf0,0x3f,0xfe,0x78,0x3c,0x1f,0xfe,0x0f
31
-    ,0xc1,0xe0,0x1e,0x01,0xe3,0xf3,0xf8,0x3f,0x3e,0x78,0x3c,0x3f,0x3f,0x07
32
-    ,0xc1,0xe0,0x1e,0x01,0xe7,0xe0,0xfc,0x7c,0x1f,0x78,0x3c,0x3e,0x1f,0x07
33
-    ,0xc1,0xe0,0x1e,0x01,0xe7,0xc0,0x7c,0x7c,0x0f,0x78,0x3c,0x3c,0x0f,0x03
34
-    ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x7c,0x78,0x0f,0x78,0x3c,0x3c,0x0f,0x03
35
-    ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
36
-    ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
37
-    ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
38
-    ,0xc1,0xe0,0x1e,0x01,0xe7,0xc0,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
39
-    ,0xc1,0xe0,0x1e,0x01,0xe3,0xe0,0x3c,0x78,0x00,0x7c,0x3c,0x3c,0x0f,0x03
40
-    ,0xc1,0xe0,0x1e,0x01,0xe3,0xff,0x3f,0xf8,0x00,0x7f,0xbc,0x3c,0x0f,0x03
41
-    ,0xc1,0xe0,0x1e,0x01,0xe1,0xff,0x3f,0xf8,0x00,0x3f,0xbf,0xfc,0x0f,0x03
42
-    ,0xc1,0xe0,0x1e,0x01,0xe0,0xff,0x3f,0xf8,0x00,0x1f,0xbf,0xfc,0x0f,0x03
43
-    ,0xc1,0xe0,0x1e,0x01,0xe0,0x7f,0x3f,0xf8,0x00,0x0f,0xbf,0xfc,0x0f,0x03
44
-    ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07
45
-    ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06
46
-    ,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e
47
-    ,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c
48
-    ,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78
49
-    ,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
50
-    ,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80 };
51
-#else
52
-  #define START_BMPWIDTH 	    56 
53
-  #define START_BMPHEIGHT 	  19
54
-  #define START_BMPBYTEWIDTH  7
55
-  #define START_BMPBYTES      133 // START_BMPWIDTH * START_BMPHEIGHT / 8
6
+#if ENABLED(SHOW_BOOTSCREEN)
7
+  #if ENABLED(START_BMPHIGH)
8
+    #define START_BMPWIDTH      112
9
+    #define START_BMPHEIGHT      38
10
+    #define START_BMPBYTEWIDTH   14
11
+    #define START_BMPBYTES      532 // START_BMPWIDTH * START_BMPHEIGHT / 8
12
+
13
+    const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
14
+       0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
15
+      ,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
16
+      ,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff
17
+      ,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff
18
+      ,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff
19
+      ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff
20
+      ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff
21
+      ,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x3f,0xff
22
+      ,0xc0,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x00,0x00,0x78,0x18,0x00,0x1f,0xff
23
+      ,0xc0,0x3f,0xe1,0xff,0x00,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x0f,0xff
24
+      ,0xc0,0x7f,0xf3,0xff,0x80,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x07,0xff
25
+      ,0xc0,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x03,0xff
26
+      ,0xc1,0xf8,0x7f,0x87,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xff
27
+      ,0xc1,0xf0,0x3f,0x03,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xff
28
+      ,0xc1,0xe0,0x1e,0x01,0xe0,0x1f,0x00,0x03,0xe0,0x78,0x3c,0x03,0xf0,0x7f
29
+      ,0xc1,0xe0,0x1e,0x01,0xe0,0x7f,0xc0,0x0f,0xf8,0x78,0x3c,0x07,0xfc,0x3f
30
+      ,0xc1,0xe0,0x1e,0x01,0xe1,0xff,0xe0,0x1f,0xfc,0x78,0x3c,0x0f,0xfe,0x1f
31
+      ,0xc1,0xe0,0x1e,0x01,0xe3,0xff,0xf0,0x3f,0xfe,0x78,0x3c,0x1f,0xfe,0x0f
32
+      ,0xc1,0xe0,0x1e,0x01,0xe3,0xf3,0xf8,0x3f,0x3e,0x78,0x3c,0x3f,0x3f,0x07
33
+      ,0xc1,0xe0,0x1e,0x01,0xe7,0xe0,0xfc,0x7c,0x1f,0x78,0x3c,0x3e,0x1f,0x07
34
+      ,0xc1,0xe0,0x1e,0x01,0xe7,0xc0,0x7c,0x7c,0x0f,0x78,0x3c,0x3c,0x0f,0x03
35
+      ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x7c,0x78,0x0f,0x78,0x3c,0x3c,0x0f,0x03
36
+      ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
37
+      ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
38
+      ,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
39
+      ,0xc1,0xe0,0x1e,0x01,0xe7,0xc0,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
40
+      ,0xc1,0xe0,0x1e,0x01,0xe3,0xe0,0x3c,0x78,0x00,0x7c,0x3c,0x3c,0x0f,0x03
41
+      ,0xc1,0xe0,0x1e,0x01,0xe3,0xff,0x3f,0xf8,0x00,0x7f,0xbc,0x3c,0x0f,0x03
42
+      ,0xc1,0xe0,0x1e,0x01,0xe1,0xff,0x3f,0xf8,0x00,0x3f,0xbf,0xfc,0x0f,0x03
43
+      ,0xc1,0xe0,0x1e,0x01,0xe0,0xff,0x3f,0xf8,0x00,0x1f,0xbf,0xfc,0x0f,0x03
44
+      ,0xc1,0xe0,0x1e,0x01,0xe0,0x7f,0x3f,0xf8,0x00,0x0f,0xbf,0xfc,0x0f,0x03
45
+      ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07
46
+      ,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06
47
+      ,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e
48
+      ,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c
49
+      ,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78
50
+      ,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
51
+      ,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80 };
52
+  #else
53
+    #define START_BMPWIDTH      56
54
+    #define START_BMPHEIGHT     19
55
+    #define START_BMPBYTEWIDTH  7
56
+    #define START_BMPBYTES      133 // START_BMPWIDTH * START_BMPHEIGHT / 8
56 57
 
57
-  const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
58
-     0x1f,0xff,0xff,0xff,0xff,0xff,0xff
59
-    ,0x60,0x00,0x00,0x00,0x00,0x01,0xff
60
-    ,0x40,0x00,0x00,0x00,0x00,0x00,0xff
61
-    ,0x80,0x00,0x00,0x00,0x00,0x00,0x7f
62
-    ,0x83,0xcf,0x00,0x00,0x0c,0x30,0x3f
63
-    ,0x87,0xff,0x80,0x00,0x0c,0x30,0x1f
64
-    ,0x86,0x79,0x80,0x00,0x0c,0x00,0x0f
65
-    ,0x8c,0x30,0xc7,0x83,0x8c,0x30,0xe7
66
-    ,0x8c,0x30,0xcf,0xc7,0xcc,0x31,0xf3
67
-    ,0x8c,0x30,0xdc,0xec,0xec,0x33,0xb9
68
-    ,0x8c,0x30,0xd8,0x6c,0x6c,0x33,0x19
69
-    ,0x8c,0x30,0xd0,0x6c,0x0c,0x33,0x19
70
-    ,0x8c,0x30,0xd8,0x6c,0x0c,0x33,0x19
71
-    ,0x8c,0x30,0xdc,0x6c,0x0e,0x3b,0x19
72
-    ,0x8c,0x30,0xcf,0x7c,0x07,0x9f,0x19
73
-    ,0x8c,0x30,0xc7,0x7c,0x03,0x8f,0x19
74
-    ,0x40,0x00,0x00,0x00,0x00,0x00,0x02
75
-    ,0x60,0x00,0x00,0x00,0x00,0x00,0x06
76
-    ,0x1f,0xff,0xff,0xff,0xff,0xff,0xf8 };
58
+    const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
59
+       0x1f,0xff,0xff,0xff,0xff,0xff,0xff
60
+      ,0x60,0x00,0x00,0x00,0x00,0x01,0xff
61
+      ,0x40,0x00,0x00,0x00,0x00,0x00,0xff
62
+      ,0x80,0x00,0x00,0x00,0x00,0x00,0x7f
63
+      ,0x83,0xcf,0x00,0x00,0x0c,0x30,0x3f
64
+      ,0x87,0xff,0x80,0x00,0x0c,0x30,0x1f
65
+      ,0x86,0x79,0x80,0x00,0x0c,0x00,0x0f
66
+      ,0x8c,0x30,0xc7,0x83,0x8c,0x30,0xe7
67
+      ,0x8c,0x30,0xcf,0xc7,0xcc,0x31,0xf3
68
+      ,0x8c,0x30,0xdc,0xec,0xec,0x33,0xb9
69
+      ,0x8c,0x30,0xd8,0x6c,0x6c,0x33,0x19
70
+      ,0x8c,0x30,0xd0,0x6c,0x0c,0x33,0x19
71
+      ,0x8c,0x30,0xd8,0x6c,0x0c,0x33,0x19
72
+      ,0x8c,0x30,0xdc,0x6c,0x0e,0x3b,0x19
73
+      ,0x8c,0x30,0xcf,0x7c,0x07,0x9f,0x19
74
+      ,0x8c,0x30,0xc7,0x7c,0x03,0x8f,0x19
75
+      ,0x40,0x00,0x00,0x00,0x00,0x00,0x02
76
+      ,0x60,0x00,0x00,0x00,0x00,0x00,0x06
77
+      ,0x1f,0xff,0xff,0xff,0xff,0xff,0xf8 };
78
+  #endif
77 79
 #endif
78 80
 
79 81
 // Here comes a compile-time operation to match the extruder symbols 

+ 37
- 30
Marlin/dogm_lcd_implementation.h Просмотреть файл

@@ -190,14 +190,16 @@ char lcd_printPGM(const char* str) {
190 190
   return n;
191 191
 }
192 192
 
193
-static bool show_splashscreen = true;
193
+#if ENABLED(SHOW_BOOTSCREEN)
194
+  static bool show_bootscreen = true;
195
+#endif
194 196
 
195 197
 /* Warning: This function is called from interrupt context */
196 198
 static void lcd_implementation_init() {
197 199
 
198 200
   #if ENABLED(LCD_PIN_BL) // Enable LCD backlight
199 201
     pinMode(LCD_PIN_BL, OUTPUT);
200
-	  digitalWrite(LCD_PIN_BL, HIGH);
202
+    digitalWrite(LCD_PIN_BL, HIGH);
201 203
   #endif
202 204
 
203 205
   #if ENABLED(LCD_PIN_RESET)
@@ -207,44 +209,49 @@ static void lcd_implementation_init() {
207 209
   #ifndef MINIPANEL//setContrast not working for Mini Panel
208 210
     u8g.setContrast(lcd_contrast);	
209 211
   #endif
210
-	// FIXME: remove this workaround
212
+  // FIXME: remove this workaround
211 213
   // Uncomment this if you have the first generation (V1.10) of STBs board
212
-  // pinMode(17, OUTPUT);	// Enable LCD backlight
214
+  // pinMode(17, OUTPUT); // Enable LCD backlight
213 215
   // digitalWrite(17, HIGH);
214 216
 
215 217
   #if ENABLED(LCD_SCREEN_ROT_90)
216 218
     u8g.setRot90();   // Rotate screen by 90°
217 219
   #elif ENABLED(LCD_SCREEN_ROT_180)
218
-    u8g.setRot180();	// Rotate screen by 180°
220
+    u8g.setRot180();  // Rotate screen by 180°
219 221
   #elif ENABLED(LCD_SCREEN_ROT_270)
220
-    u8g.setRot270();	// Rotate screen by 270°
221
-  #endif
222
-	
223
-  // Show splashscreen
224
-  int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
225
-  #if ENABLED(START_BMPHIGH)
226
-    int offy = 0;
227
-  #else
228
-    int offy = DOG_CHAR_HEIGHT;
222
+    u8g.setRot270();  // Rotate screen by 270°
229 223
   #endif
230 224
 
231
-  int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2;
232
-
233
-	u8g.firstPage();
234
-  do {
235
-    if (show_splashscreen) {
236
-      u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
237
-      lcd_setFont(FONT_MENU);
238
-      #ifndef STRING_SPLASH_LINE2
239
-        u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
240
-      #else
241
-        int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2;
242
-        u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1);
243
-        u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2);
244
-      #endif
225
+  #if ENABLED(SHOW_BOOTSCREEN)
226
+    int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
227
+    #if ENABLED(START_BMPHIGH)
228
+      int offy = 0;
229
+    #else
230
+      int offy = DOG_CHAR_HEIGHT;
231
+    #endif
232
+
233
+    int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2;
234
+
235
+    u8g.firstPage();
236
+    do {
237
+      if (show_bootscreen) {
238
+        u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
239
+        lcd_setFont(FONT_MENU);
240
+        #ifndef STRING_SPLASH_LINE2
241
+          u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
242
+        #else
243
+          int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2;
244
+          u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1);
245
+          u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2);
246
+        #endif
247
+      }
248
+    } while (u8g.nextPage());
249
+
250
+    if (show_bootscreen) {
251
+      delay(1000);
252
+      show_bootscreen = false;
245 253
     }
246
-  } while (u8g.nextPage());
247
-  show_splashscreen = false;
254
+  #endif
248 255
 }
249 256
 
250 257
 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop

Загрузка…
Отмена
Сохранить