|
@@ -1,19 +1,20 @@
|
1
|
1
|
/**
|
2
|
|
- *dogm_lcd_implementation.h
|
|
2
|
+ * dogm_lcd_implementation.h
|
3
|
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
|
|
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
|
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
|
|
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
|
12
|
*/
|
13
|
13
|
|
|
14
|
+#ifndef DOGM_LCD_IMPLEMENTATION_H
|
|
15
|
+#define DOGM_LCD_IMPLEMENTATION_H
|
14
|
16
|
|
15
|
|
-#ifndef ULTRA_LCD_IMPLEMENTATION_DOGM_H
|
16
|
|
-#define ULTRA_LCD_IMPLEMENTATION_DOGM_H
|
|
17
|
+#define MARLIN_VERSION "1.0.2"
|
17
|
18
|
|
18
|
19
|
/**
|
19
|
20
|
* Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
|
|
@@ -51,12 +52,12 @@
|
51
|
52
|
*/
|
52
|
53
|
|
53
|
54
|
// DOGM parameters (size in pixels)
|
54
|
|
-#define DOG_CHAR_WIDTH 6
|
55
|
|
-#define DOG_CHAR_HEIGHT 12
|
56
|
|
-#define DOG_CHAR_WIDTH_LARGE 9
|
57
|
|
-#define DOG_CHAR_HEIGHT_LARGE 18
|
|
55
|
+#define DOG_CHAR_WIDTH 6
|
|
56
|
+#define DOG_CHAR_HEIGHT 12
|
|
57
|
+#define DOG_CHAR_WIDTH_LARGE 9
|
|
58
|
+#define DOG_CHAR_HEIGHT_LARGE 18
|
58
|
59
|
|
59
|
|
-#define START_ROW 0
|
|
60
|
+#define START_ROW 0
|
60
|
61
|
|
61
|
62
|
/* Custom characters defined in font font_6x10_marlin.c */
|
62
|
63
|
#define LCD_STR_DEGREE "\xB0"
|
|
@@ -69,7 +70,7 @@
|
69
|
70
|
#define LCD_STR_BEDTEMP "\xFE"
|
70
|
71
|
#define LCD_STR_THERMOMETER "\xFF"
|
71
|
72
|
|
72
|
|
-#define FONT_STATUSMENU u8g_font_6x9
|
|
73
|
+#define FONT_STATUSMENU u8g_font_6x9
|
73
|
74
|
|
74
|
75
|
int lcd_contrast;
|
75
|
76
|
|
|
@@ -82,78 +83,57 @@ U8GLIB_ST7920_128X64_RRD u8g(0);
|
82
|
83
|
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
|
83
|
84
|
#else
|
84
|
85
|
// for regular DOGM128 display with HW-SPI
|
85
|
|
-U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
|
|
86
|
+U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
|
86
|
87
|
#endif
|
87
|
88
|
|
88
|
|
-static void lcd_implementation_init()
|
89
|
|
-{
|
90
|
|
-#ifdef LCD_PIN_BL
|
91
|
|
- pinMode(LCD_PIN_BL, OUTPUT); // Enable LCD backlight
|
92
|
|
- digitalWrite(LCD_PIN_BL, HIGH);
|
93
|
|
-#endif
|
|
89
|
+static void lcd_implementation_init() {
|
|
90
|
+ #ifdef LCD_PIN_BL
|
|
91
|
+ pinMode(LCD_PIN_BL, OUTPUT); // Enable LCD backlight
|
|
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);
|
99
|
|
-
|
100
|
|
- u8g.firstPage();
|
101
|
|
- do {
|
102
|
|
- u8g.setFont(u8g_font_6x10_marlin);
|
103
|
|
- u8g.setColorIndex(1);
|
104
|
|
- u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
|
105
|
|
- u8g.setColorIndex(1);
|
106
|
|
- } while( u8g.nextPage() );
|
107
|
|
-
|
108
|
|
-#ifdef LCD_SCREEN_ROT_90
|
109
|
|
- u8g.setRot90(); // Rotate screen by 90°
|
110
|
|
-#endif
|
|
95
|
+ u8g.setContrast(lcd_contrast);
|
111
|
96
|
|
112
|
|
-#ifdef LCD_SCREEN_ROT_180
|
113
|
|
- u8g.setRot180(); // Rotate screen by 180°
|
114
|
|
-#endif
|
|
97
|
+ /*
|
|
98
|
+ // Uncomment this if you have the first generation (V1.10) of STBs board
|
115
|
99
|
|
116
|
|
-#ifdef LCD_SCREEN_ROT_270
|
117
|
|
- u8g.setRot270(); // Rotate screen by 270°
|
118
|
|
-#endif
|
|
100
|
+ pinMode(17, OUTPUT); // Enable LCD backlight
|
|
101
|
+ digitalWrite(17, HIGH);
|
119
|
102
|
|
120
|
|
-
|
121
|
|
- u8g.firstPage();
|
122
|
|
- 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");
|
131
|
|
-
|
132
|
|
- } while( u8g.nextPage() );
|
133
|
|
-}
|
|
103
|
+ //*/
|
|
104
|
+
|
|
105
|
+ u8g.firstPage();
|
|
106
|
+ do {
|
|
107
|
+ u8g.setFont(u8g_font_6x10_marlin);
|
|
108
|
+ u8g.setColorIndex(1);
|
|
109
|
+ u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
|
|
110
|
+ u8g.setColorIndex(1);
|
|
111
|
+ } while( u8g.nextPage() );
|
134
|
112
|
|
135
|
|
-static void lcd_implementation_clear()
|
136
|
|
-{
|
137
|
|
-// NO NEED TO IMPLEMENT LIKE SO. Picture loop automatically clears the display.
|
138
|
|
-//
|
139
|
|
-// Check this article: http://arduino.cc/forum/index.php?topic=91395.25;wap2
|
140
|
|
-//
|
141
|
|
-// u8g.firstPage();
|
142
|
|
-// do {
|
143
|
|
-// u8g.setColorIndex(0);
|
144
|
|
-// u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
|
145
|
|
-// u8g.setColorIndex(1);
|
146
|
|
-// } while( u8g.nextPage() );
|
|
113
|
+ #if defined(LCD_SCREEN_ROT_90)
|
|
114
|
+ u8g.setRot90(); // Rotate screen by 90°
|
|
115
|
+ #elif defined(LCD_SCREEN_ROT_180)
|
|
116
|
+ u8g.setRot180(); // Rotate screen by 180°
|
|
117
|
+ #elif defined(LCD_SCREEN_ROT_270)
|
|
118
|
+ u8g.setRot270(); // Rotate screen by 270°
|
|
119
|
+ #endif
|
|
120
|
+
|
|
121
|
+ u8g.firstPage();
|
|
122
|
+ do {
|
|
123
|
+ // RepRap init bmp
|
|
124
|
+ u8g.drawBitmapP(7,7,START_BMPBYTEWIDTH,START_BMPHEIGHT,start_bmp);
|
|
125
|
+ // Welcome message
|
|
126
|
+ u8g.setFont(u8g_font_5x8);
|
|
127
|
+ u8g.drawStr(7, 51, "V" MARLIN_VERSION " - marlin.reprap.org");
|
|
128
|
+ } while( u8g.nextPage() );
|
147
|
129
|
}
|
148
|
130
|
|
|
131
|
+static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|
132
|
+
|
149
|
133
|
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
|
150
|
|
-static void lcd_printPGM(const char* str)
|
151
|
|
-{
|
152
|
|
- char c;
|
153
|
|
- while((c = pgm_read_byte(str++)) != '\0')
|
154
|
|
- {
|
155
|
|
- u8g.print(c);
|
156
|
|
- }
|
|
134
|
+static void lcd_printPGM(const char* str) {
|
|
135
|
+ char c;
|
|
136
|
+ while ((c = pgm_read_byte(str++))) u8g.print(c);
|
157
|
137
|
}
|
158
|
138
|
|
159
|
139
|
static void _draw_heater_status(int x, int heater) {
|
|
@@ -176,49 +156,44 @@ static void _draw_heater_status(int x, int heater) {
|
176
|
156
|
}
|
177
|
157
|
}
|
178
|
158
|
|
179
|
|
-static void lcd_implementation_status_screen()
|
180
|
|
-{
|
|
159
|
+static void lcd_implementation_status_screen() {
|
181
|
160
|
|
182
|
|
- static unsigned char fan_rot = 0;
|
183
|
|
-
|
184
|
|
- u8g.setColorIndex(1); // black on white
|
|
161
|
+ static unsigned char fan_rot = 0;
|
185
|
162
|
|
186
|
|
- // Symbols menu graphics, animated fan
|
187
|
|
- u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
|
188
|
|
-
|
189
|
|
- #ifdef SDSUPPORT
|
190
|
|
- //SD Card Symbol
|
191
|
|
- u8g.drawBox(42,42,8,7);
|
192
|
|
- u8g.drawBox(50,44,2,5);
|
193
|
|
- u8g.drawFrame(42,49,10,4);
|
194
|
|
- u8g.drawPixel(50,43);
|
195
|
|
- // Progress bar
|
196
|
|
- u8g.drawFrame(54,49,73,4);
|
|
163
|
+ u8g.setColorIndex(1); // black on white
|
|
164
|
+
|
|
165
|
+ // Symbols menu graphics, animated fan
|
|
166
|
+ u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
|
197
|
167
|
|
198
|
|
- // SD Card Progress bar and clock
|
199
|
|
- u8g.setFont(FONT_STATUSMENU);
|
|
168
|
+ #ifdef SDSUPPORT
|
|
169
|
+ // SD Card Symbol
|
|
170
|
+ u8g.drawBox(42,42,8,7);
|
|
171
|
+ u8g.drawBox(50,44,2,5);
|
|
172
|
+ u8g.drawFrame(42,49,10,4);
|
|
173
|
+ u8g.drawPixel(50,43);
|
|
174
|
+
|
|
175
|
+ // Progress bar frame
|
|
176
|
+ u8g.drawFrame(54,49,73,4);
|
|
177
|
+
|
|
178
|
+ // SD Card Progress bar and clock
|
|
179
|
+ u8g.setFont(FONT_STATUSMENU);
|
200
|
180
|
|
201
|
|
- if (IS_SD_PRINTING)
|
202
|
|
- {
|
203
|
|
- // Progress bar
|
204
|
|
- u8g.drawBox(55,50, (unsigned int)( (71 * card.percentDone())/100) ,2);
|
205
|
|
- }
|
|
181
|
+ if (IS_SD_PRINTING) {
|
|
182
|
+ // Progress bar solid part
|
|
183
|
+ u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2);
|
|
184
|
+ }
|
|
185
|
+
|
|
186
|
+ u8g.setPrintPos(80,47);
|
|
187
|
+ if (starttime != 0) {
|
|
188
|
+ uint16_t time = millis()/60000 - starttime/60000;
|
|
189
|
+ u8g.print(itostr2(time/60));
|
|
190
|
+ u8g.print(':');
|
|
191
|
+ u8g.print(itostr2(time%60));
|
|
192
|
+ }
|
206
|
193
|
else {
|
207
|
|
- // do nothing
|
208
|
|
- }
|
209
|
|
-
|
210
|
|
- u8g.setPrintPos(80,47);
|
211
|
|
- if(starttime != 0)
|
212
|
|
- {
|
213
|
|
- uint16_t time = millis()/60000 - starttime/60000;
|
214
|
|
-
|
215
|
|
- u8g.print(itostr2(time/60));
|
216
|
|
- u8g.print(':');
|
217
|
|
- u8g.print(itostr2(time%60));
|
218
|
|
- }else{
|
219
|
|
- lcd_printPGM(PSTR("--:--"));
|
220
|
|
- }
|
221
|
|
- #endif
|
|
194
|
+ lcd_printPGM(PSTR("--:--"));
|
|
195
|
+ }
|
|
196
|
+ #endif
|
222
|
197
|
|
223
|
198
|
// Extruders
|
224
|
199
|
_draw_heater_status(6, 0);
|
|
@@ -232,107 +207,101 @@ static void lcd_implementation_status_screen()
|
232
|
207
|
// Heatbed
|
233
|
208
|
_draw_heater_status(81, -1);
|
234
|
209
|
|
235
|
|
- // Fan
|
236
|
|
- u8g.setFont(FONT_STATUSMENU);
|
237
|
|
- u8g.setPrintPos(104,27);
|
238
|
|
- #if defined(FAN_PIN) && FAN_PIN > -1
|
239
|
|
- u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
|
240
|
|
- u8g.print("%");
|
241
|
|
- #else
|
242
|
|
- u8g.print("---");
|
243
|
|
- #endif
|
244
|
|
-
|
245
|
|
-
|
246
|
|
- // X, Y, Z-Coordinates
|
247
|
|
- u8g.setFont(FONT_STATUSMENU);
|
248
|
|
- u8g.drawBox(0,29,128,10);
|
249
|
|
- u8g.setColorIndex(0); // white on black
|
250
|
|
- u8g.setPrintPos(2,37);
|
251
|
|
- u8g.print("X");
|
252
|
|
- u8g.drawPixel(8,33);
|
253
|
|
- u8g.drawPixel(8,35);
|
254
|
|
- u8g.setPrintPos(10,37);
|
255
|
|
- u8g.print(ftostr31ns(current_position[X_AXIS]));
|
256
|
|
- u8g.setPrintPos(43,37);
|
257
|
|
- lcd_printPGM(PSTR("Y"));
|
258
|
|
- u8g.drawPixel(49,33);
|
259
|
|
- u8g.drawPixel(49,35);
|
260
|
|
- u8g.setPrintPos(51,37);
|
261
|
|
- u8g.print(ftostr31ns(current_position[Y_AXIS]));
|
262
|
|
- u8g.setPrintPos(83,37);
|
263
|
|
- u8g.print("Z");
|
264
|
|
- u8g.drawPixel(89,33);
|
265
|
|
- u8g.drawPixel(89,35);
|
266
|
|
- u8g.setPrintPos(91,37);
|
267
|
|
- u8g.print(ftostr31(current_position[Z_AXIS]));
|
268
|
|
- u8g.setColorIndex(1); // black on white
|
|
210
|
+ // Fan
|
|
211
|
+ u8g.setFont(FONT_STATUSMENU);
|
|
212
|
+ u8g.setPrintPos(104,27);
|
|
213
|
+ #if defined(FAN_PIN) && FAN_PIN > -1
|
|
214
|
+ u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
|
|
215
|
+ u8g.print("%");
|
|
216
|
+ #else
|
|
217
|
+ u8g.print("---");
|
|
218
|
+ #endif
|
|
219
|
+
|
|
220
|
+ // X, Y, Z-Coordinates
|
|
221
|
+ u8g.setFont(FONT_STATUSMENU);
|
|
222
|
+ u8g.drawBox(0,29,128,10);
|
|
223
|
+ u8g.setColorIndex(0); // white on black
|
|
224
|
+ u8g.setPrintPos(2,37);
|
|
225
|
+ u8g.print("X");
|
|
226
|
+ u8g.drawPixel(8,33);
|
|
227
|
+ u8g.drawPixel(8,35);
|
|
228
|
+ u8g.setPrintPos(10,37);
|
|
229
|
+ u8g.print(ftostr31ns(current_position[X_AXIS]));
|
|
230
|
+ u8g.setPrintPos(43,37);
|
|
231
|
+ lcd_printPGM(PSTR("Y"));
|
|
232
|
+ u8g.drawPixel(49,33);
|
|
233
|
+ u8g.drawPixel(49,35);
|
|
234
|
+ u8g.setPrintPos(51,37);
|
|
235
|
+ u8g.print(ftostr31ns(current_position[Y_AXIS]));
|
|
236
|
+ u8g.setPrintPos(83,37);
|
|
237
|
+ u8g.print("Z");
|
|
238
|
+ u8g.drawPixel(89,33);
|
|
239
|
+ u8g.drawPixel(89,35);
|
|
240
|
+ u8g.setPrintPos(91,37);
|
|
241
|
+ u8g.print(ftostr31(current_position[Z_AXIS]));
|
|
242
|
+ u8g.setColorIndex(1); // black on white
|
269
|
243
|
|
270
|
|
- // Feedrate
|
271
|
|
- u8g.setFont(u8g_font_6x10_marlin);
|
272
|
|
- u8g.setPrintPos(3,49);
|
273
|
|
- u8g.print(LCD_STR_FEEDRATE[0]);
|
274
|
|
- u8g.setFont(FONT_STATUSMENU);
|
275
|
|
- u8g.setPrintPos(12,48);
|
276
|
|
- u8g.print(itostr3(feedmultiply));
|
277
|
|
- u8g.print('%');
|
278
|
|
-
|
279
|
|
- // Status line
|
280
|
|
- u8g.setFont(FONT_STATUSMENU);
|
281
|
|
- u8g.setPrintPos(0,61);
|
282
|
|
- #ifndef FILAMENT_LCD_DISPLAY
|
283
|
|
- u8g.print(lcd_status_message);
|
284
|
|
- #else
|
285
|
|
- if(message_millis+5000>millis()){ //Display both Status message line and Filament display on the last line
|
286
|
|
- u8g.print(lcd_status_message);
|
287
|
|
- }
|
288
|
|
- else
|
289
|
|
- {
|
290
|
|
- lcd_printPGM(PSTR("dia:"));
|
291
|
|
- u8g.print(ftostr12ns(filament_width_meas));
|
292
|
|
- lcd_printPGM(PSTR(" factor:"));
|
293
|
|
- u8g.print(itostr3(extrudemultiply));
|
294
|
|
- u8g.print('%');
|
295
|
|
- }
|
296
|
|
- #endif
|
|
244
|
+ // Feedrate
|
|
245
|
+ u8g.setFont(u8g_font_6x10_marlin);
|
|
246
|
+ u8g.setPrintPos(3,49);
|
|
247
|
+ u8g.print(LCD_STR_FEEDRATE[0]);
|
|
248
|
+ u8g.setFont(FONT_STATUSMENU);
|
|
249
|
+ u8g.setPrintPos(12,48);
|
|
250
|
+ u8g.print(itostr3(feedmultiply));
|
|
251
|
+ u8g.print('%');
|
297
|
252
|
|
|
253
|
+ // Status line
|
|
254
|
+ u8g.setFont(FONT_STATUSMENU);
|
|
255
|
+ u8g.setPrintPos(0,61);
|
|
256
|
+ #ifndef FILAMENT_LCD_DISPLAY
|
|
257
|
+ u8g.print(lcd_status_message);
|
|
258
|
+ #else
|
|
259
|
+ if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line
|
|
260
|
+ u8g.print(lcd_status_message);
|
|
261
|
+ }
|
|
262
|
+ else {
|
|
263
|
+ lcd_printPGM(PSTR("dia:"));
|
|
264
|
+ u8g.print(ftostr12ns(filament_width_meas));
|
|
265
|
+ lcd_printPGM(PSTR(" factor:"));
|
|
266
|
+ u8g.print(itostr3(extrudemultiply));
|
|
267
|
+ u8g.print('%');
|
|
268
|
+ }
|
|
269
|
+ #endif
|
298
|
270
|
}
|
299
|
271
|
|
300
|
|
-static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
|
301
|
|
-{
|
302
|
|
- char c;
|
303
|
|
-
|
304
|
|
- uint8_t n = LCD_WIDTH - 1 - 2;
|
305
|
|
-
|
306
|
|
- if ((pre_char == '>') || (pre_char == LCD_STR_UPLEVEL[0] ))
|
307
|
|
- {
|
308
|
|
- u8g.setColorIndex(1); // black on white
|
309
|
|
- u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
|
310
|
|
- u8g.setColorIndex(0); // following text must be white on black
|
311
|
|
- } else u8g.setColorIndex(1); // unmarked text is black on white
|
312
|
|
-
|
313
|
|
- u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
|
314
|
|
- u8g.print(pre_char == '>' ? ' ' : pre_char); // Row selector is obsolete
|
315
|
|
-
|
316
|
|
-
|
317
|
|
- while( (c = pgm_read_byte(pstr)) != '\0' )
|
318
|
|
- {
|
319
|
|
- u8g.print(c);
|
320
|
|
- pstr++;
|
321
|
|
- n--;
|
322
|
|
- }
|
323
|
|
- while(n--){
|
324
|
|
- u8g.print(' ');
|
325
|
|
- }
|
326
|
|
-
|
327
|
|
- u8g.print(post_char);
|
328
|
|
- u8g.print(' ');
|
329
|
|
- u8g.setColorIndex(1); // restore settings to black on white
|
|
272
|
+static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) {
|
|
273
|
+ char c;
|
|
274
|
+
|
|
275
|
+ uint8_t n = LCD_WIDTH - 1 - 2;
|
|
276
|
+
|
|
277
|
+ if ((pre_char == '>') || (pre_char == LCD_STR_UPLEVEL[0] )) {
|
|
278
|
+ u8g.setColorIndex(1); // black on white
|
|
279
|
+ u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
|
|
280
|
+ u8g.setColorIndex(0); // following text must be white on black
|
|
281
|
+ }
|
|
282
|
+ else {
|
|
283
|
+ u8g.setColorIndex(1); // unmarked text is black on white
|
|
284
|
+ }
|
|
285
|
+
|
|
286
|
+ u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
|
|
287
|
+ u8g.print(pre_char == '>' ? ' ' : pre_char); // Row selector is obsolete
|
|
288
|
+
|
|
289
|
+ while((c = pgm_read_byte(pstr))) {
|
|
290
|
+ u8g.print(c);
|
|
291
|
+ pstr++;
|
|
292
|
+ n--;
|
|
293
|
+ }
|
|
294
|
+ while(n--) u8g.print(' ');
|
|
295
|
+
|
|
296
|
+ u8g.print(post_char);
|
|
297
|
+ u8g.print(' ');
|
|
298
|
+ u8g.setColorIndex(1); // restore settings to black on white
|
330
|
299
|
}
|
331
|
300
|
|
332
|
301
|
static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, const char* data, bool pgm) {
|
333
|
302
|
char c;
|
334
|
303
|
uint8_t n = LCD_WIDTH - 1 - 2 - (pgm ? strlen_P(data) : strlen(data));
|
335
|
|
-
|
|
304
|
+
|
336
|
305
|
u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
|
337
|
306
|
u8g.print(pre_char);
|
338
|
307
|
|
|
@@ -391,14 +360,13 @@ static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char p
|
391
|
360
|
#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
|
392
|
361
|
#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
|
393
|
362
|
|
394
|
|
-void lcd_implementation_drawedit(const char* pstr, char* value)
|
395
|
|
-{
|
396
|
|
- u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
|
397
|
|
- u8g.setFont(u8g_font_9x18);
|
398
|
|
- lcd_printPGM(pstr);
|
399
|
|
- u8g.print(':');
|
400
|
|
- u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
|
401
|
|
- u8g.print(value);
|
|
363
|
+void lcd_implementation_drawedit(const char* pstr, char* value) {
|
|
364
|
+ u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
|
|
365
|
+ u8g.setFont(u8g_font_9x18);
|
|
366
|
+ lcd_printPGM(pstr);
|
|
367
|
+ u8g.print(':');
|
|
368
|
+ u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
|
|
369
|
+ u8g.print(value);
|
402
|
370
|
}
|
403
|
371
|
|
404
|
372
|
static void _drawmenu_sd(uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir, bool isSelected) {
|
|
@@ -417,7 +385,7 @@ static void _drawmenu_sd(uint8_t row, const char* pstr, const char* filename, ch
|
417
|
385
|
}
|
418
|
386
|
|
419
|
387
|
u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
|
420
|
|
- u8g.print(' '); // Indent by 1 char
|
|
388
|
+ u8g.print(' '); // Indent by 1 char
|
421
|
389
|
|
422
|
390
|
if (isDir) u8g.print(LCD_STR_FOLDER[0]);
|
423
|
391
|
|
|
@@ -445,20 +413,16 @@ static void _drawmenu_sd(uint8_t row, const char* pstr, const char* filename, ch
|
445
|
413
|
#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
|
446
|
414
|
#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
|
447
|
415
|
|
448
|
|
-static void lcd_implementation_quick_feedback()
|
449
|
|
-{
|
450
|
|
-
|
451
|
|
-#if BEEPER > -1
|
|
416
|
+static void lcd_implementation_quick_feedback() {
|
|
417
|
+ #if BEEPER > -1
|
452
|
418
|
SET_OUTPUT(BEEPER);
|
453
|
|
- for(int8_t i=0;i<10;i++)
|
454
|
|
- {
|
455
|
|
- WRITE(BEEPER,HIGH);
|
456
|
|
- delay(3);
|
457
|
|
- WRITE(BEEPER,LOW);
|
458
|
|
- delay(3);
|
|
419
|
+ for(int8_t i=0; i<10; i++) {
|
|
420
|
+ WRITE(BEEPER,HIGH);
|
|
421
|
+ delay(3);
|
|
422
|
+ WRITE(BEEPER,LOW);
|
|
423
|
+ delay(3);
|
459
|
424
|
}
|
460
|
|
-#endif
|
|
425
|
+ #endif
|
461
|
426
|
}
|
462
|
|
-#endif//ULTRA_LCD_IMPLEMENTATION_DOGM_H
|
463
|
|
-
|
464
|
427
|
|
|
428
|
+#endif //__DOGM_LCD_IMPLEMENTATION_H
|