mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 21:36:21 +00:00
✨ Laser support for TFT GLCD (#22391)
This commit is contained in:
parent
2e5e5c4a1d
commit
603b65e843
@ -213,7 +213,7 @@
|
||||
#define LCD_PROGRESS_BAR
|
||||
#endif
|
||||
#if ENABLED(TFTGLCD_PANEL_I2C)
|
||||
#define LCD_I2C_ADDRESS 0x27 // Must be equal to panel's I2C slave addres
|
||||
#define LCD_I2C_ADDRESS 0x33 // Must be 0x33 for STM32 main boards and equal to panel's I2C slave addres
|
||||
#endif
|
||||
#define LCD_USE_I2C_BUZZER // Enable buzzer on LCD, used for both I2C and SPI buses (LiquidTWI2 not required)
|
||||
#define STD_ENCODER_PULSES_PER_STEP 2
|
||||
|
@ -57,6 +57,18 @@
|
||||
#include "../../gcode/parser.h"
|
||||
#endif
|
||||
|
||||
#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
|
||||
#include "../../feature/cooler.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(I2C_AMMETER)
|
||||
#include "../../feature/ammeter.h"
|
||||
#endif
|
||||
|
||||
#if HAS_CUTTER
|
||||
#include "../../feature/spindle_laser.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
@ -64,12 +76,12 @@
|
||||
TFTGLCD lcd;
|
||||
|
||||
#define ICON_LOGO B00000001
|
||||
#define ICON_TEMP1 B00000010 //hotend 1
|
||||
#define ICON_TEMP2 B00000100 //hotend 2
|
||||
#define ICON_TEMP3 B00001000 //hotend 3
|
||||
#define ICON_TEMP1 B00000010 // Hotend 1
|
||||
#define ICON_TEMP2 B00000100 // Hotend 2
|
||||
#define ICON_TEMP3 B00001000 // Hotend 3
|
||||
#define ICON_BED B00010000
|
||||
#define ICON_FAN B00100000
|
||||
#define ICON_HOT B01000000 //when any T > 50deg
|
||||
#define ICON_HOT B01000000 // When any T > 50deg
|
||||
#define PIC_MASK 0x7F
|
||||
|
||||
// LEDs not used, for compatibility with Smoothieware
|
||||
@ -433,6 +445,8 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
|
||||
#if HAS_HOTEND || HAS_HEATED_BED
|
||||
|
||||
FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *prefix, const bool blink) {
|
||||
uint8_t pic_hot_bits;
|
||||
#if HAS_HEATED_BED
|
||||
@ -497,6 +511,96 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
|
||||
else picBits &= ~ICON_HOT;
|
||||
}
|
||||
|
||||
#endif // HAS_HOTEND || HAS_HEATED_BED
|
||||
|
||||
#if HAS_COOLER
|
||||
|
||||
FORCE_INLINE void _draw_cooler_status(const bool blink) {
|
||||
const celsius_t t2 = thermalManager.degTargetCooler();
|
||||
|
||||
lcd.setCursor(0, 5); lcd_put_u8str_P(PSTR("COOL"));
|
||||
lcd.setCursor(1, 6); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
|
||||
lcd.setCursor(1, 7);
|
||||
|
||||
#if !HEATER_IDLE_HANDLER
|
||||
UNUSED(blink);
|
||||
#else
|
||||
if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
|
||||
lcd_put_wchar(' ');
|
||||
if (t2 >= 10) lcd_put_wchar(' ');
|
||||
if (t2 >= 100) lcd_put_wchar(' ');
|
||||
}
|
||||
else
|
||||
#endif
|
||||
lcd_put_u8str(i16tostr3left(t2));
|
||||
|
||||
lcd_put_wchar(' ');
|
||||
if (t2 < 10) lcd_put_wchar(' ');
|
||||
|
||||
if (t2) picBits |= ICON_TEMP1;
|
||||
else picBits &= ~ICON_TEMP1;
|
||||
}
|
||||
|
||||
#endif // HAS_COOLER
|
||||
|
||||
#if ENABLED(LASER_COOLANT_FLOW_METER)
|
||||
|
||||
FORCE_INLINE void _draw_flowmeter_status() {
|
||||
lcd.setCursor(5, 5); lcd_put_u8str_P(PSTR("FLOW"));
|
||||
lcd.setCursor(7, 6); lcd_put_wchar('L');
|
||||
lcd.setCursor(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
|
||||
|
||||
if (cooler.flowrate) picBits |= ICON_FAN;
|
||||
else picBits &= ~ICON_FAN;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(I2C_AMMETER)
|
||||
|
||||
FORCE_INLINE void _draw_ammeter_status() {
|
||||
lcd.setCursor(10, 5); lcd_put_u8str_P(PSTR("ILAZ"));
|
||||
ammeter.read();
|
||||
lcd.setCursor(11, 6);
|
||||
if (ammeter.current <= 0.999f)
|
||||
{
|
||||
lcd_put_u8str("mA");
|
||||
lcd.setCursor(10, 7);
|
||||
lcd_put_wchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f)));
|
||||
}
|
||||
else {
|
||||
lcd_put_u8str(" A");
|
||||
lcd.setCursor(10, 7);
|
||||
lcd_put_u8str(ftostr12ns(ammeter.current));
|
||||
}
|
||||
|
||||
if (ammeter.current) picBits |= ICON_BED;
|
||||
else picBits &= ~ICON_BED;
|
||||
}
|
||||
|
||||
#endif // I2C_AMMETER
|
||||
|
||||
#if HAS_CUTTER
|
||||
|
||||
FORCE_INLINE void _draw_cutter_status() {
|
||||
lcd.setCursor(15, 5); lcd_put_u8str_P(PSTR("CUTT"));
|
||||
#if CUTTER_UNIT_IS(RPM)
|
||||
lcd.setCursor(16, 6); lcd_put_u8str_P(PSTR("RPM"));
|
||||
lcd.setCursor(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
|
||||
lcd_put_wchar('K');
|
||||
#elif CUTTER_UNIT_IS(PERCENT)
|
||||
lcd.setCursor(17, 6); lcd_put_wchar('%');
|
||||
lcd.setCursor(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
||||
#else
|
||||
lcd.setCursor(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower));
|
||||
#endif
|
||||
|
||||
if (cutter.unitPower) picBits |= ICON_HOT;
|
||||
else picBits &= ~ICON_HOT;
|
||||
}
|
||||
|
||||
#endif // HAS_CUTTER
|
||||
|
||||
#if HAS_PRINT_PROGRESS
|
||||
|
||||
FORCE_INLINE void _draw_print_progress() {
|
||||
@ -533,7 +637,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // LCD_PROGRESS_BAR
|
||||
|
||||
void MarlinUI::draw_status_message(const bool blink) {
|
||||
if (!PanelDetected) return;
|
||||
@ -648,6 +752,19 @@ or
|
||||
|
||||
or
|
||||
|
||||
|X 000 Y 000 Z 000.00|
|
||||
|FR100% SD100% C--:--|
|
||||
| Progress bar line |
|
||||
|Status message |
|
||||
| |
|
||||
|COOL FLOW ILAZ CUTT |
|
||||
| ttc L mA RPM |
|
||||
| tts f.f aaa rr.rK|
|
||||
| ICO ICO ICO ICO |
|
||||
| ICO ICO ICO ICO |
|
||||
|
||||
or
|
||||
|
||||
Equal to 24x10 text LCD
|
||||
|
||||
|X 000 Y 000 Z 000.00 |
|
||||
@ -745,9 +862,11 @@ void MarlinUI::draw_status_screen() {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Line 6..8 Temperatures, FAN
|
||||
// Line 6..8 Temperatures, FAN for printer or Cooler, Flowmetter, Ampermeter, Cutter for laser/spindle
|
||||
//
|
||||
|
||||
#if HAS_HOTEND
|
||||
|
||||
#if HOTENDS < 2
|
||||
_draw_heater_status(H_E0, "HE", blink); // Hotend Temperature
|
||||
#else
|
||||
@ -790,6 +909,15 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
#endif // HAS_FAN
|
||||
|
||||
#else
|
||||
|
||||
TERN_(HAS_COOLER, _draw_cooler_status(blink));
|
||||
TERN_(LASER_COOLANT_FLOW_METER, _draw_flowmeter_status());
|
||||
TERN_(I2C_AMMETER, _draw_ammeter_status());
|
||||
TERN_(HAS_CUTTER, _draw_cutter_status());
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Line 9, 10 - icons
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user