瀏覽代碼

Aesthetic and functional improvements for graphical LCD

Scott Lahteine 9 年之前
父節點
當前提交
fc30aa9d88
共有 1 個檔案被更改,包括 24 行新增31 行删除
  1. 24
    31
      Marlin/dogm_lcd_implementation.h

+ 24
- 31
Marlin/dogm_lcd_implementation.h 查看文件

279
 
279
 
280
 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
280
 static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
281
 
281
 
282
-static void _draw_heater_status(int x, int heater) {
282
+FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {
283
+  int degsize = 6 * (temp >= 100 ? 3 : temp >= 10 ? 2 : 1); // number's pixel width
284
+  u8g.setPrintPos(x - (18 - degsize) / 2, y); // move left if shorter
285
+  lcd_print(itostr3(temp));
286
+  lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
287
+}
288
+
289
+FORCE_INLINE void _draw_heater_status(int x, int heater) {
283
   bool isBed = heater < 0;
290
   bool isBed = heater < 0;
284
-  int y = 17 + (isBed ? 1 : 0);
285
 
291
 
286
   lcd_setFont(FONT_STATUSMENU);
292
   lcd_setFont(FONT_STATUSMENU);
287
-  u8g.setPrintPos(x, 7);
288
-  lcd_print(itostr3(int((heater >= 0 ? degTargetHotend(heater) : degTargetBed()) + 0.5)));
289
-  lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
290
-  u8g.setPrintPos(x, 28);
291
-  lcd_print(itostr3(int(heater >= 0 ? degHotend(heater) : degBed()) + 0.5));
292
 
293
 
293
-  lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
294
-  if (heater >= 0 ? !isHeatingHotend(heater) : !isHeatingBed()) {
295
-    u8g.drawBox(x+7,y,2,2);
296
-  }
297
-  else {
294
+  _draw_centered_temp((isBed ? degTargetBed() : degTargetHotend(heater)) + 0.5, x, 7);
295
+
296
+  _draw_centered_temp((isBed ? degBed() : degHotend(heater)) + 0.5, x, 28);
297
+
298
+  int h = isBed ? 7 : 8,
299
+      y = isBed ? 18 : 17;
300
+  if (isBed ? isHeatingBed() : isHeatingHotend(heater)) {
298
     u8g.setColorIndex(0); // white on black
301
     u8g.setColorIndex(0); // white on black
299
-    u8g.drawBox(x + 7, y, 2, 2);
302
+    u8g.drawBox(x + h, y, 2, 2);
300
     u8g.setColorIndex(1); // black on white
303
     u8g.setColorIndex(1); // black on white
301
   }
304
   }
305
+  else {
306
+    u8g.drawBox(x + h, y, 2, 2);
307
+  }
302
 }
308
 }
303
 
309
 
304
 static void lcd_implementation_status_screen() {
310
 static void lcd_implementation_status_screen() {
340
       lcd_print(':');
346
       lcd_print(':');
341
       lcd_print(itostr2(time%60));
347
       lcd_print(itostr2(time%60));
342
     }
348
     }
343
-    else {
344
-      lcd_printPGM(PSTR("--:--"));
345
-    }
346
   #endif
349
   #endif
347
 
350
 
348
   // Extruders
351
   // Extruders
349
-  for (int i = 0; i < EXTRUDERS; i++) _draw_heater_status(6 + i * 25, i);
352
+  for (int i = 0; i < EXTRUDERS; i++) _draw_heater_status(5 + i * 25, i);
350
 
353
 
351
   // Heatbed
354
   // Heatbed
352
   if (EXTRUDERS < 4) _draw_heater_status(81, -1);
355
   if (EXTRUDERS < 4) _draw_heater_status(81, -1);
360
       lcd_print(itostr3(per));
363
       lcd_print(itostr3(per));
361
       lcd_print('%');
364
       lcd_print('%');
362
     }
365
     }
363
-    else
364
   #endif
366
   #endif
