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

🎨 Improve LulzBot FTDI Eve Touch UI #27275

Merged
merged 16 commits into from
Aug 6, 2024
33 changes: 14 additions & 19 deletions Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,17 @@ void FilesScreen::drawFileButton(int x, int y, int w, int h, const char *filenam
cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color));
cmd.font(font_medium).rectangle(bx, by, bw, bh);
cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled));
#if ENABLED(SCROLL_LONG_FILENAMES)
if (is_highlighted) {
cmd.cmd(SAVE_CONTEXT());
cmd.cmd(SCISSOR_XY(x,y));
cmd.cmd(SCISSOR_SIZE(w,h));
cmd.cmd(MACRO(0));
cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
} else
#endif
draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX);
#if ENABLED(SCROLL_LONG_FILENAMES)
if (is_highlighted) cmd.cmd(RESTORE_CONTEXT());
#endif
if (TERN0(SCROLL_LONG_FILENAMES, is_highlighted)) {
cmd.cmd(SAVE_CONTEXT());
cmd.cmd(SCISSOR_XY(x,y));
cmd.cmd(SCISSOR_SIZE(w,h));
cmd.cmd(MACRO(0));
cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
}
else
draw_text_with_ellipsis(cmd, bx, by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX);
if (TERN0(SCROLL_LONG_FILENAMES, is_highlighted)) cmd.cmd(RESTORE_CONTEXT());
}

void FilesScreen::drawFileList() {
Expand All @@ -136,11 +133,9 @@ void FilesScreen::drawFileList() {

uint16_t fileIndex = mydata.cur_page * FILES_PER_PAGE;
for (uint8_t i = 0; i < FILES_PER_PAGE; i++, fileIndex++) {
if (files.seek(fileIndex)) {
drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false);
mydata.flags.is_empty = false;
} else
break;
if (!files.seek(fileIndex)) break;
drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false);
mydata.flags.is_empty = false;
}
}

Expand Down
13 changes: 12 additions & 1 deletion Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace ExtUI {

void onPrintTimerStarted() {
InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_STARTED);
current_screen.forget();
PUSH_SCREEN(StatusScreen);
}
void onPrintTimerStopped() {
InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FINISHED);
Expand Down Expand Up @@ -118,9 +120,18 @@ namespace ExtUI {
if (msg)
ConfirmUserRequestAlertBox::show(msg);
else
ConfirmUserRequestAlertBox::hide();
ConfirmUserRequestAlertBox::show("Press Resume to Continue");
}

#if ENABLED(ADVANCED_PAUSE_FEATURE)
void filament_load_prompt(const char * const msg) {
if (msg)
FilamentPromptBox::show();
else
FilamentPromptBox::hide();
}
#endif

