Преглед на файлове

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,26 +279,32 @@ static void lcd_implementation_init() {
279 279
 
280 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 290
   bool isBed = heater < 0;
284
-  int y = 17 + (isBed ? 1 : 0);
285 291
 
286 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 301
     u8g.setColorIndex(0); // white on black
299
-    u8g.drawBox(x + 7, y, 2, 2);
302
+    u8g.drawBox(x + h, y, 2, 2);
300 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 310
 static void lcd_implementation_status_screen() {
@@ -340,13 +346,10 @@ static void lcd_implementation_status_screen() {
340 346
       lcd_print(':');
341 347
       lcd_print(itostr2(time%60));
342 348
     }
343
-    else {
344
-      lcd_printPGM(PSTR("--:--"));
345
-    }
346 349
   #endif
347 350
 
348 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 354
   // Heatbed
352 355
   if (EXTRUDERS < 4) _draw_heater_status(81, -1);
@@ -360,11 +363,7 @@ static void lcd_implementation_status_screen() {
360 363
       lcd_print(itostr3(per));
361 364
       lcd_print('%');
362 365
     }
363
-    else
364 366
   #endif
365
-    {
366
-      lcd_printPGM(PSTR("---"));
367
-    }
368 367
 
369 368
   // X, Y, Z-Coordinates
370 369
   // Before homing the axis letters are blinking 'X' <-> '?'.
@@ -394,10 +393,8 @@ static void lcd_implementation_status_screen() {
394 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 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 399
   u8g.setPrintPos(43, XYZ_BASELINE);
403 400
   if (blink)
@@ -414,10 +411,8 @@ static void lcd_implementation_status_screen() {
414 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 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 417
   u8g.setPrintPos(83, XYZ_BASELINE);
423 418
   if (blink)
@@ -434,23 +429,21 @@ static void lcd_implementation_status_screen() {
434 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 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 434
   u8g.setColorIndex(1); // black on white
442 435
 
443 436
   // Feedrate
444 437
   lcd_setFont(FONT_MENU);
445 438
   u8g.setPrintPos(3, 49);
446 439
   lcd_print(LCD_STR_FEEDRATE[0]);
440
+
447 441
   lcd_setFont(FONT_STATUSMENU);
448 442
   u8g.setPrintPos(12, 49);
449 443
   lcd_print(itostr3(feedrate_multiplier));
450 444
   lcd_print('%');
451 445
 
452 446
   // Status line
453
-  lcd_setFont(FONT_STATUSMENU);
454 447
   #if ENABLED(USE_SMALL_INFOFONT)
455 448
     u8g.setPrintPos(0, 62);
456 449
   #else

Loading…
Отказ
Запис