Browse Source

updated LCD bouts with new strings and bitmaps

new version is pretty generic and should work in most scenarios
Steffen Vogel 10 years ago
parent
commit
b9cf1465a7
1 changed files with 34 additions and 32 deletions
  1. 34
    32
      Marlin/dogm_lcd_implementation.h

+ 34
- 32
Marlin/dogm_lcd_implementation.h View File

@@ -87,49 +87,51 @@ U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);	// HW-SPI Com: CS, A0
87 87
 
88 88
 static void lcd_implementation_init()
89 89
 {
90
-#ifdef LCD_PIN_BL
91
-	pinMode(LCD_PIN_BL, OUTPUT);	// Enable LCD backlight
92
-	digitalWrite(LCD_PIN_BL, HIGH);
93
-#endif
90
+  #ifdef LCD_PIN_BL // Enable LCD backlight
91
+    pinMode(LCD_PIN_BL, OUTPUT);
92
+	  digitalWrite(LCD_PIN_BL, HIGH);
93
+  #endif
94 94
 
95
-        u8g.setContrast(lcd_contrast);	
96
-	//  Uncomment this if you have the first generation (V1.10) of STBs board
97
-	//  pinMode(17, OUTPUT);	// Enable LCD backlight
98
-	//  digitalWrite(17, HIGH);
95
+  u8g.setContrast(lcd_contrast);	
96
+	// FIXME: remove this workaround
97
+  // Uncomment this if you have the first generation (V1.10) of STBs board
98
+	// pinMode(17, OUTPUT);	// Enable LCD backlight
99
+	// digitalWrite(17, HIGH);
100
+  
101
+#ifdef LCD_SCREEN_ROT_90
102
+	u8g.setRot90();   // Rotate screen by 90°
103
+#elif defined(LCD_SCREEN_ROT_180)
104
+	u8g.setRot180();	// Rotate screen by 180°
105
+#elif defined(LCD_SCREEN_ROT_270)
106
+	u8g.setRot270();	// Rotate screen by 270°
107
+#endif
99 108
 	
109
+  // FIXME: whats the purpose of the box? Maybe clear screen?
100 110
 	u8g.firstPage();
101
-	do {
111
+  do {
102 112
 		u8g.setFont(u8g_font_6x10_marlin);
103 113
 		u8g.setColorIndex(1);
104 114
 		u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
105 115
 		u8g.setColorIndex(1);
106
-	   } while( u8g.nextPage() );
107
-
108
-#ifdef LCD_SCREEN_ROT_90
109
-	u8g.setRot90();	// Rotate screen by 90°
110
-#endif
116
+	} while(u8g.nextPage());
111 117
 
112
-#ifdef LCD_SCREEN_ROT_180
113
-	u8g.setRot180();	// Rotate screen by 180°
114
-#endif
115
-
116
-#ifdef LCD_SCREEN_ROT_270
117
-	u8g.setRot270();	// Rotate screen by 270°
118
-#endif
119
-
120
-   
118
+  // Show splashscreen
119
+  int off = (u8g.getWidth() - START_BMPWIDTH) / 2;
120
+  int txtX = (u8g.getWidth() - sizeof(STRING_SPLASH) - 1) / 2;
121
+  int txtY = u8g.getHeight() - 10;
121 122
 	u8g.firstPage();
122 123
 	do {
123
-			// RepRap init bmp
124
-			u8g.drawBitmapP(7,7,START_BMPBYTEWIDTH,START_BMPHEIGHT,start_bmp);
125
-			// Welcome message
126
-			
127
-			
128
-			
129
-			u8g.setFont(u8g_font_5x8);
130
-			u8g.drawStr(7,51,"V1.0.2 - marlin.reprap.org");
124
+    #ifdef START_BMPHIGH
125
+		  u8g.drawBitmapP(off, off, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
126
+    #else
127
+      u8g.setScale2x2();
128
+		  u8g.drawBitmapP(off, off, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
129
+      u8g.undoScale();
130
+    #endif
131 131
 			
132
-	   } while( u8g.nextPage() );
132
+    u8g.setFont(u8g_font_5x8);
133
+		u8g.drawStr(txtX, txtY, STRING_SPLASH);
134
+	} while(u8g.nextPage());
133 135
 }
134 136
 
135 137
 static void lcd_implementation_clear()

Loading…
Cancel
Save