Skip to content

Commit

Permalink
Fixes and additions to FTDI EVE Touch UI (MarlinFirmware#20393)
Browse files Browse the repository at this point in the history
- Fixed name conflict with "SUBSCRIPT_TWO"
- Fixed rendering bugs in "Leveling Menu"
- Only show "Bed Mesh Screen" when UBL is enabled
- Removed CocoaPress code from generic "Main Menu"
- Removed CocoaPress code from LulzBot Bio "Status" screen
- Moved generic "Move Axis" functionality into a base class
- Added CocoaPress custom screens:
   - Status Screen
   - Unload Cartridge
   - Load Chocolate
   - Main Menu
   - Advanced Settings
   - XYZ Move (based on "Move Axis" base class)
   - Extrusion Move (based on "Move Axis" base class)
- CocoaPress tweaks to "Temperature" screen
- Fix FTDI EVE Touch UI compilation errors when not using leveling.
  • Loading branch information
marciot authored Dec 9, 2020
1 parent 3e68e4b commit f3bddc4
Show file tree
Hide file tree
Showing 23 changed files with 1,166 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
YEN_SIGN,
#endif
#if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS)
SUPERSCRIPT_ONE,
SUPERSCRIPT_TWO,
SUPERSCRIPT_THREE,
SUPERSCRIPT_1,
SUPERSCRIPT_2,
SUPERSCRIPT_3,
#endif
#if ENABLED(TOUCH_UI_UTF8_ORDINALS)
MASCULINE_ORDINAL,
Expand Down Expand Up @@ -177,15 +177,15 @@
{UTF8('±'), 0 , NOT_SIGN, 32 },
#endif
#if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS)
{UTF8('²'), 0 , SUPERSCRIPT_TWO, 16 },
{UTF8('³'), 0 , SUPERSCRIPT_THREE, 16 },
{UTF8('²'), 0 , SUPERSCRIPT_2, 16 },
{UTF8('³'), 0 , SUPERSCRIPT_3, 16 },
#endif
#if ENABLED(TOUCH_UI_UTF8_SYMBOLS)
{UTF8('µ'), 0 , MICRON_SIGN, 28 },
{UTF8(''), 0 , PILCROW_SIGN, 24 },
#endif
#if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS)
{UTF8('¹'), 0 , SUPERSCRIPT_ONE, 16 },
{UTF8('¹'), 0 , SUPERSCRIPT_1, 16 },
#endif
#if ENABLED(TOUCH_UI_UTF8_ORDINALS)
{UTF8('º'), 0 , MASCULINE_ORDINAL, 19 },
Expand Down
24 changes: 15 additions & 9 deletions Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
#define COPYRIGHT_SIGN u8"(c)"
#endif

#if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS)
#define SUPERSCRIPT_TWO u8"²"
#else
#define SUPERSCRIPT_TWO u8"^2"
#endif

#if ENABLED(TOUCH_UI_UTF8_WESTERN_CHARSET)
#define DEGREE_SIGN u8"°"
#else
Expand Down Expand Up @@ -162,9 +156,21 @@ namespace Language_en {
#endif

#ifdef TOUCH_UI_COCOA_PRESS
PROGMEM Language_Str MSG_ZONE_1 = u8"Zone 1:";
PROGMEM Language_Str MSG_ZONE_2 = u8"Zone 2:";
PROGMEM Language_Str MSG_ZONE_3 = u8"Zone 3:";
PROGMEM Language_Str MSG_BODY = u8"Body";
PROGMEM Language_Str MSG_INTERNAL = u8"Internal";
PROGMEM Language_Str MSG_EXTERNAL = u8"External";
PROGMEM Language_Str MSG_CHOCOLATE = u8"Chocolate";
PROGMEM Language_Str MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge";
PROGMEM Language_Str MSG_LOAD_CHOCOLATE = u8"Load Chocolate";
PROGMEM Language_Str MSG_CARTRIDGE_IN = u8"Cartridge In";
PROGMEM Language_Str MSG_CARTRIDGE_OUT = u8"Cartridge Out";
PROGMEM Language_Str MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate";
PROGMEM Language_Str MSG_PREHEAT_FINISHED = u8"Preheat finished";
PROGMEM Language_Str MSG_PREHEAT = u8"Preheat";
PROGMEM Language_Str MSG_BUTTON_PAUSE = u8"Pause";
PROGMEM Language_Str MSG_BUTTON_RESUME = u8"Resume";
PROGMEM Language_Str MSG_ELAPSED_PRINT = u8"Elapsed Print";
PROGMEM Language_Str MSG_XYZ_MOVE = u8"XYZ Move";
PROGMEM Language_Str MSG_E_MOVE = u8"Extrusion Move";
#endif
}; // namespace Language_en
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../config.h"

#if ENABLED(TOUCH_UI_FTDI_EVE) && DISABLED(TOUCH_UI_LULZBOT_BIO)
#if ENABLED(TOUCH_UI_FTDI_EVE) && NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS)

#include "screens.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "../config.h"

#if BOTH(TOUCH_UI_FTDI_EVE, HAS_MESH)
#if BOTH(TOUCH_UI_FTDI_EVE, AUTO_BED_LEVELING_UBL)

#include "screens.h"
#include "screen_data.h"
Expand Down
177 changes: 47 additions & 130 deletions Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@

#include "../config.h"

#if ENABLED(TOUCH_UI_FTDI_EVE) && ANY(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS)
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO)

