Browse Source

Merge pull request #2074 from thinkyhead/lcd_xyz_unknown

Display unknown XYZ on the LCD as "---"
Scott Lahteine 9 years ago
parent
commit
95f5a68006
2 changed files with 101 additions and 78 deletions
  1. 12
    4
      Marlin/dogm_lcd_implementation.h
  2. 89
    74
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 12
- 4
Marlin/dogm_lcd_implementation.h View File

@@ -273,7 +273,6 @@ static void lcd_implementation_status_screen() {
273 273
     u8g.drawFrame(42, 49 - TALL_FONT_CORRECTION, 10, 4);
274 274
     u8g.drawPixel(50, 43 - TALL_FONT_CORRECTION);
275 275
 
276
-
277 276
     // Progress bar frame
278 277
     u8g.drawFrame(54, 49, 73, 4 - TALL_FONT_CORRECTION);
279 278
 
@@ -333,19 +332,28 @@ static void lcd_implementation_status_screen() {
333 332
   u8g.drawPixel(8,XYZ_BASELINE - 5);
334 333
   u8g.drawPixel(8,XYZ_BASELINE - 3);
335 334
   u8g.setPrintPos(10,XYZ_BASELINE);
336
-  lcd_print(ftostr31ns(current_position[X_AXIS]));
335
+  if (axis_known_position[X_AXIS])
336
+    lcd_print(ftostr31ns(current_position[X_AXIS]));
337
+  else
338
+    lcd_printPGM(PSTR("---"));
337 339
   u8g.setPrintPos(43,XYZ_BASELINE);
338 340
   lcd_print('Y');
339 341
   u8g.drawPixel(49,XYZ_BASELINE - 5);
340 342
   u8g.drawPixel(49,XYZ_BASELINE - 3);
341 343
   u8g.setPrintPos(51,XYZ_BASELINE);
342
-  lcd_print(ftostr31ns(current_position[Y_AXIS]));
344
+  if (axis_known_position[Y_AXIS])
345
+    lcd_print(ftostr31ns(current_position[Y_AXIS]));
346
+  else
347
+    lcd_printPGM(PSTR("---"));
343 348
   u8g.setPrintPos(83,XYZ_BASELINE);
344 349
   lcd_print('Z');
345 350
   u8g.drawPixel(89,XYZ_BASELINE - 5);
346 351
   u8g.drawPixel(89,XYZ_BASELINE - 3);
347 352
   u8g.setPrintPos(91,XYZ_BASELINE);
348
-  lcd_print(ftostr31(current_position[Z_AXIS]));
353
+  if (axis_known_position[Z_AXIS])
354
+    lcd_print(ftostr32sp(current_position[Z_AXIS]));
355
+  else
356
+    lcd_printPGM(PSTR("---.--"));
349 357
   u8g.setColorIndex(1); // black on white
350 358
  
351 359
   // Feedrate

+ 89
- 74
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -406,97 +406,99 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
406 406
 
407 407
 /*
408 408
 Possible status screens:
409
-16x2   |0123456789012345|
410
-       |000/000 B000/000|
411
-       |Status line.....|
409
+16x2   |000/000 B000/000|
410
+       |0123456789012345|
412 411
 
413
-16x4   |0123456789012345|
414
-       |000/000 B000/000|
415
-       |SD100%    Z000.0|
412
+16x4   |000/000 B000/000|
413
+       |SD100%  Z000.00 |
416 414
        |F100%     T--:--|
417
-       |Status line.....|
415
+       |0123456789012345|
418 416
 
419
-20x2   |01234567890123456789|
420
-       |T000/000D B000/000D |
421
-       |Status line.........|
417
+20x2   |T000/000D B000/000D |
418
+       |01234567890123456789|
422 419
 
423
-20x4   |01234567890123456789|
424
-       |T000/000D B000/000D |
425
-       |X000  Y000   Z000.00|
420
+20x4   |T000/000D B000/000D |
421
+       |X000  Y000  Z000.00 |
426 422
        |F100%  SD100% T--:--|
427
-       |Status line.........|
423
+       |01234567890123456789|
428 424
 
429
-20x4   |01234567890123456789|
430
-       |T000/000D B000/000D |
425
+20x4   |T000/000D B000/000D |
431 426
        |T000/000D   Z000.00 |
432 427
        |F100%  SD100% T--:--|
433
-       |Status line.........|
428
+       |01234567890123456789|
434 429
 */
435 430
 static void lcd_implementation_status_screen() {
436
-  int tHotend = int(degHotend(0) + 0.5);
437
-  int tTarget = int(degTargetHotend(0) + 0.5);
431
+
432
+  #define LCD_TEMP_ONLY(T1,T2) \
433
+    lcd.print(itostr3(T1 + 0.5)); \
434
+    lcd.print('/'); \
435
+    lcd.print(itostr3left(T2 + 0.5))
436
+
437
+  #define LCD_TEMP(T1,T2,PREFIX) \
438
+    lcd.print(PREFIX); \
439
+    LCD_TEMP_ONLY(T1,T2); \
440
+    lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); \
441
+    if (T2 < 10) lcd.print(' ')
442
+
443
+  //
444
+  // Line 1
445
+  //
446
+
447
+  lcd.setCursor(0, 0);
438 448
 
439 449
   #if LCD_WIDTH < 20
440 450
 
441
-    lcd.setCursor(0, 0);
442
-    lcd.print(itostr3(tHotend));
443
-    lcd.print('/');
444
-    lcd.print(itostr3left(tTarget));
451
+    //
452
+    // Hotend 0 Temperature
453
+    //
454
+    LCD_TEMP_ONLY(degHotend(0), degTargetHotend(0));
445 455
 
456
+    //
457
+    // Hotend 1 or Bed Temperature
458
+    //
446 459
     #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
447 460
 
448
-      // If we have an 2nd extruder or heated bed, show that in the top right corner
449 461
       lcd.setCursor(8, 0);
450 462
       #if EXTRUDERS > 1
451
-        tHotend = int(degHotend(1) + 0.5);
452
-        tTarget = int(degTargetHotend(1) + 0.5);
453 463
         lcd.print(LCD_STR_THERMOMETER[0]);
454
-      #else // Heated bed
455
-        tHotend = int(degBed() + 0.5);
456
-        tTarget = int(degTargetBed() + 0.5);
464
+        LCD_TEMP_ONLY(degHotend(1), degTargetHotend(1));
465
+      #else
457 466
         lcd.print(LCD_STR_BEDTEMP[0]);
467
+        LCD_TEMP_ONLY(degBed(), degTargetBed());
458 468
       #endif
459
-      lcd.print(itostr3(tHotend));
460
-      lcd.print('/');
461
-      lcd.print(itostr3left(tTarget));
462 469
 
463 470
     #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
464 471
 
465
-  #else // LCD_WIDTH > 19
472
+  #else // LCD_WIDTH >= 20
466 473
 
467
-    lcd.setCursor(0, 0);
468
-    lcd.print(LCD_STR_THERMOMETER[0]);
469
-    lcd.print(itostr3(tHotend));
470
-    lcd.print('/');
471
-    lcd.print(itostr3left(tTarget));
472
-    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
473
-    if (tTarget < 10) lcd.print(' ');
474
+    //
475
+    // Hotend 0 Temperature
476
+    //
477
+    LCD_TEMP(degHotend(0), degTargetHotend(0), LCD_STR_THERMOMETER[0]);
474 478
 
479
+    //
480
+    // Hotend 1 or Bed Temperature
481
+    //
475 482
     #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
476
-      // If we have an 2nd extruder or heated bed, show that in the top right corner
477 483
       lcd.setCursor(10, 0);
478 484
       #if EXTRUDERS > 1
479
-        tHotend = int(degHotend(1) + 0.5);
480
-        tTarget = int(degTargetHotend(1) + 0.5);
481
-        lcd.print(LCD_STR_THERMOMETER[0]);
482
-      #else // Heated bed
483
-        tHotend = int(degBed() + 0.5);
484
-        tTarget = int(degTargetBed() + 0.5);
485
-        lcd.print(LCD_STR_BEDTEMP[0]);
485
+        LCD_TEMP(degHotend(1), degTargetHotend(1), LCD_STR_THERMOMETER[0]);
486
+      #else
487
+        LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]);
486 488
       #endif
