|
57 | 57 | #include "../../gcode/parser.h"
|
58 | 58 | #endif
|
59 | 59 |
|
| 60 | +#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER) |
| 61 | + #include "../../feature/cooler.h" |
| 62 | +#endif |
| 63 | + |
| 64 | +#if ENABLED(I2C_AMMETER) |
| 65 | + #include "../../feature/ammeter.h" |
| 66 | +#endif |
| 67 | + |
| 68 | +#if HAS_CUTTER |
| 69 | + #include "../../feature/spindle_laser.h" |
| 70 | +#endif |
| 71 | + |
60 | 72 | #if ENABLED(AUTO_BED_LEVELING_UBL)
|
61 | 73 | #include "../../feature/bedlevel/bedlevel.h"
|
62 | 74 | #endif
|
63 | 75 |
|
64 | 76 | TFTGLCD lcd;
|
65 | 77 |
|
66 | 78 | #define ICON_LOGO B00000001
|
67 |
| -#define ICON_TEMP1 B00000010 //hotend 1 |
68 |
| -#define ICON_TEMP2 B00000100 //hotend 2 |
69 |
| -#define ICON_TEMP3 B00001000 //hotend 3 |
| 79 | +#define ICON_TEMP1 B00000010 // Hotend 1 |
| 80 | +#define ICON_TEMP2 B00000100 // Hotend 2 |
| 81 | +#define ICON_TEMP3 B00001000 // Hotend 3 |
70 | 82 | #define ICON_BED B00010000
|
71 | 83 | #define ICON_FAN B00100000
|
72 |
| -#define ICON_HOT B01000000 //when any T > 50deg |
| 84 | +#define ICON_HOT B01000000 // When any T > 50deg |
73 | 85 | #define PIC_MASK 0x7F
|
74 | 86 |
|
75 | 87 | // LEDs not used, for compatibility with Smoothieware
|
@@ -433,69 +445,161 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
433 | 445 | lcd_put_u8str(value);
|
434 | 446 | }
|
435 | 447 |
|
436 |
| -FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *prefix, const bool blink) { |
437 |
| - uint8_t pic_hot_bits; |
438 |
| - #if HAS_HEATED_BED |
439 |
| - const bool isBed = heater_id < 0; |
440 |
| - const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)), |
441 |
| - t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id)); |
442 |
| - #else |
443 |
| - const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id); |
444 |
| - #endif |
| 448 | +#if HAS_HOTEND || HAS_HEATED_BED |
445 | 449 |
|
446 |
| - #if HOTENDS < 2 |
447 |
| - if (heater_id == H_E0) { |
448 |
| - lcd.setCursor(2, 5); lcd.print(prefix); //HE |
449 |
| - lcd.setCursor(1, 6); lcd.print(i16tostr3rj(t1)); |
450 |
| - lcd.setCursor(1, 7); |
451 |
| - } |
452 |
| - else { |
453 |
| - lcd.setCursor(6, 5); lcd.print(prefix); //BED |
454 |
| - lcd.setCursor(6, 6); lcd.print(i16tostr3rj(t1)); |
455 |
| - lcd.setCursor(6, 7); |
| 450 | + FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *prefix, const bool blink) { |
| 451 | + uint8_t pic_hot_bits; |
| 452 | + #if HAS_HEATED_BED |
| 453 | + const bool isBed = heater_id < 0; |
| 454 | + const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)), |
| 455 | + t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id)); |
| 456 | + #else |
| 457 | + const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id); |
| 458 | + #endif |
| 459 | + |
| 460 | + #if HOTENDS < 2 |
| 461 | + if (heater_id == H_E0) { |
| 462 | + lcd.setCursor(2, 5); lcd.print(prefix); //HE |
| 463 | + lcd.setCursor(1, 6); lcd.print(i16tostr3rj(t1)); |
| 464 | + lcd.setCursor(1, 7); |
| 465 | + } |
| 466 | + else { |
| 467 | + lcd.setCursor(6, 5); lcd.print(prefix); //BED |
| 468 | + lcd.setCursor(6, 6); lcd.print(i16tostr3rj(t1)); |
| 469 | + lcd.setCursor(6, 7); |
| 470 | + } |
| 471 | + #else |
| 472 | + if (heater_id > H_BED) { |
| 473 | + lcd.setCursor(heater_id * 4, 5); lcd.print(prefix); // HE1 or HE2 or HE3 |
| 474 | + lcd.setCursor(heater_id * 4, 6); lcd.print(i16tostr3rj(t1)); |
| 475 | + lcd.setCursor(heater_id * 4, 7); |
| 476 | + } |
| 477 | + else { |
| 478 | + lcd.setCursor(13, 5); lcd.print(prefix); //BED |
| 479 | + lcd.setCursor(13, 6); lcd.print(i16tostr3rj(t1)); |
| 480 | + lcd.setCursor(13, 7); |
| 481 | + } |
| 482 | + #endif // HOTENDS <= 1 |
| 483 | + |
| 484 | + #if !HEATER_IDLE_HANDLER |
| 485 | + UNUSED(blink); |
| 486 | + #else |
| 487 | + if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { |
| 488 | + lcd.write(' '); |
| 489 | + if (t2 >= 10) lcd.write(' '); |
| 490 | + if (t2 >= 100) lcd.write(' '); |
| 491 | + } |
| 492 | + else |
| 493 | + #endif // !HEATER_IDLE_HANDLER |
| 494 | + lcd.print(i16tostr3rj(t2)); |
| 495 | + |
| 496 | + switch (heater_id) { |
| 497 | + case H_BED: pic_hot_bits = ICON_BED; break; |
| 498 | + case H_E0: pic_hot_bits = ICON_TEMP1; break; |
| 499 | + case H_E1: pic_hot_bits = ICON_TEMP2; break; |
| 500 | + case H_E2: pic_hot_bits = ICON_TEMP3; |
| 501 | + default: break; |
456 | 502 | }
|
457 |
| - #else |
458 |
| - if (heater_id > H_BED) { |
459 |
| - lcd.setCursor(heater_id * 4, 5); lcd.print(prefix); // HE1 or HE2 or HE3 |
460 |
| - lcd.setCursor(heater_id * 4, 6); lcd.print(i16tostr3rj(t1)); |
461 |
| - lcd.setCursor(heater_id * 4, 7); |
| 503 | + |
| 504 | + if (t2) picBits |= pic_hot_bits; |
| 505 | + else picBits &= ~pic_hot_bits; |
| 506 | + |
| 507 | + if (t1 > 50) hotBits |= pic_hot_bits; |
| 508 | + else hotBits &= ~pic_hot_bits; |
| 509 | + |
| 510 | + if (hotBits) picBits |= ICON_HOT; |
| 511 | + else picBits &= ~ICON_HOT; |
| 512 | + } |
| 513 | + |
| 514 | +#endif // HAS_HOTEND || HAS_HEATED_BED |
| 515 | + |
| 516 | +#if HAS_COOLER |
| 517 | + |
| 518 | + FORCE_INLINE void _draw_cooler_status(const bool blink) { |
| 519 | + const celsius_t t2 = thermalManager.degTargetCooler(); |
| 520 | + |
| 521 | + lcd.setCursor(0, 5); lcd_put_u8str_P(PSTR("COOL")); |
| 522 | + lcd.setCursor(1, 6); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler())); |
| 523 | + lcd.setCursor(1, 7); |
| 524 | + |
| 525 | + #if !HEATER_IDLE_HANDLER |
| 526 | + UNUSED(blink); |
| 527 | + #else |
| 528 | + if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { |
| 529 | + lcd_put_wchar(' '); |
| 530 | + if (t2 >= 10) lcd_put_wchar(' '); |
| 531 | + if (t2 >= 100) lcd_put_wchar(' '); |
| 532 | + } |
| 533 | + else |
| 534 | + #endif |
| 535 | + lcd_put_u8str(i16tostr3left(t2)); |
| 536 | + |
| 537 | + lcd_put_wchar(' '); |
| 538 | + if (t2 < 10) lcd_put_wchar(' '); |
| 539 | + |
| 540 | + if (t2) picBits |= ICON_TEMP1; |
| 541 | + else picBits &= ~ICON_TEMP1; |
| 542 | + } |
| 543 | + |
| 544 | +#endif // HAS_COOLER |
| 545 | + |
| 546 | +#if ENABLED(LASER_COOLANT_FLOW_METER) |
| 547 | + |
| 548 | + FORCE_INLINE void _draw_flowmeter_status() { |
| 549 | + lcd.setCursor(5, 5); lcd_put_u8str_P(PSTR("FLOW")); |
| 550 | + lcd.setCursor(7, 6); lcd_put_wchar('L'); |
| 551 | + lcd.setCursor(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate)); |
| 552 | + |
| 553 | + if (cooler.flowrate) picBits |= ICON_FAN; |
| 554 | + else picBits &= ~ICON_FAN; |
| 555 | + } |
| 556 | + |
| 557 | +#endif |
| 558 | + |
| 559 | +#if ENABLED(I2C_AMMETER) |
| 560 | + |
| 561 | + FORCE_INLINE void _draw_ammeter_status() { |
| 562 | + lcd.setCursor(10, 5); lcd_put_u8str_P(PSTR("ILAZ")); |
| 563 | + ammeter.read(); |
| 564 | + lcd.setCursor(11, 6); |
| 565 | + if (ammeter.current <= 0.999f) |
| 566 | + { |
| 567 | + lcd_put_u8str("mA"); |
| 568 | + lcd.setCursor(10, 7); |
| 569 | + lcd_put_wchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f))); |
462 | 570 | }
|
463 | 571 | else {
|
464 |
| - lcd.setCursor(13, 5); lcd.print(prefix); //BED |
465 |
| - lcd.setCursor(13, 6); lcd.print(i16tostr3rj(t1)); |
466 |
| - lcd.setCursor(13, 7); |
| 572 | + lcd_put_u8str(" A"); |
| 573 | + lcd.setCursor(10, 7); |
| 574 | + lcd_put_u8str(ftostr12ns(ammeter.current)); |
467 | 575 | }
|
468 |
| - #endif // HOTENDS <= 1 |
469 | 576 |
|
470 |
| - #if !HEATER_IDLE_HANDLER |
471 |
| - UNUSED(blink); |
472 |
| - #else |
473 |
| - if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { |
474 |
| - lcd.write(' '); |
475 |
| - if (t2 >= 10) lcd.write(' '); |
476 |
| - if (t2 >= 100) lcd.write(' '); |
477 |
| - } |
478 |
| - else |
479 |
| - #endif // !HEATER_IDLE_HANDLER |
480 |
| - lcd.print(i16tostr3rj(t2)); |
481 |
| - |
482 |
| - switch (heater_id) { |
483 |
| - case H_BED: pic_hot_bits = ICON_BED; break; |
484 |
| - case H_E0: pic_hot_bits = ICON_TEMP1; break; |
485 |
| - case H_E1: pic_hot_bits = ICON_TEMP2; break; |
486 |
| - case H_E2: pic_hot_bits = ICON_TEMP3; |
487 |
| - default: break; |
| 577 | + if (ammeter.current) picBits |= ICON_BED; |
| 578 | + else picBits &= ~ICON_BED; |
488 | 579 | }
|
489 | 580 |
|
490 |
| - if (t2) picBits |= pic_hot_bits; |
491 |
| - else picBits &= ~pic_hot_bits; |
| 581 | +#endif // I2C_AMMETER |
492 | 582 |
|
493 |
| - if (t1 > 50) hotBits |= pic_hot_bits; |
494 |
| - else hotBits &= ~pic_hot_bits; |
| 583 | +#if HAS_CUTTER |
495 | 584 |
|
496 |
| - if (hotBits) picBits |= ICON_HOT; |
497 |
| - else picBits &= ~ICON_HOT; |
498 |
| -} |
| 585 | + FORCE_INLINE void _draw_cutter_status() { |
| 586 | + lcd.setCursor(15, 5); lcd_put_u8str_P(PSTR("CUTT")); |
| 587 | + #if CUTTER_UNIT_IS(RPM) |
| 588 | + lcd.setCursor(16, 6); lcd_put_u8str_P(PSTR("RPM")); |
| 589 | + lcd.setCursor(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000)); |
| 590 | + lcd_put_wchar('K'); |
| 591 | + #elif CUTTER_UNIT_IS(PERCENT) |
| 592 | + lcd.setCursor(17, 6); lcd_put_wchar('%'); |
| 593 | + lcd.setCursor(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); |
| 594 | + #else |
| 595 | + lcd.setCursor(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); |
| 596 | + #endif |
| 597 | + |
| 598 | + if (cutter.unitPower) picBits |= ICON_HOT; |
| 599 | + else picBits &= ~ICON_HOT; |
| 600 | + } |
| 601 | + |
| 602 | +#endif // HAS_CUTTER |
499 | 603 |
|
500 | 604 | #if HAS_PRINT_PROGRESS
|
501 | 605 |
|
@@ -533,7 +637,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
|
533 | 637 | }
|
534 | 638 | }
|
535 | 639 |
|
536 |
| -#endif |
| 640 | +#endif // LCD_PROGRESS_BAR |
537 | 641 |
|
538 | 642 | void MarlinUI::draw_status_message(const bool blink) {
|
539 | 643 | if (!PanelDetected) return;
|
|
648 | 752 |
|
649 | 753 | or
|
650 | 754 |
|
| 755 | +|X 000 Y 000 Z 000.00| |
| 756 | +|FR100% SD100% C--:--| |
| 757 | +| Progress bar line | |
| 758 | +|Status message | |
| 759 | +| | |
| 760 | +|COOL FLOW ILAZ CUTT | |
| 761 | +| ttc L mA RPM | |
| 762 | +| tts f.f aaa rr.rK| |
| 763 | +| ICO ICO ICO ICO | |
| 764 | +| ICO ICO ICO ICO | |
| 765 | +
|
| 766 | +or |
| 767 | +
|
651 | 768 | Equal to 24x10 text LCD
|
652 | 769 |
|
653 | 770 | |X 000 Y 000 Z 000.00 |
|
@@ -745,50 +862,61 @@ void MarlinUI::draw_status_screen() {
|
745 | 862 | #endif
|
746 | 863 |
|
747 | 864 | //
|
748 |
| - // Line 6..8 Temperatures, FAN |
| 865 | + // Line 6..8 Temperatures, FAN for printer or Cooler, Flowmetter, Ampermeter, Cutter for laser/spindle |
749 | 866 | //
|
750 | 867 |
|
751 |
| - #if HOTENDS < 2 |
752 |
| - _draw_heater_status(H_E0, "HE", blink); // Hotend Temperature |
753 |
| - #else |
754 |
| - _draw_heater_status(H_E0, "HE1", blink); // Hotend 1 Temperature |
755 |
| - _draw_heater_status(H_E1, "HE2", blink); // Hotend 2 Temperature |
756 |
| - #if HOTENDS > 2 |
757 |
| - _draw_heater_status(H_E2, "HE3", blink); // Hotend 3 Temperature |
758 |
| - #endif |
759 |
| - #endif |
| 868 | + #if HAS_HOTEND |
760 | 869 |
|
761 |
| - #if HAS_HEATED_BED |
762 |
| - #if HAS_LEVELING |
763 |
| - _draw_heater_status(H_BED, (planner.leveling_active && blink ? "___" : "BED"), blink); |
| 870 | + #if HOTENDS < 2 |
| 871 | + _draw_heater_status(H_E0, "HE", blink); // Hotend Temperature |
764 | 872 | #else
|
765 |
| - _draw_heater_status(H_BED, "BED", blink); |
| 873 | + _draw_heater_status(H_E0, "HE1", blink); // Hotend 1 Temperature |
| 874 | + _draw_heater_status(H_E1, "HE2", blink); // Hotend 2 Temperature |
| 875 | + #if HOTENDS > 2 |
| 876 | + _draw_heater_status(H_E2, "HE3", blink); // Hotend 3 Temperature |
| 877 | + #endif |
766 | 878 | #endif
|
767 |
| - #endif |
768 | 879 |
|
769 |
| - #if HAS_FAN |
770 |
| - uint16_t spd = thermalManager.fan_speed[0]; |
771 |
| - #if ENABLED(ADAPTIVE_FAN_SLOWING) |
772 |
| - if (!blink) spd = thermalManager.scaledFanSpeed(0, spd); |
| 880 | + #if HAS_HEATED_BED |
| 881 | + #if HAS_LEVELING |
| 882 | + _draw_heater_status(H_BED, (planner.leveling_active && blink ? "___" : "BED"), blink); |
| 883 | + #else |
| 884 | + _draw_heater_status(H_BED, "BED", blink); |
| 885 | + #endif |
773 | 886 | #endif
|
774 |
| - uint16_t per = thermalManager.pwmToPercent(spd); |
775 | 887 |
|
776 |
| - #if HOTENDS < 2 |
777 |
| - #define FANX 11 |
778 |
| - #else |
779 |
| - #define FANX 17 |
780 |
| - #endif |
781 |
| - lcd.setCursor(FANX, 5); lcd_put_u8str_P(PSTR("FAN")); |
782 |
| - lcd.setCursor(FANX + 1, 6); lcd.write('%'); |
783 |
| - lcd.setCursor(FANX, 7); |
784 |
| - lcd.print(i16tostr3rj(per)); |
| 888 | + #if HAS_FAN |
| 889 | + uint16_t spd = thermalManager.fan_speed[0]; |
| 890 | + #if ENABLED(ADAPTIVE_FAN_SLOWING) |
| 891 | + if (!blink) spd = thermalManager.scaledFanSpeed(0, spd); |
| 892 | + #endif |
| 893 | + uint16_t per = thermalManager.pwmToPercent(spd); |
785 | 894 |
|
786 |
| - if (TERN0(HAS_FAN0, thermalManager.fan_speed[0]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2])) |
787 |
| - picBits |= ICON_FAN; |
788 |
| - else |
789 |
| - picBits &= ~ICON_FAN; |
| 895 | + #if HOTENDS < 2 |
| 896 | + #define FANX 11 |
| 897 | + #else |
| 898 | + #define FANX 17 |
| 899 | + #endif |
| 900 | + lcd.setCursor(FANX, 5); lcd_put_u8str_P(PSTR("FAN")); |
| 901 | + lcd.setCursor(FANX + 1, 6); lcd.write('%'); |
| 902 | + lcd.setCursor(FANX, 7); |
| 903 | + lcd.print(i16tostr3rj(per)); |
| 904 | + |
| 905 | + if (TERN0(HAS_FAN0, thermalManager.fan_speed[0]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2])) |
| 906 | + picBits |= ICON_FAN; |
| 907 | + else |
| 908 | + picBits &= ~ICON_FAN; |
790 | 909 |
|
791 |
| - #endif // HAS_FAN |
| 910 | + #endif // HAS_FAN |
| 911 | + |
| 912 | + #else |
| 913 | + |
| 914 | + TERN_(HAS_COOLER, _draw_cooler_status(blink)); |
| 915 | + TERN_(LASER_COOLANT_FLOW_METER, _draw_flowmeter_status()); |
| 916 | + TERN_(I2C_AMMETER, _draw_ammeter_status()); |
| 917 | + TERN_(HAS_CUTTER, _draw_cutter_status()); |
| 918 | + |
| 919 | + #endif |
792 | 920 |
|
793 | 921 | //
|
794 | 922 | // Line 9, 10 - icons
|
|
0 commit comments