Przeglądaj źródła

Marlin code for GLCD display

This contains the menues, status screen etc...
Dirk Eichel 12 lat temu
rodzic
commit
4a141a694f
1 zmienionych plików z 557 dodań i 0 usunięć
  1. 557
    0
      Marlin/dogm_lcd_implementation.h

+ 557
- 0
Marlin/dogm_lcd_implementation.h Wyświetl plik

@@ -0,0 +1,557 @@
1
+/**
2
+ *dogm_lcd_implementation.h
3
+ *
4
+ *Graphics LCD implementation for 128x64 pixel LCDs by STB for ErikZalm/Marlin
5
+ *Demonstrator: http://www.reprap.org/wiki/STB_Electronics
6
+ *License: http://opensource.org/licenses/BSD-3-Clause
7
+ *
8
+ *With the use of:
9
+ *u8glib by Oliver Kraus
10
+ *http://code.google.com/p/u8glib/
11
+ *License: http://opensource.org/licenses/BSD-3-Clause
12
+ */
13
+
14
+
15
+#ifndef ULTRA_LCD_IMPLEMENTATION_DOGM_H
16
+#define ULTRA_LCD_IMPLEMENTATION_DOGM_H
17
+
18
+/**
19
+* Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
20
+**/
21
+
22
+
23
+// CHANGE_DE begin ***
24
+#include <U8glib.h>	// DE_U8glib
25
+#include "DOGMbitmaps.h"
26
+#include "ultralcd.h"
27
+
28
+
29
+/* Russian language not supported yet, needs custom font
30
+
31
+#if LANGUAGE_CHOICE == 6
32
+#include "LiquidCrystalRus.h"
33
+#define LCD_CLASS LiquidCrystalRus
34
+#else
35
+#include <LiquidCrystal.h>
36
+#define LCD_CLASS LiquidCrystal
37
+#endif
38
+*/
39
+
40
+// DOGM parameters (size in pixels)
41
+#define DOG_CHAR_WIDTH			6
42
+#define DOG_CHAR_HEIGHT			12
43
+#define DOG_CHAR_WIDTH_LARGE	9
44
+#define DOG_CHAR_HEIGHT_LARGE	18
45
+
46
+
47
+#define START_ROW				0
48
+
49
+
50
+/* Custom characters defined in font font_6x10_marlin.c */
51
+#define LCD_STR_BEDTEMP     "\xFE"
52
+#define LCD_STR_DEGREE      "\xB0"
53
+#define LCD_STR_THERMOMETER "\xFF"
54
+#define LCD_STR_UPLEVEL     "\xFB"
55
+#define LCD_STR_REFRESH     "\xF8"
56
+#define LCD_STR_FOLDER      "\xF9"
57
+#define LCD_STR_FEEDRATE    "\xFD"
58
+#define LCD_STR_CLOCK       "\xFC"
59
+#define LCD_STR_ARROW_RIGHT "\xFA"
60
+
61
+#define FONT_STATUSMENU	u8g_font_6x9
62
+
63
+
64
+// LCD selection
65
+U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);	// HW-SPI Com: CS, A0
66
+
67
+static void lcd_implementation_init()
68
+{
69
+	//  Uncomment this if you have the first generation (V1.10) of STBs board
70
+	pinMode(17, OUTPUT);	// Enable LCD backlight
71
+	digitalWrite(17, HIGH);
72
+	
73
+	u8g.firstPage();
74
+	do {
75
+		u8g.setFont(u8g_font_6x10_marlin);
76
+		u8g.setColorIndex(1);
77
+		u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
78
+		u8g.setColorIndex(1);
79
+	   } while( u8g.nextPage() );
80
+
81
+#ifdef LCD_SCREEN_ROT_90
82
+	u8g.setRot90();	// Rotate screen by 90°
83
+#endif
84
+
85
+#ifdef LCD_SCREEN_ROT_180;
86
+	u8g.setRot180();	// Rotate screen by 180°
87
+#endif
88
+
89
+#ifdef LCD_SCREEN_ROT_270;
90
+	u8g.setRot270();	// Rotate screen by 270°
91
+#endif
92
+
93
+   
94
+	u8g.firstPage();
95
+	do {
96
+			// RepRap init bmp
97
+			u8g.drawBitmapP(0,0,START_BMPBYTEWIDTH,START_BMPHEIGHT,start_bmp);
98
+			// Welcome message
99
+			u8g.setFont(u8g_font_6x10_marlin);
100
+			u8g.drawStr(62,10,"MARLIN"); 
101
+			u8g.setFont(u8g_font_5x8);
102
+			u8g.drawStr(62,19,"V1.0.0 RC2");
103
+			u8g.setFont(u8g_font_6x10_marlin);
104
+			u8g.drawStr(62,28,"by ErikZalm");
105
+			u8g.drawStr(62,41,"DOGM128 LCD");
106
+			u8g.setFont(u8g_font_5x8);
107
+			u8g.drawStr(62,48,"enhancements");
108
+			u8g.setFont(u8g_font_5x8);
109
+			u8g.drawStr(62,55,"by STB");
110
+			u8g.drawStr(62,61,"uses u");
111
+			u8g.drawStr(92,61,"8");
112
+			u8g.drawStr(100,61,"glib");
113
+	   } while( u8g.nextPage() );
114
+}
115
+
116
+static void lcd_implementation_clear()
117
+{
118
+	//u8g.setRot180();
119
+	u8g.firstPage();
120
+	do {	
121
+			u8g.setColorIndex(0);
122
+			u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
123
+			u8g.setColorIndex(1);
124
+		} while( u8g.nextPage() );
125
+}
126
+
127
+/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
128
+static void lcd_printPGM(const char* str)
129
+{
130
+    char c;
131
+    while((c = pgm_read_byte(str++)) != '\0')
132
+    {
133
+			u8g.print(c);
134
+    }
135
+}
136
+
137
+
138
+static void lcd_implementation_status_screen()
139
+{
140
+
141
+ static unsigned char fan_rot = 0;
142
+ 
143
+ u8g.setColorIndex(1);	// black on white
144
+ 
145
+ // Symbols menu graphics
146
+ if ((blink % 2) &&  fanSpeed )	u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen0_bmp);
147
+	else u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen1_bmp);
148
+ 
149
+ #ifdef SDSUPPORT
150
+ //SD Card Symbol
151
+ u8g.drawBox(42,42,8,7);
152
+ u8g.drawBox(50,44,2,5);
153
+ u8g.drawFrame(42,49,10,4);
154
+ u8g.drawPixel(50,43);
155
+ // Progress bar
156
+ u8g.drawFrame(54,49,73,4);
157
+ 
158
+ // SD Card Progress bar and clock
159
+ u8g.setFont(FONT_STATUSMENU);
160
+ 
161
+ if (IS_SD_PRINTING)
162
+   {
163
+	// u8g.print(itostr3(card.percentDone()));
164
+	// Progress bar
165
+	u8g.drawBox(55,50, (unsigned int)( (71 * card.percentDone())/100) ,2);
166
+   }
167
+    else {
168
+			//
169
+		 }
170
+ 
171
+ u8g.setPrintPos(80,47);
172
+ if(starttime != 0)
173
+    {
174
+        uint16_t time = millis()/60000 - starttime/60000;
175
+
176
+		u8g.print(itostr2(time/60));
177
+		u8g.print(':');
178
+		u8g.print(itostr2(time%60));
179
+    }else{
180
+			lcd_printPGM(PSTR("--:--"));
181
+		 }
182
+ #endif
183
+ 
184
+ // Extruder 1
185
+ u8g.setFont(FONT_STATUSMENU);
186
+ u8g.setPrintPos(6,6);
187
+ u8g.print(itostr3(int(degTargetHotend(0) + 0.5)));
188
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
189
+ u8g.setPrintPos(6,27);
190
+ u8g.print(itostr3(int(degHotend(0) + 0.5)));
191
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
192
+ if (!isHeatingHotend(0)) u8g.drawBox(13,17,2,2);
193
+	else
194
+		{
195
+		 u8g.setColorIndex(0);	// white on black
196
+		 u8g.drawBox(13,17,2,2);
197
+		 u8g.setColorIndex(1);	// black on white
198
+		}
199
+ 
200
+ // Extruder 2
201
+ u8g.setFont(FONT_STATUSMENU);
202
+ #if EXTRUDERS > 1
203
+ u8g.setPrintPos(31,6);
204
+ u8g.print(itostr3(int(degTargetHotend(1) + 0.5)));
205
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
206
+ u8g.setPrintPos(31,27);
207
+ u8g.print(itostr3(int(degHotend(1) + 0.5)));
208
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
209
+ if (!isHeatingHotend(1)) u8g.drawBox(38,17,2,2);
210
+	else
211
+		{
212
+		 u8g.setColorIndex(0);	// white on black
213
+		 u8g.drawBox(38,17,2,2);
214
+		 u8g.setColorIndex(1);	// black on white
215
+		}
216
+ #else
217
+ u8g.setPrintPos(31,27);
218
+ u8g.print("---");
219
+ #endif
220
+ 
221
+ // Extruder 3
222
+ u8g.setFont(FONT_STATUSMENU);
223
+ # if EXTRUDERS > 2
224
+ u8g.setPrintPos(55,6);
225
+ u8g.print(itostr3(int(degTargetHotend(2) + 0.5)));
226
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
227
+ u8g.setPrintPos(55,27);
228
+ u8g.print(itostr3(int(degHotend(2) + 0.5)));
229
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
230
+ if (!isHeatingHotend(2)) u8g.drawBox(62,17,2,2);
231
+	else
232
+		{
233
+		 u8g.setColorIndex(0);	// white on black
234
+		 u8g.drawBox(62,17,2,2);
235
+		 u8g.setColorIndex(1);	// black on white
236
+		}
237
+ #else
238
+ u8g.setPrintPos(55,27);
239
+ u8g.print("---");
240
+ #endif
241
+ 
242
+ // Heatbed
243
+ u8g.setFont(FONT_STATUSMENU);
244
+ u8g.setPrintPos(81,6);
245
+ u8g.print(itostr3(int(degTargetBed() + 0.5)));
246
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
247
+ u8g.setPrintPos(81,27);
248
+ u8g.print(itostr3(int(degBed() + 0.5)));
249
+ lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
250
+ if (!isHeatingBed()) u8g.drawBox(88,18,2,2);
251
+	else
252
+		{
253
+		 u8g.setColorIndex(0);	// white on black
254
+		 u8g.drawBox(88,18,2,2);
255
+		 u8g.setColorIndex(1);	// black on white
256
+		}
257
+ 
258
+ // Fan
259
+ u8g.setFont(FONT_STATUSMENU);
260
+ u8g.setPrintPos(104,27);
261
+ #if FAN_PIN > 0
262
+ u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
263
+ u8g.print("%");
264
+ #else
265
+ u8g.print("---");
266
+ #endif
267
+ 
268
+ 
269
+ // X, Y, Z-Coordinates
270
+ u8g.setFont(FONT_STATUSMENU);
271
+ u8g.drawBox(0,29,128,10);
272
+ u8g.setColorIndex(0);	// white on black
273
+ u8g.setPrintPos(2,37);
274
+ u8g.print("X");
275
+ u8g.drawPixel(8,33);
276
+ u8g.drawPixel(8,35);
277
+ u8g.setPrintPos(10,37);
278
+ u8g.print(ftostr31ns(current_position[X_AXIS]));
279
+ u8g.setPrintPos(43,37);
280
+ lcd_printPGM(PSTR("Y"));
281
+ u8g.drawPixel(49,33);
282
+ u8g.drawPixel(49,35);
283
+ u8g.setPrintPos(51,37);
284
+ u8g.print(ftostr31ns(current_position[Y_AXIS]));
285
+ u8g.setPrintPos(83,37);
286
+ u8g.print("Z");
287
+ u8g.drawPixel(89,33);
288
+ u8g.drawPixel(89,35);
289
+ u8g.setPrintPos(91,37);
290
+ u8g.print(ftostr31(current_position[Z_AXIS]));
291
+ u8g.setColorIndex(1);	// black on white
292
+ 
293
+ // Feedrate
294
+ u8g.setFont(u8g_font_6x10_marlin);
295
+ u8g.setPrintPos(3,49);
296
+ u8g.print(LCD_STR_FEEDRATE[0]);
297
+ u8g.setFont(FONT_STATUSMENU);
298
+ u8g.setPrintPos(12,48);
299
+ u8g.print(itostr3(feedmultiply));
300
+ u8g.print('%');
301
+
302
+ // Status line
303
+ u8g.setFont(FONT_STATUSMENU);
304
+ u8g.setPrintPos(0,61);
305
+ u8g.print(lcd_status_message);
306
+
307
+}
308
+
309
+static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
310
+{
311
+    char c;
312
+    
313
+    uint8_t n = LCD_WIDTH - 1 - 2;
314
+		
315
+		if ((pre_char == '>') || (pre_char == LCD_STR_UPLEVEL[0] ))
316
+		   {
317
+			u8g.setColorIndex(1);		// black on white
318
+			u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
319
+			u8g.setColorIndex(0);		// following text must be white on black
320
+		   } else u8g.setColorIndex(1); // unmarked text is black on white
321
+		
322
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
323
+		if (pre_char != '>') u8g.print(pre_char); else u8g.print(' ');	// Row selector is obsolete
324
+
325
+
326
+    while( (c = pgm_read_byte(pstr)) != '\0' )
327
+    {
328
+		u8g.print(c);
329
+        pstr++;
330
+        n--;
331
+    }
332
+    while(n--){
333
+					u8g.print(' ');
334
+		}
335
+	   
336
+		u8g.print(post_char);
337
+		u8g.print(' ');
338
+		u8g.setColorIndex(1);		// restore settings to black on white
339
+}
340
+
341
+static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
342
+{
343
+    static unsigned int fkt_cnt = 0;
344
+	char c;
345
+    uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
346
+		
347
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
348
+		u8g.print(pre_char);
349
+	
350
+    while( (c = pgm_read_byte(pstr)) != '\0' )
351
+    {
352
+			u8g.print(c);
353
+		
354
+        pstr++;
355
+        n--;
356
+    }
357
+	
358
+		u8g.print(':');
359
+
360
+    while(n--){
361
+					u8g.print(' ');
362
+			  }
363
+
364
+		u8g.print(data);
365
+}
366
+
367
+static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
368
+{
369
+    char c;
370
+    uint8_t n= LCD_WIDTH - 1 - 2 - strlen_P(data);
371
+
372
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
373
+		u8g.print(pre_char);
374
+	
375
+    while( (c = pgm_read_byte(pstr)) != '\0' )
376
+    {
377
+			u8g.print(c);
378
+		
379
+        pstr++;
380
+        n--;
381
+    }
382
+
383
+		u8g.print(':');
384
+	
385
+    while(n--){
386
+					u8g.print(' ');
387
+			  }
388
+
389
+		lcd_printPGM(data);
390
+}
391
+
392
+#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
393
+#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
394
+#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
395
+#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
396
+#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
397
+#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
398
+#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
399
+#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
400
+#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
401
+#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
402
+#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
403
+#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
404
+#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
405
+#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
406
+#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
407
+#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
408
+
409
+void lcd_implementation_drawedit(const char* pstr, char* value)
410
+{
411
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
412
+		u8g.setFont(u8g_font_9x18);
413
+		lcd_printPGM(pstr);
414
+		u8g.print(':');
415
+		u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
416
+		u8g.print(value);
417
+}
418
+
419
+static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
420
+{
421
+    char c;
422
+    uint8_t n = LCD_WIDTH - 1;
423
+
424
+    if (longFilename[0] != '\0')
425
+    {
426
+        filename = longFilename;
427
+        longFilename[LCD_WIDTH-1] = '\0';
428
+    }
429
+
430
+		u8g.setColorIndex(1);		// black on white
431
+		u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
432
+		u8g.setColorIndex(0);		// following text must be white on black
433
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
434
+		u8g.print(' ');	// Indent by 1 char
435
+	   
436
+    while((c = *filename) != '\0')
437
+    {
438
+		u8g.print(c);
439
+        filename++;
440
+        n--;
441
+    }
442
+    while(n--){
443
+					u8g.print(' ');
444
+			   }
445
+	u8g.setColorIndex(1);		// black on white
446
+}
447
+
448
+static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
449
+{
450
+    char c;
451
+    uint8_t n = LCD_WIDTH - 1;
452
+
453
+    if (longFilename[0] != '\0')
454
+    {
455
+        filename = longFilename;
456
+        longFilename[LCD_WIDTH-1] = '\0';
457
+    }
458
+
459
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
460
+		u8g.print(' ');
461
+		
462
+while((c = *filename) != '\0')
463
+    {
464
+			u8g.print(c);
465
+		
466
+        filename++;
467
+        n--;
468
+    }
469
+    while(n--){
470
+					u8g.print(' ');
471
+			   }
472
+
473
+}
474
+
475
+static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
476
+{
477
+    char c;
478
+    uint8_t n = LCD_WIDTH - 2;
479
+		
480
+    if (longFilename[0] != '\0')
481
+    {
482
+        filename = longFilename;
483
+        longFilename[LCD_WIDTH-2] = '\0';
484
+    }
485
+		u8g.setColorIndex(1);		// black on white
486
+		u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
487
+		u8g.setColorIndex(0);		// following text must be white on black
488
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
489
+		u8g.print(' ');	// Indent by 1 char
490
+		u8g.print(LCD_STR_FOLDER[0]);		
491
+	   
492
+    while((c = *filename) != '\0')
493
+    {
494
+			u8g.print(c);
495
+		
496
+        filename++;
497
+        n--;
498
+    }
499
+    while(n--){
500
+					u8g.print(' ');
501
+			   }
502
+	u8g.setColorIndex(1);		// black on white
503
+}
504
+
505
+static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename)
506
+{
507
+    char c;
508
+    uint8_t n = LCD_WIDTH - 2;
509
+
510
+    if (longFilename[0] != '\0')
511
+    {
512
+        filename = longFilename;
513
+        longFilename[LCD_WIDTH-2] = '\0';
514
+    }
515
+
516
+		u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
517
+		u8g.print(' ');
518
+		u8g.print(LCD_STR_FOLDER[0]);
519
+
520
+    while((c = *filename) != '\0')
521
+    {
522
+			u8g.print(c);
523
+		
524
+        filename++;
525
+        n--;
526
+    }
527
+    while(n--){
528
+					u8g.print(' ');
529
+			   }
530
+}
531
+
532
+#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
533
+#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
534
+#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
535
+#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
536
+#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
537
+#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
538
+#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
539
+#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
540
+
541
+static void lcd_implementation_quick_feedback()
542
+{
543
+
544
+#if BEEPER > -1
545
+    SET_OUTPUT(BEEPER);
546
+    for(int8_t i=0;i<10;i++)
547
+    {
548
+		WRITE(BEEPER,HIGH);
549
+		delay(3);
550
+		WRITE(BEEPER,LOW);
551
+		delay(3);
552
+    }
553
+#endif
554
+}
555
+#endif//ULTRA_LCD_IMPLEMENTATION_DOGM_H
556
+
557
+

Ładowanie…
Anuluj
Zapisz