Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add laser support for TFTGLCD panel #22391

Merged
merged 43 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1de4125
Improve STM32 FastIO
thinkyhead Oct 14, 2020
f8612ef
Use STM_PIN
thinkyhead Oct 15, 2020
804b6f9
Apply for all STM32
thinkyhead Oct 15, 2020
dacfcda
Use digitalPinToPinName in pins debug
thinkyhead Oct 15, 2020
7a647e5
Merge pull request #14 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Oct 17, 2020
723a86f
Merge pull request #15 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Dec 18, 2020
f34960e
Update Russian and Ukranian translations
Serhiy-K Dec 19, 2020
03bb937
Cleanup
thinkyhead Dec 20, 2020
b9096d3
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/20508
thinkyhead Dec 20, 2020
35fc41d
Merge pull request #16 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Dec 20, 2020
763206b
Add STM32F1xx support for TFTGLCD
Serhiy-K Dec 20, 2020
2eb6d0e
Update ubl_G29.cpp
thinkyhead Dec 22, 2020
3cc2ac9
Update marlinui_TFTGLCD.cpp
thinkyhead Dec 22, 2020
71c5bb0
Merge pull request #17 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Jan 10, 2021
c80a0cc
Fix for TFTGLCD
Serhiy-K Jan 10, 2021
74a2232
Merge branch 'bugfix-2.0.x' of https://github.com/Serhiy-K/Marlin int…
Serhiy-K Jan 10, 2021
a75cf22
neaten
thinkyhead Jan 11, 2021
80f55d1
Merge pull request #18 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Jun 20, 2021
cc5de44
Update Ukrainian language
Serhiy-K Jun 20, 2021
4f90fab
Update Ukrainian language
Serhiy-K Jun 20, 2021
ed1f556
Merge pull request #19 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Jun 21, 2021
92d5c44
Update Russian language
Serhiy-K Jun 21, 2021
3d23db1
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/22193
thinkyhead Jun 22, 2021
9870970
configurable axis names
thinkyhead Jun 22, 2021
de93f93
Merge pull request #20 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Jun 25, 2021
6f12202
Update Russian and Ukrainian languages
Serhiy-K Jul 3, 2021
a43e885
Revert "Update Russian and Ukrainian languages"
Serhiy-K Jul 3, 2021
053c103
Update platformio.ini
Serhiy-K Jul 3, 2021
55030dd
Delete pins_PILL_F401XX.h
Serhiy-K Jul 3, 2021
2da48eb
Update pins.h
Serhiy-K Jul 3, 2021
bd6fb70
Update Russian and Ukrainian languages
Serhiy-K Jul 3, 2021
6e4e004
Merge branch 'bugfix-2.0.x' of https://github.com/Serhiy-K/Marlin int…
Serhiy-K Jul 3, 2021
a5b2d34
Update Ukrainian language
Serhiy-K Jul 3, 2021
e917109
sp
thinkyhead Jul 7, 2021
4c2bc83
Add laser support for TFTGLCD panel
Serhiy-K Jul 18, 2021
43a8bd1
Merge branch 'bugfix-2.0.x' of https://github.com/Serhiy-K/Marlin int…
Serhiy-K Jul 18, 2021
56f8309
Merge pull request #21 from MarlinFirmware/bugfix-2.0.x
Serhiy-K Jul 18, 2021
ce386e1
Fix ammeter
Serhiy-K Jul 18, 2021
1572748
Revert "Fix ammeter"
Serhiy-K Jul 18, 2021
f310cb9
Merge branch 'bugfix-2.0.x' of https://github.com/Serhiy-K/Marlin int…
Serhiy-K Jul 18, 2021
319e9df
Fix TFTGLCD
Serhiy-K Jul 18, 2021
8549706
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/22391
thinkyhead Jul 19, 2021
4fbace0
Update marlinui_TFTGLCD.cpp
thinkyhead Jul 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When TFTGLCD_PANEL_I2C is used on other platforms, what should its i2c address be?

#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
Expand Down
196 changes: 162 additions & 34 deletions Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -433,6 +445,8 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
lcd_put_u8str(value);
}

#if HAS_HOTEND

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
Expand Down Expand Up @@ -497,6 +511,96 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
else picBits &= ~ICON_HOT;
}

#endif

#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

#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

#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

#if HAS_PRINT_PROGRESS

FORCE_INLINE void _draw_print_progress() {
Expand Down Expand Up @@ -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 |
Expand Down Expand Up @@ -745,50 +862,61 @@ 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 HOTENDS < 2
_draw_heater_status(H_E0, "HE", blink); // Hotend Temperature
#else
_draw_heater_status(H_E0, "HE1", blink); // Hotend 1 Temperature
_draw_heater_status(H_E1, "HE2", blink); // Hotend 2 Temperature
#if HOTENDS > 2
_draw_heater_status(H_E2, "HE3", blink); // Hotend 3 Temperature
#endif
#endif
#if HAS_HOTEND

#if HAS_HEATED_BED
#if HAS_LEVELING
_draw_heater_status(H_BED, (planner.leveling_active && blink ? "___" : "BED"), blink);
#if HOTENDS < 2
_draw_heater_status(H_E0, "HE", blink); // Hotend Temperature
#else
_draw_heater_status(H_BED, "BED", blink);
_draw_heater_status(H_E0, "HE1", blink); // Hotend 1 Temperature
_draw_heater_status(H_E1, "HE2", blink); // Hotend 2 Temperature
#if HOTENDS > 2
_draw_heater_status(H_E2, "HE3", blink); // Hotend 3 Temperature
#endif
#endif
#endif

#if HAS_FAN
uint16_t spd = thermalManager.fan_speed[0];
#if ENABLED(ADAPTIVE_FAN_SLOWING)
if (!blink) spd = thermalManager.scaledFanSpeed(0, spd);
#if HAS_HEATED_BED
#if HAS_LEVELING
_draw_heater_status(H_BED, (planner.leveling_active && blink ? "___" : "BED"), blink);
#else
_draw_heater_status(H_BED, "BED", blink);
#endif
#endif
uint16_t per = thermalManager.pwmToPercent(spd);

#if HOTENDS < 2
#define FANX 11
#else
#define FANX 17
#endif
lcd.setCursor(FANX, 5); lcd_put_u8str_P(PSTR("FAN"));
lcd.setCursor(FANX + 1, 6); lcd.write('%');
lcd.setCursor(FANX, 7);
lcd.print(i16tostr3rj(per));
#if HAS_FAN
uint16_t spd = thermalManager.fan_speed[0];
#if ENABLED(ADAPTIVE_FAN_SLOWING)
if (!blink) spd = thermalManager.scaledFanSpeed(0, spd);
#endif
uint16_t per = thermalManager.pwmToPercent(spd);

if (TERN0(HAS_FAN0, thermalManager.fan_speed[0]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2]))
picBits |= ICON_FAN;
else
picBits &= ~ICON_FAN;
#if HOTENDS < 2
#define FANX 11
#else
#define FANX 17
#endif
lcd.setCursor(FANX, 5); lcd_put_u8str_P(PSTR("FAN"));
lcd.setCursor(FANX + 1, 6); lcd.write('%');
lcd.setCursor(FANX, 7);
lcd.print(i16tostr3rj(per));

if (TERN0(HAS_FAN0, thermalManager.fan_speed[0]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2]))
picBits |= ICON_FAN;
else
picBits &= ~ICON_FAN;

#endif // HAS_FAN

#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
Expand Down