daid303 12 years ago
parent
commit
7c21716886
1 changed files with 23 additions and 14 deletions
  1. 23
    14
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 23
- 14
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -126,6 +126,15 @@ static void lcd_implementation_clear()
126 126
 {
127 127
     lcd.clear();
128 128
 }
129
+/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
130
+static void lcd_printPGM(const char* str)
131
+{
132
+    char c;
133
+    while((c = pgm_read_byte(str++)) != '\0')
134
+    {
135
+        lcd.write(c);
136
+    }
137
+}
129 138
 /*
130 139
 Possible status screens:
131 140
 16x2   |0123456789012345|
@@ -188,7 +197,7 @@ static void lcd_implementation_status_screen()
188 197
     lcd.print(itostr3(tHotend));
189 198
     lcd.print('/');
190 199
     lcd.print(itostr3left(tTarget));
191
-    lcd.print(F(LCD_STR_DEGREE " "));
200
+    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
192 201
 
193 202
 # if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
194 203
     //If we have an 2nd extruder or heated bed, show that in the top right corner
@@ -205,7 +214,7 @@ static void lcd_implementation_status_screen()
205 214
     lcd.print(itostr3(tHotend));
206 215
     lcd.print('/');
207 216
     lcd.print(itostr3left(tTarget));
208
-    lcd.print(F(LCD_STR_DEGREE " "));
217
+    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
209 218
 # endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
210 219
 #endif//LCD_WIDTH > 19
211 220
 
@@ -214,11 +223,11 @@ static void lcd_implementation_status_screen()
214 223
 # if LCD_WIDTH < 20
215 224
 #  ifdef SDSUPPORT
216 225
     lcd.setCursor(0, 2);
217
-    lcd.print(F("SD"));
226
+    lcd_printPGM(PSTR("SD"));
218 227
     if (IS_SD_PRINTING)
219 228
         lcd.print(itostr3(card.percentDone()));
220 229
     else
221
-        lcd.print(F("---"));
230
+        lcd_printPGM(PSTR("---"));
222 231
     lcd.print('%');
223 232
 #  endif//SDSUPPORT
224 233
 # else//LCD_WIDTH > 19
@@ -232,12 +241,12 @@ static void lcd_implementation_status_screen()
232 241
     lcd.print(itostr3(tHotend));
233 242
     lcd.print('/');
234 243
     lcd.print(itostr3left(tTarget));
235
-    lcd.print(F(LCD_STR_DEGREE " "));
244
+    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
236 245
 #  else
237 246
     lcd.setCursor(0,1);
238 247
     lcd.print('X');
239 248
     lcd.print(ftostr3(current_position[X_AXIS]));
240
-    lcd.print(F(" Y"));
249
+    lcd_printPGM(PSTR(" Y"));
241 250
     lcd.print(ftostr3(current_position[Y_AXIS]));
242 251
 #  endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
243 252
 # endif//LCD_WIDTH > 19
@@ -250,16 +259,16 @@ static void lcd_implementation_status_screen()
250 259
     lcd.setCursor(0, 2);
251 260
     lcd.print(LCD_STR_FEEDRATE[0]);
252 261
     lcd.print(itostr3(feedmultiply));
253
-    lcd.print(F("%"));
262
+    lcd.print('%');
254 263
 # if LCD_WIDTH > 19
255 264
 #  ifdef SDSUPPORT
256 265
     lcd.setCursor(7, 2);
257
-    lcd.print(F("SD"));
266
+    lcd_printPGM(PSTR("SD"));
258 267
     if (IS_SD_PRINTING)
259 268
         lcd.print(itostr3(card.percentDone()));
260 269
     else
261
-        lcd.print(F("---"));
262
-    lcd.print(F("%"));
270
+        lcd_printPGM(PSTR("---"));
271
+    lcd.print('%');
263 272
 #  endif//SDSUPPORT
264 273
 # endif//LCD_WIDTH > 19
265 274
     lcd.setCursor(LCD_WIDTH - 6, 2);
@@ -268,10 +277,10 @@ static void lcd_implementation_status_screen()
268 277
     {
269 278
         uint16_t time = millis()/60000 - starttime/60000;
270 279
         lcd.print(itostr2(time/60));
271
-        lcd.print(F(":"));
280
+        lcd.print(':');
272 281
         lcd.print(itostr2(time%60));
273 282
     }else{
274
-        lcd.print(F("--:--"));
283
+        lcd_printPGM(PSTR("--:--"));
275 284
     }
276 285
 #endif
277 286
 
@@ -328,7 +337,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
328 337
     lcd.print(':');
329 338
     while(n--)
330 339
         lcd.print(' ');
331
-    lcd.print(reinterpret_cast<const __FlashStringHelper *>(data));
340
+    lcd_printPGM(data);
332 341
 }
333 342
 #define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
334 343
 #define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
@@ -349,7 +358,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
349 358
 void lcd_implementation_drawedit(const char* pstr, char* value)
350 359
 {
351 360
     lcd.setCursor(0, 1);
352
-    lcd.print(reinterpret_cast<const __FlashStringHelper *>(pstr));
361
+    lcd_printPGM(pstr);
353 362
     lcd.print(':');
354 363
     lcd.setCursor(19 - strlen(value), 1);
355 364
     lcd.print(value);

Loading…
Cancel
Save