Skip to content

Commit

Permalink
Improve / fix FTDI EVE Touch UI (MarlinFirmware#17338)
Browse files Browse the repository at this point in the history
- Fix timeout and debugging string
- Fix check for whether `LCD_TIMEOUT_TO_STATUS` is valid
- Fix incorrect debugging message
- Make capitalization of callbacks consistent.
- Allow Touch UI to use hardware SPI on Einsy boards
- Move print stats to About Printer page.
- More generic about screen with GPL license.
- Add missing handler for power loss event
- Less code duplication on status screen and main/advanced menu; more legible
- Reorganize advanced and main menu to add more features
- Hide home Z button when using Z_SAFE_HOMING
- Fix compilation errors when certain features enabled
- Fix missing labels in UI
- Improve color scheme
- Add new preheat menus
- Fix incorrect rendering of Marlin logo on boot
- Add Level X Axis and Auto calibrate buttons
  • Loading branch information
marciot authored Mar 31, 2020
1 parent c759729 commit d83ad6f
Show file tree
Hide file tree
Showing 34 changed files with 641 additions and 474 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/powerloss/M1000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void GcodeSuite::M1000() {
#if HAS_LCD_MENU
ui.goto_screen(menu_job_recovery);
#elif ENABLED(EXTENSIBLE_UI)
ExtUI::OnPowerLossResume();
ExtUI::onPowerLossResume();
#else
SERIAL_ECHO_MSG("Resume requires LCD.");
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/temp/M303.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void GcodeSuite::M303() {
if (!WITHIN(e, SI, EI)) {
SERIAL_ECHOLNPGM(STR_PID_BAD_EXTRUDER_NUM);
#if ENABLED(EXTENSIBLE_UI)
ExtUI::OnPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM);
ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM);
#endif
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ namespace FTDI {
SET_OUTPUT(CLCD_SPI_CS);
WRITE(CLCD_SPI_CS, 1);

#ifdef CLCD_SPI_EXTRA_CS
SET_OUTPUT(CLCD_SPI_EXTRA_CS);
WRITE(CLCD_SPI_EXTRA_CS, 1);
#endif

#ifdef SPI_FLASH_SS
SET_OUTPUT(SPI_FLASH_SS);
WRITE(SPI_FLASH_SS, 1);
Expand Down Expand Up @@ -111,12 +116,18 @@ namespace FTDI {
::SPI.beginTransaction(spi_settings);
#endif
WRITE(CLCD_SPI_CS, 0);
#ifdef CLCD_SPI_EXTRA_CS
WRITE(CLCD_SPI_EXTRA_CS, 0);
#endif
delayMicroseconds(1);
}

// CLCD SPI - Chip Deselect
void SPI::spi_ftdi_deselect() {
WRITE(CLCD_SPI_CS, 1);
#ifdef CLCD_SPI_EXTRA_CS
WRITE(CLCD_SPI_EXTRA_CS, 1);
#endif
#ifndef CLCD_USE_SOFT_SPI
::SPI.endTransaction();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ namespace FTDI {

#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR("Touch end: ", tag);
SERIAL_ECHOLNPAIR("Touch end: ", pressed_tag);
#endif

const uint8_t saved_pressed_tag = pressed_tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ namespace Language_en {
PROGMEM Language_Str MSG_PRINT_FINISHED = u8"Print finished";
PROGMEM Language_Str MSG_PRINT_ERROR = u8"Print error";
PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_1 = u8"Color Touch Panel";
PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2 = u8"Portions " COPYRIGHT_SIGN " 2019 Aleph Objects, Inc.\n"
"Portions " COPYRIGHT_SIGN " 2019 Cocoa Press";
PROGMEM Language_Str MSG_FIRMWARE_FOR_TOOLHEAD = u8"Firmware for toolhead:\n%s\n\n";
PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2 = WEBSITE_URL;
PROGMEM Language_Str MSG_LICENSE = u8"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 the Free Software Foundation, either version 3 "
"of the License, or (at your option) any later version.\n\nTo view a copy of the GNU General "
"Public License, go to the following location: http://www.gnu.org/licenses.";
PROGMEM Language_Str MSG_RUNOUT_1 = u8"Runout 1";
PROGMEM Language_Str MSG_RUNOUT_2 = u8"Runout 2";
PROGMEM Language_Str MSG_DISPLAY_MENU = u8"Display";
PROGMEM Language_Str MSG_INTERFACE_SETTINGS = u8"Interface Settings";
PROGMEM Language_Str MSG_INTERFACE = u8"Interface";
PROGMEM Language_Str MSG_MEASURE_AUTOMATICALLY = u8"Measure automatically";
PROGMEM Language_Str MSG_H_OFFSET = u8"H Offset";
PROGMEM Language_Str MSG_V_OFFSET = u8"V Offset";
Expand Down Expand Up @@ -129,7 +131,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_SOUND_VOLUME = u8"Sound volume";
PROGMEM Language_Str MSG_SCREEN_LOCK = u8"Screen lock";
PROGMEM Language_Str MSG_BOOT_SCREEN = u8"Boot screen";
PROGMEM Language_Str MSG_INTERFACE_SOUNDS = u8"Interface Sounds";
PROGMEM Language_Str MSG_SOUNDS = u8"Sounds";
PROGMEM Language_Str MSG_CLICK_SOUNDS = u8"Click sounds";
PROGMEM Language_Str MSG_EEPROM_RESTORED = u8"Settings restored from backup";
PROGMEM Language_Str MSG_EEPROM_RESET = u8"Settings restored to default";
Expand All @@ -144,12 +146,12 @@ namespace Language_en {

PROGMEM Language_Str MSG_TOUCH_CALIBRATION_START = u8"Release to begin screen calibration";
PROGMEM Language_Str MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate";
PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS = u8"Level X Axis";

#ifdef TOUCH_UI_LULZBOT_BIO
PROGMEM Language_Str MSG_MOVE_TO_HOME = u8"Move to Home";
PROGMEM Language_Str MSG_RAISE_PLUNGER = u8"Raise Plunger";
PROGMEM Language_Str MSG_RELEASE_XY_AXIS = u8"Release X and Y Axis";
PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS = u8"Auto-level X Axis";
PROGMEM Language_Str MSG_BED_TEMPERATURE = u8"Bed Temperature";
PROGMEM Language_Str MSG_HOME_XYZ_WARNING = u8"About to move to home position. Ensure the top and the bed of the printer are clear.\n\nContinue?";
PROGMEM Language_Str MSG_HOME_E_WARNING = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?";
Expand Down
8 changes: 7 additions & 1 deletion Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,14 @@ namespace ExtUI {
}
#endif

#if ENABLED(POWER_LOSS_RECOVERY)
void onPowerLossResume() {
// Called on resume from power-loss
}
#endif

#if HAS_PID_HEATING
void OnPidTuning(const result_t rst) {
void onPidTuning(const result_t rst) {
// Called for temperature PID tuning result
SERIAL_ECHOLNPAIR("OnPidTuning:", rst);
switch (rst) {
Expand Down
15 changes: 10 additions & 5 deletions Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@
* 9 GND GND GND --> GND
* 10 5V 5V 5V --> KILL [3]
*
* [1] This configuration is not compatible with the
* EinsyRetro 1.1a because there is a level shifter
* on MISO enabled by SD/USB chip select.
* [1] This configuration allows daisy-chaining of the
* display and SD/USB on EXP2, except for [2]
*
* [2] This configuration allows daisy-chaining of the
* display and SD/USB on EXP2.
* [2] The Ultimachine Einsy boards have a level shifter
* on MISO enabled by SD_CSEL chip select, hence it
* is not possible to run both the display and the
* SD/USB on EXP2.
*
* [3] Archim Rambo provides 5V on this pin. On any other
* board, divert this wire from the ribbon cable and
Expand All @@ -148,4 +149,8 @@

#define CLCD_SPI_CS BTN_EN1
#define CLCD_MOD_RESET BTN_EN2

#if MB(EINSY_RAMBO, EINSY_RETRO) && DISABLED(SDSUPPORT)
#define CLCD_SPI_EXTRA_CS SDSS
#endif
#endif
78 changes: 45 additions & 33 deletions Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "screens.h"

#define GRID_COLS 4
#define GRID_ROWS 9
#define GRID_ROWS 7

using namespace FTDI;
using namespace Theme;
Expand All @@ -45,50 +45,62 @@ void AboutScreen::onRedraw(draw_mode_t) {
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);

draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(4,1),
#ifdef CUSTOM_MACHINE_NAME
F(CUSTOM_MACHINE_NAME)
#else
GET_TEXT_F(MSG_ABOUT_TOUCH_PANEL_1)
#endif
, OPT_CENTER, font_xlarge
);
#define HEADING_POS BTN_POS(1,2), BTN_SIZE(4,1)
#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,2)
#define STATS_POS BTN_POS(1,7), BTN_SIZE(2,1)
#define BACK_POS BTN_POS(3,7), BTN_SIZE(2,1)

#ifdef TOOLHEAD_NAME
char about_str[
strlen_P(GET_TEXT(FIRMWARE_FOR_TOOLHEAD)) +
strlen_P(TOOLHEAD_NAME) +
strlen_P(GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)) + 1
];
#define _INSET_POS(x,y,w,h) x + w/10, y, w - w/5, h
#define INSET_POS(pos) _INSET_POS(pos)

sprintf_P(about_str, GET_TEXT(MSG_FIRMWARE_FOR_TOOLHEAD), TOOLHEAD_NAME);
strcat_P (about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2));
char about_str[
strlen_P(GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)) +
strlen_P(TOOLHEAD_NAME) + 1
];
#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));
#endif

cmd.tag(2);
draw_text_box(cmd, BTN_POS(1,3), BTN_SIZE(4,3),
#ifdef TOOLHEAD_NAME
about_str
draw_text_box(cmd, HEADING_POS,
#ifdef CUSTOM_MACHINE_NAME
F(CUSTOM_MACHINE_NAME)
#else
GET_TEXT_F(MSG_ABOUT_TOUCH_PANEL_2)
GET_TEXT_F(MSG_ABOUT_TOUCH_PANEL_1)
#endif
, OPT_CENTER, font_medium
, OPT_CENTER, font_xlarge
);

cmd.tag(0);
draw_text_box(cmd, BTN_POS(1,6), BTN_SIZE(4,2), progmem_str(getFirmwareName_str()), OPT_CENTER, font_medium);

cmd.font(font_medium).colors(action_btn).tag(1).button(BTN_POS(2,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_OKAY));
draw_text_box(cmd, FW_VERS_POS, progmem_str(getFirmwareName_str()), OPT_CENTER, font_medium);
draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium);
draw_text_box(cmd, INSET_POS(LICENSE_POS), GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny);

cmd.font(font_medium)
.colors(normal_btn)
.tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU))
.colors(action_btn)
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
}

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

#endif // TOUCH_UI_FTDI_EVE
Loading

0 comments on commit d83ad6f

Please sign in to comment.