487
-      lcd.print(itostr3(tHotend));
488
-      lcd.print('/');
489
-      lcd.print(itostr3left(tTarget));
490
-      lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
491
-      if (tTarget < 10) lcd.print(' ');
492 489
 
493 490
     #endif  // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
494 491
 
495
-  #endif // LCD_WIDTH > 19
492
+  #endif // LCD_WIDTH >= 20
493
+
494
+  //
495
+  // Line 2
496
+  //
496 497
 
497 498
   #if LCD_HEIGHT > 2
498
-    // Lines 2 for 4 line LCD
499
+
499 500
     #if LCD_WIDTH < 20
501
+
500 502
       #ifdef SDSUPPORT
501 503
         lcd.setCursor(0, 2);
502 504
         lcd_printPGM(PSTR("SD"));
@@ -507,36 +509,48 @@ static void lcd_implementation_status_screen() {
507 509
           lcd.print('%');
508 510
       #endif // SDSUPPORT
509 511
 
510
-    #else // LCD_WIDTH > 19
512
+    #else // LCD_WIDTH >= 20
513
+
514
+      lcd.setCursor(0, 1);
511 515
 
512 516
       #if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
513
-        // If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
514
-        tHotend = int(degBed() + 0.5);
515
-        tTarget = int(degTargetBed() + 0.5);
516 517
 
517
-        lcd.setCursor(0, 1);
518
-        lcd.print(LCD_STR_BEDTEMP[0]);
519
-        lcd.print(itostr3(tHotend));
520
-        lcd.print('/');
521
-        lcd.print(itostr3left(tTarget));
522
-        lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
523
-        if (tTarget < 10) lcd.print(' ');
518
+        // If we both have a 2nd extruder and a heated bed,
519
+        // show the heated bed temp on the left,
520
+        // since the first line is filled with extruder temps
521
+        LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]);
522
+
524 523
       #else