365
-    {
366
-      lcd_printPGM(PSTR("---"));
367
-    }
368
 
367
 
369
   // X, Y, Z-Coordinates
368
   // X, Y, Z-Coordinates
370
   // Before homing the axis letters are blinking 'X' <-> '?'.
369
   // Before homing the axis letters are blinking 'X' <-> '?'.
394
       lcd_printPGM(PSTR(MSG_X));
393
       lcd_printPGM(PSTR(MSG_X));
395
     }
394
     }
396
   }
395
   }
397
-  u8g.drawPixel(8, XYZ_BASELINE - 5);
398
-  u8g.drawPixel(8, XYZ_BASELINE - 3);
399
   u8g.setPrintPos(10, XYZ_BASELINE);
396
   u8g.setPrintPos(10, XYZ_BASELINE);
400
-  lcd_print(ftostr31ns(current_position[X_AXIS]));
397
+  lcd_print(ftostr4sign(current_position[X_AXIS]));
401
 
398
 
402
   u8g.setPrintPos(43, XYZ_BASELINE);
399
   u8g.setPrintPos(43, XYZ_BASELINE);
403
   if (blink)
400
   if (blink)
414
       lcd_printPGM(PSTR(MSG_Y));
411
       lcd_printPGM(PSTR(MSG_Y));
415
     }
412
     }
416
   }
413
   }
417
-  u8g.drawPixel(49, XYZ_BASELINE - 5);
418
-  u8g.drawPixel(49, XYZ_BASELINE - 3);
419
   u8g.setPrintPos(51, XYZ_BASELINE);
414
   u8g.setPrintPos(51, XYZ_BASELINE);
420
-  lcd_print(ftostr31ns(current_position[Y_AXIS]));
415
+  lcd_print(ftostr4sign(current_position[Y_AXIS]));
421
 
416
 
422
   u8g.setPrintPos(83, XYZ_BASELINE);
417
   u8g.setPrintPos(83, XYZ_BASELINE);
423
   if (blink)
418
   if (blink)
434
       lcd_printPGM(PSTR(MSG_Z));
429
       lcd_printPGM(PSTR(MSG_Z));
435
     }
430
     }
436
   }
431
   }
437
-  u8g.drawPixel(89, XYZ_BASELINE - 5);
438
-  u8g.drawPixel(89, XYZ_BASELINE - 3);
439
   u8g.setPrintPos(91, XYZ_BASELINE);
432
   u8g.setPrintPos(91, XYZ_BASELINE);
440
-  lcd_print(ftostr32sp(current_position[Z_AXIS]));
433
+  lcd_print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
441
   u8g.setColorIndex(1); // black on white
434
   u8g.setColorIndex(1); // black on white
442
 
435
 
443
   // Feedrate
436
   // Feedrate
444
   lcd_setFont(FONT_MENU);
437
   lcd_setFont(FONT_MENU);
445
   u8g.setPrintPos(3, 49);
438
   u8g.setPrintPos(3, 49);
446
   lcd_print(LCD_STR_FEEDRATE[0]);
439
   lcd_print(LCD_STR_FEEDRATE[0]);
440
+
447
   lcd_setFont(FONT_STATUSMENU);
441
   lcd_setFont(FONT_STATUSMENU);
448
   u8g.setPrintPos(12, 49);
442
   u8g.setPrintPos(12, 49);
449
   lcd_print(itostr3(feedrate_multiplier));
443
   lcd_print(itostr3(feedrate_multiplier));
450
   lcd_print('%');
444
   lcd_print('%');
451
 
445
 
452
   // Status line
446
   // Status line
453
-  lcd_setFont(FONT_STATUSMENU);
454
   #if ENABLED(USE_SMALL_INFOFONT)
447
   #if ENABLED(USE_SMALL_INFOFONT)
455
     u8g.setPrintPos(0, 62);
448
     u8g.setPrintPos(0, 62);
456
   #else
449
   #else

Loading…
取消
儲存