#include "screens.h"

#include "../ftdi_eve_lib/extras/poly_ui.h"

#if ENABLED(TOUCH_UI_COCOA_PRESS)
#include "cocoa_press_ui.h"
#elif ENABLED(TOUCH_UI_PORTRAIT)
#if ENABLED(TOUCH_UI_PORTRAIT)
#include "bio_printer_ui_portrait.h"
#else
#include "bio_printer_ui_landscape.h"
Expand Down Expand Up @@ -72,55 +70,30 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
if (what & BACKGROUND) {
cmd.cmd(COLOR_RGB(bg_color));

#if ENABLED(TOUCH_UI_LULZBOT_BIO)
// The LulzBot Bio shows the temperature for
// the bed.

#ifdef TOUCH_UI_PORTRAIT
// Draw touch surfaces
ui.bounds(POLY(target_temp), x, y, h, v);
cmd.rectangle(x, y, h, v);
ui.bounds(POLY(actual_temp), x, y, h, v);
cmd.rectangle(x, y, h, v);
#else
ui.bounds(POLY(bed_temp), x, y, h, v);
cmd.rectangle(x, y, h, v);
#endif
ui.bounds(POLY(bed_icon), x, y, h, v);
cmd.rectangle(x, y, h, v);

// Draw bed icon
cmd.cmd(BITMAP_SOURCE(Bed_Heat_Icon_Info))
.cmd(BITMAP_LAYOUT(Bed_Heat_Icon_Info))
.cmd(BITMAP_SIZE (Bed_Heat_Icon_Info))
.cmd(COLOR_RGB(shadow_rgb))
.icon (x + 2, y + 2, h, v, Bed_Heat_Icon_Info, icon_scale * 2)
.cmd(COLOR_RGB(bg_text_enabled))
.icon (x, y, h, v, Bed_Heat_Icon_Info, icon_scale * 2);
#elif ENABLED(TOUCH_UI_COCOA_PRESS) && DISABLED(TOUCH_UI_PORTRAIT)
// The CocoaPress shows the temperature for two
// heating zones, but has no bed temperature

cmd.cmd(COLOR_RGB(bg_text_enabled));
cmd.font(font_xsmall);
// The LulzBot Bio shows the temperature for
// the bed.

ui.bounds(POLY(h0_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_ZONE_1));

ui.bounds(POLY(h1_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_ZONE_2));

ui.bounds(POLY(h2_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_ZONE_3));

ui.bounds(POLY(h3_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHAMBER));
#ifdef TOUCH_UI_PORTRAIT
// Draw touch surfaces
ui.bounds(POLY(target_temp), x, y, h, v);
cmd.rectangle(x, y, h, v);
ui.bounds(POLY(actual_temp), x, y, h, v);
cmd.rectangle(x, y, h, v);
#else
UNUSED(x);
UNUSED(y);
UNUSED(h);
UNUSED(v);
ui.bounds(POLY(bed_temp), x, y, h, v);
cmd.rectangle(x, y, h, v);
#endif
ui.bounds(POLY(bed_icon), x, y, h, v);
cmd.rectangle(x, y, h, v);

// Draw bed icon
cmd.cmd(BITMAP_SOURCE(Bed_Heat_Icon_Info))
.cmd(BITMAP_LAYOUT(Bed_Heat_Icon_Info))
.cmd(BITMAP_SIZE (Bed_Heat_Icon_Info))
.cmd(COLOR_RGB(shadow_rgb))
.icon (x + 2, y + 2, h, v, Bed_Heat_Icon_Info, icon_scale * 2)
.cmd(COLOR_RGB(bg_text_enabled))
.icon (x, y, h, v, Bed_Heat_Icon_Info, icon_scale * 2);

#ifdef TOUCH_UI_USE_UTF8
load_utf8_bitmaps(cmd); // Restore font bitmap handles
Expand All @@ -130,71 +103,29 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
if (what & FOREGROUND) {
char str[15];
cmd.cmd(COLOR_RGB(bg_text_enabled));
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
cmd.font(font_medium);

#ifdef TOUCH_UI_PORTRAIT
if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0)
format_temp(str, getTargetTemp_celsius(BED));
else
strcpy_P(str, GET_TEXT(MSG_BED));

ui.bounds(POLY(target_temp), x, y, h, v);
cmd.text(x, y, h, v, str);

format_temp(str, getActualTemp_celsius(BED));
ui.bounds(POLY(actual_temp), x, y, h, v);
cmd.text(x, y, h, v, str);
#else
if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0)
format_temp_and_temp(str, getActualTemp_celsius(BED), getTargetTemp_celsius(BED));
else
format_temp_and_idle(str, getActualTemp_celsius(BED));