525
-        lcd.setCursor(0,1);
524
+
526 525
         lcd.print('X');
527
-        lcd.print(ftostr3(current_position[X_AXIS]));
526
+        if (axis_known_position[X_AXIS])
527
+          lcd.print(ftostr3(current_position[X_AXIS]));
528
+        else
529
+          lcd_printPGM(PSTR("---"));
530
+
528 531
         lcd_printPGM(PSTR("  Y"));
529
-        lcd.print(ftostr3(current_position[Y_AXIS]));
532
+        if (axis_known_position[Y_AXIS])
533
+          lcd.print(ftostr3(current_position[Y_AXIS]));
534
+        else
535
+          lcd_printPGM(PSTR("---"));
536
+
530 537
       #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
531 538
 
532
-    #endif // LCD_WIDTH > 19
539
+    #endif // LCD_WIDTH >= 20
533 540
 
534 541
     lcd.setCursor(LCD_WIDTH - 8, 1);
535 542
     lcd.print('Z');
536
-    lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
543
+    if (axis_known_position[Z_AXIS])
544
+      lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
545
+    else
546
+      lcd_printPGM(PSTR("---.--"));
537 547
 
538 548
   #endif // LCD_HEIGHT > 2
539 549
 
550
+  //
551
+  // Line 3
552
+  //
553
+
540 554
   #if LCD_HEIGHT > 3
541 555
 
542 556
     lcd.setCursor(0, 2);
@@ -570,9 +584,10 @@ static void lcd_implementation_status_screen() {
570 584
 
571 585
   #endif // LCD_HEIGHT > 3
572 586
 
573
-  /**
574
-   * Display Progress Bar, Filament display, and/or Status Message on the last line
575
-   */
587
+  //
588
+  // Last Line
589
+  // Status Message (which may be a Progress Bar or Filament display)
590
+  //
576 591
 
577 592
   lcd.setCursor(0, LCD_HEIGHT - 1);
578 593
 

Loading…
Cancel
Save