// For fancy LCDs include an icon ID, message, and translated button title
void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) {
onUserConfirmRequired(cstr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
****************************************************************************/

#include "ftdi_extended.h"
#include "../../screens.h"

#if ENABLED(FTDI_EXTENDED)
using namespace FTDI;
Expand All @@ -32,6 +33,7 @@ enum {
tiny_timer_t touch_timer;
UIData::flags_t UIData::flags;
uint8_t pressed_tag = UNPRESSED;
uint8_t lastPauseMsgState = 0;

uint8_t UIData::get_persistent_data_mask() {
// A bit mask for flags that should be stored to the EEPROM.
Expand Down Expand Up @@ -117,6 +119,31 @@ namespace FTDI {
return;
}

#if ENABLED(ADVANCED_PAUSE_FEATURE)
if (ExtUI::awaitingUserConfirm() && (lastPauseMsgState != ExtUI::pauseModeStatus)) {
//SERIAL_ECHOLNPGM("Calling Pause Screen : ", lastPauseMsgState);
switch (ExtUI::pauseModeStatus) {
case PAUSE_MESSAGE_PARKING: ExtUI::onStatusChanged(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break;
case PAUSE_MESSAGE_CHANGING: ExtUI::onStatusChanged(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break;
case PAUSE_MESSAGE_UNLOAD: ExtUI::onStatusChanged(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break;
case PAUSE_MESSAGE_WAITING: ExtUI::onStatusChanged(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break;
case PAUSE_MESSAGE_INSERT: ExtUI::onStatusChanged(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break;
case PAUSE_MESSAGE_LOAD: ExtUI::onStatusChanged(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break;
case PAUSE_MESSAGE_PURGE: ExtUI::onStatusChanged(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break;
case PAUSE_MESSAGE_RESUME: ExtUI::onStatusChanged(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break;
case PAUSE_MESSAGE_HEAT: ExtUI::onStatusChanged(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break;
case PAUSE_MESSAGE_HEATING: ExtUI::onStatusChanged(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break;
case PAUSE_MESSAGE_OPTION: FilamentPromptBox::show(); break;
case PAUSE_MESSAGE_STATUS: break;
default: ExtUI::onUserConfirmRequired(PSTR("Confirm Continue")); break;
}
}
else if (!ExtUI::awaitingUserConfirm() && !ExtUI::isPrintingPaused() && !ExtUI::getHostKeepaliveIsPaused()) {
ConfirmUserRequestAlertBox::hide();
FilamentPromptBox::hide();
}
#endif // ADVANCED_PAUSE_FEATURE

const uint8_t tag = CLCD::get_tag();

switch (pressed_tag) {
Expand Down
103 changes: 47 additions & 56 deletions Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* Written By Brian Kahl 2023 - FAME3D *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand All @@ -22,11 +23,12 @@

#include "../config.h"
#include "../screens.h"
#include "../../ui_api.h"

#ifdef FTDI_ABOUT_SCREEN

#define GRID_COLS 4
#define GRID_ROWS 8
#define GRID_ROWS 30

using namespace FTDI;
using namespace Theme;
Expand All @@ -43,74 +45,63 @@ void AboutScreen::onRedraw(draw_mode_t) {
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);

#define HEADING_POS BTN_POS(1,1), BTN_SIZE(4,2)
#define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1)
#define FW_INFO_POS BTN_POS(1,4), BTN_SIZE(4,1)
#define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,3)
#define STATS_POS BTN_POS(1,8), BTN_SIZE(2,1)
#define BACK_POS BTN_POS(3,8), BTN_SIZE(2,1)

char about_str[1
+ strlen_P(GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2))
#ifdef TOOLHEAD_NAME
+ strlen_P(TOOLHEAD_NAME)
#endif
];
#ifdef TOOLHEAD_NAME
// If MSG_ABOUT_TOUCH_PANEL_2 has %s, substitute in the toolhead name.
// But this is optional, so squelch the compiler warning here.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
sprintf_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2), TOOLHEAD_NAME);
#pragma GCC diagnostic pop
#else
strcpy_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2));
#ifdef LULZBOT_LCD_MACHINE_NAME
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(4,6), F(
#if ENABLED(LULZBOT_LONG_BED)
"" LULZBOT_LCD_MACHINE_NAME " \nWith Long Bed"
#elif ENABLED(LULZBOT_LONG_BED_V2)
"" LULZBOT_LCD_MACHINE_NAME " \nWith Long Bed V2"
#elif ENABLED(LULZBOT_BLTouch) && NONE(LULZBOT_LONG_BED_V2, TAZProV2)
"" LULZBOT_LCD_MACHINE_NAME " \nWith BLTouch"
#else
"" LULZBOT_LCD_MACHINE_NAME "\n"
#endif
), OPT_CENTER, font_xxlarge);
#endif

draw_text_box(cmd, HEADING_POS,
#ifdef MACHINE_NAME
F(MACHINE_NAME)
#else
GET_TEXT_F(MSG_ABOUT_TOUCH_PANEL_1)
#endif
, OPT_CENTER, font_xlarge
);
#if ALL(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU)
#ifdef LULZBOT_LCD_MACHINE_NAME
cmd.tag(3);
draw_text_box(cmd, BTN_POS(1,7), BTN_SIZE(4,3), F(
"Firmware:"
), OPT_CENTER, font_xlarge);

draw_text_box(cmd, BTN_POS(1,10), BTN_SIZE(4,2), F(
"" LULZBOT_M115_EXTRUDER_TYPE ""
), OPT_CENTER, font_xlarge);
#endif
draw_text_box(cmd, FW_VERS_POS,
#ifdef TOUCH_UI_VERSION
F(TOUCH_UI_VERSION)
#else
FPSTR(getFirmwareName_str())
#endif
, OPT_CENTER, font_medium);
cmd.tag(0);
draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium);
draw_text_box(cmd, LICENSE_POS, GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny);

cmd.font(font_medium);
#if ALL(PRINTCOUNTER, FTDI_STATISTICS_SCREEN)
cmd.colors(normal_btn)
.tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU));

#if ENABLED(SHOW_TOOL_HEAD_ID)
draw_text_box(cmd, BTN_POS(1,13), BTN_SIZE(4,3), F(
"Tool Head:"
), OPT_CENTER, font_xlarge);
#endif
cmd.colors(action_btn)
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE));

draw_text_box(cmd, BTN_POS(1,19), BTN_SIZE(4,3), F(
"Version:"
), OPT_CENTER, font_xlarge);

draw_text_box(cmd, BTN_POS(1,22), BTN_SIZE(4,2), F(
"Marlin " SHORT_BUILD_VERSION ""
), OPT_CENTER, font_xlarge);


cmd.font(font_medium).colors(normal_btn).tag(1).button(BTN_POS(1,24), BTN_SIZE(4,3), GET_TEXT_F(MSG_INFO_PRINTER_STATS_MENU));

cmd.font(font_medium).colors(action_btn).tag(2).button(BTN_POS(1,27), BTN_SIZE(4,3), GET_TEXT_F(MSG_BUTTON_DONE));

}

bool AboutScreen::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: GOTO_PREVIOUS(); break;
switch(tag) {
default: return false;
#if ALL(PRINTCOUNTER, FTDI_STATISTICS_SCREEN)
case 2: GOTO_SCREEN(StatisticsScreen); break;
case 1: GOTO_SCREEN(StatisticsScreen); break;
#endif
case 2: GOTO_PREVIOUS(); return true;
#if ALL(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU)
case 3: GOTO_SCREEN(DeveloperMenu); break;
#endif
default: return false;
}
return true;
}

#endif // FTDI_ABOUT_SCREEN
#endif // EXTENSIBLE_UI
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* Written By Brian Kahl 2023 - FAME3D. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down Expand Up @@ -43,21 +44,21 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
#define GRID_ROWS 8
#endif
#define GRID_COLS 2
#define RESTORE_DEFAULTS_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define DISPLAY_POS BTN_POS(1,2), BTN_SIZE(1,1)
#define INTERFACE_POS BTN_POS(2,2), BTN_SIZE(1,1)
#define ZPROBE_ZOFFSET_POS BTN_POS(1,3), BTN_SIZE(1,1)
#define STEPS_PER_MM_POS BTN_POS(2,3), BTN_SIZE(1,1)
#define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1)
#define VELOCITY_POS BTN_POS(2,4), BTN_SIZE(1,1)
#define TMC_CURRENT_POS BTN_POS(1,5), BTN_SIZE(1,1)
#define ACCELERATION_POS BTN_POS(2,5), BTN_SIZE(1,1)
#define ENDSTOPS_POS BTN_POS(1,6), BTN_SIZE(1,1)
#define JERK_POS BTN_POS(2,6), BTN_SIZE(1,1)
#define CASE_LIGHT_POS BTN_POS(1,7), BTN_SIZE(1,1)
#define BACKLASH_POS BTN_POS(2,7), BTN_SIZE(1,1)
#define OFFSETS_POS BTN_POS(1,8), BTN_SIZE(1,1)
#define TMC_HOMING_THRS_POS BTN_POS(2,8), BTN_SIZE(1,1)
#define RESTORE_DEFAULTS_POS BTN_POS(1,8), BTN_SIZE(2,1)
#define DISPLAY_POS BTN_POS(2,7), BTN_SIZE(1,1)
#define INTERFACE_POS BTN_POS(1,7), BTN_SIZE(1,1)
#define ZPROBE_ZOFFSET_POS BTN_POS(1,1), BTN_SIZE(1,1)
#define STEPS_PER_MM_POS BTN_POS(1,2), BTN_SIZE(1,1)
#define FILAMENT_POS BTN_POS(1,3), BTN_SIZE(1,1)
#define VELOCITY_POS BTN_POS(2,1), BTN_SIZE(1,1)
#define TMC_CURRENT_POS BTN_POS(2,5), BTN_SIZE(1,1)
#define ACCELERATION_POS BTN_POS(2,2), BTN_SIZE(1,1)
#define ENDSTOPS_POS BTN_POS(1,5), BTN_SIZE(1,1)
#define JERK_POS BTN_POS(2,3), BTN_SIZE(1,1)
#define FLOW_POS BTN_POS(1,6), BTN_SIZE(1,1)
#define BACKLASH_POS BTN_POS(2,4), BTN_SIZE(1,1)
#define OFFSETS_POS BTN_POS(1,4), BTN_SIZE(1,1)
#define TMC_HOMING_THRS_POS BTN_POS(2,6), BTN_SIZE(1,1)
#if ANY(HAS_MULTI_HOTEND, SENSORLESS_HOMING)
#define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
#else
Expand All @@ -67,7 +68,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
#define GRID_COLS 3
#define GRID_ROWS 6
#define ZPROBE_ZOFFSET_POS BTN_POS(1,1), BTN_SIZE(1,1)
#define CASE_LIGHT_POS BTN_POS(1,4), BTN_SIZE(1,1)
#define FLOW_POS BTN_POS(1,4), BTN_SIZE(1,1)
#define STEPS_PER_MM_POS BTN_POS(2,1), BTN_SIZE(1,1)
#define TMC_CURRENT_POS BTN_POS(3,1), BTN_SIZE(1,1)
#define TMC_HOMING_THRS_POS BTN_POS(3,2), BTN_SIZE(1,1)
Expand All @@ -89,14 +90,16 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
cmd.colors(normal_btn)
.font(Theme::font_medium)
.enabled(ENABLED(HAS_BED_PROBE))
.tag(2) .button(ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET))
.enabled(ENABLED(CASE_LIGHT_ENABLE))
.tag(16).button(CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
.tag(2) .button(ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZOFFSET))
.tag(16).button(FLOW_POS, GET_TEXT_F(MSG_FLOW))
.tag(3) .button(STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM))
.enabled(ENABLED(HAS_TRINAMIC_CONFIG))
.tag(13).button(TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT))
.enabled(ENABLED(SENSORLESS_HOMING))
.tag(14).button(TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS))
#if ENABLED(SENSORLESS_HOMING)
.tag(14).button(TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS))
#else
.tag(17).button(TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_CLEAN_NOZZLE))
#endif
.enabled(ENABLED(HAS_MULTI_HOTEND))
.tag(4) .button(OFFSETS_POS, GET_TEXT_F(MSG_OFFSETS_MENU))
.enabled(ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR))
Expand All @@ -119,14 +122,14 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
#if HAS_BED_PROBE
case 2: GOTO_SCREEN(ZOffsetScreen); break;
case 2: GOTO_SCREEN(ZOffsetScreen); break;
#endif
case 3: GOTO_SCREEN(StepsScreen); break;
case 3: GOTO_SCREEN(StepsScreen); break;
#if HAS_MULTI_HOTEND
case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
#endif
case 5: GOTO_SCREEN(MaxVelocityScreen); break;
case 6: GOTO_SCREEN(DefaultAccelerationScreen); break;
case 5: GOTO_SCREEN(MaxVelocityScreen); break;
case 6: GOTO_SCREEN(DefaultAccelerationScreen); break;
case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break;
#if ENABLED(BACKLASH_GCODE)
case 8: GOTO_SCREEN(BacklashCompensationScreen); break;
Expand All @@ -144,9 +147,14 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
#endif
case 15: GOTO_SCREEN(DisplayTuningScreen); break;
#if ENABLED(CASE_LIGHT_ENABLE)
case 16: GOTO_SCREEN(CaseLightScreen); break;
#endif
case 16: GOTO_SCREEN(FlowPercentScreen); break;
case 17:
GOTO_SCREEN(StatusScreen);
#ifndef CLEAN_SCRIPT
#define CLEAN_SCRIPT "G12"
#endif
injectCommands(F(CLEAN_SCRIPT));
break;
default: return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void AlertDialogBox::onEntry() {

void AlertDialogBox::onRedraw(draw_mode_t what) {
if (what & FOREGROUND) {
drawOkayButton();
drawDoneButton();
}
}

Expand Down
Loading
Loading