ui.bounds(POLY(bed_temp), x, y, h, v);
cmd.text(x, y, h, v, str);
#endif

#elif ENABLED(TOUCH_UI_COCOA_PRESS) && DISABLED(TOUCH_UI_PORTRAIT)
// The CocoaPress shows the temperature for two
// heating zones, but has no bed temperature

cmd.font(font_large);

if (!isHeaterIdle(E0) && getTargetTemp_celsius(E0) > 0)
format_temp_and_temp(str, getActualTemp_celsius(E0), getTargetTemp_celsius(E0));
else
format_temp_and_idle(str, getActualTemp_celsius(E0));
cmd.font(font_medium);

ui.bounds(POLY(h0_temp), x, y, h, v);
cmd.text(x, y, h, v, str);

if (!isHeaterIdle(E1) && getTargetTemp_celsius(E1) > 0)
format_temp_and_temp(str, getActualTemp_celsius(E1), getTargetTemp_celsius(E1));
#ifdef TOUCH_UI_PORTRAIT
if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0)
format_temp(str, getTargetTemp_celsius(BED));
else
format_temp_and_idle(str, getActualTemp_celsius(E1));
strcpy_P(str, GET_TEXT(MSG_BED));

ui.bounds(POLY(h1_temp), x, y, h, v);
ui.bounds(POLY(target_temp), x, y, h, v);
cmd.text(x, y, h, v, str);

if (!isHeaterIdle(E2) && getTargetTemp_celsius(E2) > 0)
format_temp_and_temp(str, getActualTemp_celsius(E2), getTargetTemp_celsius(E2));
else
format_temp_and_idle(str, getActualTemp_celsius(E2));

ui.bounds(POLY(h2_temp), x, y, h, v);
format_temp(str, getActualTemp_celsius(BED));
ui.bounds(POLY(actual_temp), x, y, h, v);
cmd.text(x, y, h, v, str);

if (!isHeaterIdle(CHAMBER) && getTargetTemp_celsius(CHAMBER) > 0)
format_temp_and_temp(str, getActualTemp_celsius(CHAMBER), getTargetTemp_celsius(CHAMBER));
#else
if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0)
format_temp_and_temp(str, getActualTemp_celsius(BED), getTargetTemp_celsius(BED));
else
format_temp_and_idle(str, getActualTemp_celsius(CHAMBER));
format_temp_and_idle(str, getActualTemp_celsius(BED));

ui.bounds(POLY(h3_temp), x, y, h, v);
ui.bounds(POLY(bed_temp), x, y, h, v);
cmd.text(x, y, h, v, str);
#else
UNUSED(str);
#endif
#endif
}
}

Expand All @@ -207,7 +138,7 @@ void StatusScreen::draw_syringe(draw_mode_t what) {
0.75
#endif
);
const bool e_homed = TERN0(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0));
const bool e_homed = TERN1(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0));

CommandProcessor cmd;
PolyUI ui(cmd, what);
Expand Down Expand Up @@ -247,7 +178,7 @@ void StatusScreen::draw_arrows(draw_mode_t what) {
ui.button_stroke(stroke_rgb, 28);
ui.button_shadow(shadow_rgb, shadow_depth);

constexpr uint8_t style = TERN(TOUCH_UI_COCOA_PRESS, PolyUI::FILL | PolyUI::SHADOW, PolyUI::REGULAR);
constexpr uint8_t style = PolyUI::REGULAR;

if ((what & BACKGROUND) || jog_xy) {
ui.button(1, POLY(x_neg), style);
Expand All @@ -262,9 +193,7 @@ void StatusScreen::draw_arrows(draw_mode_t what) {
}

if ((what & BACKGROUND) || e_homed) {
#if DISABLED(TOUCH_UI_COCOA_PRESS)
ui.button(7, POLY(e_neg), style);
#endif
ui.button(7, POLY(e_neg), style);
ui.button(8, POLY(e_pos), style);
}
}
Expand Down Expand Up @@ -304,11 +233,11 @@ void StatusScreen::draw_overlay_icons(draw_mode_t what) {
PolyUI ui(cmd, what);

if (what & FOREGROUND) {
ui.button_fill (TERN(TOUCH_UI_COCOA_PRESS, stroke_rgb, fill_rgb));
ui.button_fill (fill_rgb);
ui.button_stroke(stroke_rgb, 28);
ui.button_shadow(shadow_rgb, shadow_depth);

constexpr uint8_t style = TERN(TOUCH_UI_COCOA_PRESS, PolyUI::FILL | PolyUI::SHADOW, PolyUI::REGULAR);
constexpr uint8_t style = PolyUI::REGULAR;
if (!jog_xy) ui.button(12, POLY(padlock), style);
if (!e_homed) ui.button(13, POLY(home_e), style);
if (!z_homed) ui.button(14, POLY(home_z), style);
Expand Down Expand Up @@ -389,9 +318,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
break;
case 9: GOTO_SCREEN(FilesScreen); break;
case 10: GOTO_SCREEN(MainMenu); break;
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
case 13: GOTO_SCREEN(BioConfirmHomeE); break;
#endif
case 13: GOTO_SCREEN(BioConfirmHomeE); break;
case 14: SpinnerDialogBox::enqueueAndWait_P(F("G28 Z")); break;
case 15: GOTO_SCREEN(TemperatureScreen); break;
case 16: fine_motion = !fine_motion; break;
Expand Down Expand Up @@ -431,30 +358,20 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
}

void StatusScreen::setStatusMessage(progmem_str pstr) {
#ifdef TOUCH_UI_LULZBOT_BIO
BioPrintingDialogBox::setStatusMessage(pstr);
#else
UNUSED(pstr);
#endif
BioPrintingDialogBox::setStatusMessage(pstr);
}

void StatusScreen::setStatusMessage(const char * const str) {
#ifdef TOUCH_UI_LULZBOT_BIO
BioPrintingDialogBox::setStatusMessage(str);
#else
UNUSED(str);
#endif
BioPrintingDialogBox::setStatusMessage(str);
}

void StatusScreen::onIdle() {
reset_menu_timeout();
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) {
if (!EventLoop::is_touch_held())
onRefresh();
#ifdef TOUCH_UI_LULZBOT_BIO
if (isPrintingFromMedia())
BioPrintingDialogBox::show();
#endif
if (isPrintingFromMedia())
BioPrintingDialogBox::show();
refresh_timer.start();
}
}
Expand Down
Loading

0 comments on commit f3bddc4

Please sign in to comment.