Skip to content

Commit 6b4c8ab

Browse files
marciotptoal
authored andcommitted
🎨 Fix and improve FTDI Eve Touch UI (MarlinFirmware#22223)
1 parent 7891652 commit 6b4c8ab

16 files changed

+543
-281
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*************
2+
* screens.h *
3+
*************/
4+
5+
/****************************************************************************
6+
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
7+
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
8+
* *
9+
* This program is free software: you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation, either version 3 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
* This program is distributed in the hope that it will be useful, *
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17+
* GNU General Public License for more details. *
18+
* *
19+
* To view a copy of the GNU General Public License, go to the following *
20+
* location: <https://www.gnu.org/licenses/>. *
21+
****************************************************************************/
22+
23+
/********************************* DL CACHE SLOTS ******************************/
24+
25+
// In order to reduce SPI traffic, we cache display lists (DL) in RAMG. This
26+
// is done using the CLCD::DLCache class, which takes a unique ID for each
27+
// cache location. These IDs are defined here:
28+
29+
enum {
30+
STATUS_SCREEN_CACHE,
31+
MENU_SCREEN_CACHE,
32+
TUNE_SCREEN_CACHE,
33+
ALERT_BOX_CACHE,
34+
SPINNER_CACHE,
35+
ADVANCED_SETTINGS_SCREEN_CACHE,
36+
TEMPERATURE_SCREEN_CACHE,
37+
STEPS_SCREEN_CACHE,
38+
MAX_FEEDRATE_SCREEN_CACHE,
39+
MAX_VELOCITY_SCREEN_CACHE,
40+
MAX_ACCELERATION_SCREEN_CACHE,
41+
DEFAULT_ACCELERATION_SCREEN_CACHE,
42+
FLOW_PERCENT_SCREEN_CACHE,
43+
ZOFFSET_SCREEN_CACHE,
44+
STEPPER_CURRENT_SCREEN_CACHE,
45+
STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE,
46+
PRINTING_SCREEN_CACHE,
47+
FILES_SCREEN_CACHE,
48+
INTERFACE_SETTINGS_SCREEN_CACHE,
49+
INTERFACE_SOUNDS_SCREEN_CACHE,
50+
LOCK_SCREEN_CACHE,
51+
DISPLAY_TIMINGS_SCREEN_CACHE
52+
};
53+
54+
// To save MCU RAM, the status message is "baked" in to the status screen
55+
// cache, so we reserve a large chunk of memory for the DL cache
56+
57+
#define STATUS_SCREEN_DL_SIZE 4096
58+
#define ALERT_BOX_DL_SIZE 3072
59+
#define SPINNER_DL_SIZE 3072
60+
#define FILE_SCREEN_DL_SIZE 4160
61+
#define PRINTING_SCREEN_DL_SIZE 2048
62+
63+
/************************* MENU SCREEN DECLARATIONS *************************/
64+
65+
#include "../generic/base_screen.h"
66+
#include "../generic/base_numeric_adjustment_screen.h"
67+
#include "../generic/dialog_box_base_class.h"
68+
#include "../generic/boot_screen.h"
69+
#include "../generic/about_screen.h"
70+
#include "../generic/kill_screen.h"
71+
#include "../generic/alert_dialog_box.h"
72+
#include "../generic/spinner_dialog_box.h"
73+
#include "../generic/restore_failsafe_dialog_box.h"
74+
#include "../generic/save_settings_dialog_box.h"
75+
#include "../generic/confirm_start_print_dialog_box.h"
76+
#include "../generic/confirm_abort_print_dialog_box.h"
77+
#include "../generic/confirm_user_request_alert_box.h"
78+
#include "../generic/touch_calibration_screen.h"
79+
#include "../generic/move_axis_screen.h"
80+
#include "../generic/steps_screen.h"
81+
#include "../generic/feedrate_percent_screen.h"
82+
#include "../generic/max_velocity_screen.h"
83+
#include "../generic/max_acceleration_screen.h"
84+
#include "../generic/default_acceleration_screen.h"
85+
#include "../generic/temperature_screen.h"
86+
#include "../generic/interface_sounds_screen.h"
87+
#include "../generic/interface_settings_screen.h"
88+
#include "../generic/lock_screen.h"
89+
#include "../generic/endstop_state_screen.h"
90+
#include "../generic/display_tuning_screen.h"
91+
#include "../generic/media_player_screen.h"
92+
#include "../generic/statistics_screen.h"
93+
#include "../generic/stepper_current_screen.h"
94+
#include "../generic/stepper_bump_sensitivity_screen.h"
95+
#include "../generic/leveling_menu.h"
96+
#include "../generic/z_offset_screen.h"
97+
#include "../generic/files_screen.h"
98+
99+
#include "bio_status_screen.h"
100+
#include "bio_main_menu.h"
101+
#include "bio_tune_menu.h"
102+
#include "bio_advanced_settings.h"
103+
#include "bio_printing_dialog_box.h"
104+
#include "bio_confirm_home_xyz.h"
105+
#include "bio_confirm_home_e.h"

Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_screen.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,6 @@ void PreheatTimerScreen::draw_interaction_buttons(draw_mode_t what) {
8484
void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_str label, float value, int16_t x, int16_t y, int16_t w, int16_t h) {
8585
#define SUB_COLS 9
8686
#define SUB_ROWS 2
87-
#define SUB_GRID_W(W) ((W)*w/SUB_COLS)
88-
#define SUB_GRID_H(H) ((H)*h/SUB_ROWS)
89-
#define SUB_GRID_X(X) (SUB_GRID_W((X)-1) + x)
90-
#define SUB_GRID_Y(Y) (SUB_GRID_H((Y)-1) + y)
91-
#define SUB_X(X) (SUB_GRID_X(X) + MARGIN_L)
92-
#define SUB_Y(Y) (SUB_GRID_Y(Y) + MARGIN_T)
93-
#define SUB_W(W) (SUB_GRID_W(W) - MARGIN_L - MARGIN_R)
94-
#define SUB_H(H) (SUB_GRID_H(H) - MARGIN_T - MARGIN_B)
95-
#define SUB_POS(X,Y) SUB_X(X), SUB_Y(Y)
96-
#define SUB_SIZE(W,H) SUB_W(W), SUB_H(H)
9787

9888
CommandProcessor cmd;
9989
cmd.tag(0)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/*************
2+
* screens.h *
3+
*************/
4+
5+
/****************************************************************************
6+
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
7+
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
8+
* *
9+
* This program is free software: you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation, either version 3 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
* This program is distributed in the hope that it will be useful, *
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17+
* GNU General Public License for more details. *
18+
* *
19+
* To view a copy of the GNU General Public License, go to the following *
20+
* location: <https://www.gnu.org/licenses/>. *
21+
****************************************************************************/
22+
23+
#pragma once
24+
25+
26+
/********************************* DL CACHE SLOTS ******************************/
27+
28+
// In order to reduce SPI traffic, we cache display lists (DL) in RAMG. This
29+
// is done using the CLCD::DLCache class, which takes a unique ID for each
30+
// cache location. These IDs are defined here:
31+
32+
enum {
33+
STATUS_SCREEN_CACHE,
34+
MENU_SCREEN_CACHE,
35+
TUNE_SCREEN_CACHE,
36+
ALERT_BOX_CACHE,
37+
SPINNER_CACHE,
38+
ADVANCED_SETTINGS_SCREEN_CACHE,
39+
MOVE_AXIS_SCREEN_CACHE,
40+
TEMPERATURE_SCREEN_CACHE,
41+
STEPS_SCREEN_CACHE,
42+
MAX_FEEDRATE_SCREEN_CACHE,
43+
MAX_VELOCITY_SCREEN_CACHE,
44+
MAX_ACCELERATION_SCREEN_CACHE,
45+
DEFAULT_ACCELERATION_SCREEN_CACHE,
46+
FLOW_PERCENT_SCREEN_CACHE,
47+
LEVELING_SCREEN_CACHE,
48+
ZOFFSET_SCREEN_CACHE,
49+
BED_MESH_VIEW_SCREEN_CACHE,
50+
BED_MESH_EDIT_SCREEN_CACHE,
51+
STEPPER_CURRENT_SCREEN_CACHE,
52+
#if HAS_JUNCTION_DEVIATION
53+
JUNC_DEV_SCREEN_CACHE,
54+
#else
55+
JERK_SCREEN_CACHE,
56+
#endif
57+
CASE_LIGHT_SCREEN_CACHE,
58+
FILAMENT_MENU_CACHE,
59+
LINEAR_ADVANCE_SCREEN_CACHE,
60+
PREHEAT_MENU_CACHE,
61+
PREHEAT_TIMER_SCREEN_CACHE,
62+
LOAD_CHOCOLATE_SCREEN_CACHE,
63+
MOVE_XYZ_SCREEN_CACHE,
64+
MOVE_E_SCREEN_CACHE,
65+
FILES_SCREEN_CACHE,
66+
INTERFACE_SETTINGS_SCREEN_CACHE,
67+
INTERFACE_SOUNDS_SCREEN_CACHE,
68+
LOCK_SCREEN_CACHE,
69+
DISPLAY_TIMINGS_SCREEN_CACHE
70+
};
71+
72+
// To save MCU RAM, the status message is "baked" in to the status screen
73+
// cache, so we reserve a large chunk of memory for the DL cache
74+
75+
#define STATUS_SCREEN_DL_SIZE 4096
76+
#define ALERT_BOX_DL_SIZE 3072
77+
#define SPINNER_DL_SIZE 3072
78+
#define FILE_SCREEN_DL_SIZE 4160
79+
#define PRINTING_SCREEN_DL_SIZE 2048
80+
81+
/************************* MENU SCREEN DECLARATIONS *************************/
82+
83+
#include "../generic/base_screen.h"
84+
#include "../generic/base_numeric_adjustment_screen.h"
85+
#include "../generic/dialog_box_base_class.h"
86+
#include "../generic/boot_screen.h"
87+
#include "../generic/about_screen.h"
88+
#include "../generic/kill_screen.h"
89+
#include "../generic/alert_dialog_box.h"
90+
#include "../generic/spinner_dialog_box.h"
91+
#include "../generic/restore_failsafe_dialog_box.h"
92+
#include "../generic/save_settings_dialog_box.h"
93+
#include "../generic/confirm_start_print_dialog_box.h"
94+
#include "../generic/confirm_abort_print_dialog_box.h"
95+
#include "../generic/confirm_user_request_alert_box.h"
96+
#include "../generic/touch_calibration_screen.h"
97+
#include "../generic/move_axis_screen.h"
98+
#include "../generic/steps_screen.h"
99+
#include "../generic/feedrate_percent_screen.h"
100+
#include "../generic/max_velocity_screen.h"
101+
#include "../generic/max_acceleration_screen.h"
102+
#include "../generic/default_acceleration_screen.h"
103+
#include "../generic/temperature_screen.h"
104+
#include "../generic/interface_sounds_screen.h"
105+
#include "../generic/interface_settings_screen.h"
106+
#include "../generic/lock_screen.h"
107+
#include "../generic/endstop_state_screen.h"
108+
#include "../generic/display_tuning_screen.h"
109+
#include "../generic/statistics_screen.h"
110+
#include "../generic/stepper_current_screen.h"
111+
#include "../generic/leveling_menu.h"
112+
#include "../generic/z_offset_screen.h"
113+
#include "../generic/bed_mesh_base.h"
114+
#include "../generic/bed_mesh_view_screen.h"
115+
#include "../generic/bed_mesh_edit_screen.h"
116+
#include "../generic/case_light_screen.h"
117+
#include "../generic/linear_advance_screen.h"
118+
#include "../generic/files_screen.h"
119+
#include "../generic/move_axis_screen.h"
120+
#include "../generic/flow_percent_screen.h"
121+
#include "../generic/tune_menu.h"
122+
#if HAS_JUNCTION_DEVIATION
123+
#include "../generic/junction_deviation_screen.h"
124+
#else
125+
#include "../generic/jerk_screen.h"
126+
#endif
127+
128+
#include "status_screen.h"
129+
#include "main_menu.h"
130+
#include "advanced_settings_menu.h"
131+
#include "preheat_menu.h"
132+
#include "preheat_screen.h"
133+
#include "load_chocolate.h"
134+
#include "move_xyz_screen.h"
135+
#include "move_e_screen.h"

Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp

+13-14
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,23 @@ namespace ExtUI {
4545
}
4646

4747
void onMediaInserted() {
48-
if (AT_SCREEN(StatusScreen))
49-
StatusScreen::setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED));
50-
sound.play(media_inserted, PLAY_ASYNCHRONOUS);
48+
#if ENABLED(SDSUPPORT)
49+
sound.play(media_inserted, PLAY_ASYNCHRONOUS);
50+
StatusScreen::onMediaInserted();
51+
#endif
5152
}
5253

5354
void onMediaRemoved() {
54-
if (isPrintingFromMedia()) {
55-
stopPrint();
56-
InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED);
57-
}
58-
else
59-
sound.play(media_removed, PLAY_ASYNCHRONOUS);
60-
61-
if (AT_SCREEN(StatusScreen) || isPrintingFromMedia())
62-
StatusScreen::setStatusMessage(GET_TEXT_F(MSG_MEDIA_REMOVED));
63-
6455
#if ENABLED(SDSUPPORT)
65-
if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen);
56+
if (isPrintingFromMedia()) {
57+
stopPrint();
58+
InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED);
59+
}
60+
else
61+
sound.play(media_removed, PLAY_ASYNCHRONOUS);
62+
63+
StatusScreen::onMediaRemoved();
64+
FilesScreen::onMediaRemoved();
6665
#endif
6766
}
6867

Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,22 @@ void AboutScreen::onRedraw(draw_mode_t) {
9191
draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium);
9292
draw_text_box(cmd, INSET_POS(LICENSE_POS), GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny);
9393

94-
cmd.font(font_medium)
95-
.colors(normal_btn)
96-
.tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU))
97-
.colors(action_btn)
94+
cmd.font(font_medium);
95+
#if ENABLED(PRINTCOUNTER) && defined(FTDI_STATISTICS_SCREEN)
96+
cmd.colors(normal_btn)
97+
.tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU));
98+
#endif
99+
cmd.colors(action_btn)
98100
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
99101
}
100102

101103
bool AboutScreen::onTouchEnd(uint8_t tag) {
102104
switch (tag) {
103105
case 1: GOTO_PREVIOUS(); break;
104-
#if ENABLED(PRINTCOUNTER)
106+
#if ENABLED(PRINTCOUNTER) && defined(FTDI_STATISTICS_SCREEN)
105107
case 2: GOTO_SCREEN(StatisticsScreen); break;
106108
#endif
107-
#if ENABLED(TOUCH_UI_DEVELOPER_MENU)
109+
#if ENABLED(TOUCH_UI_DEVELOPER_MENU) && defined(FTDI_DEVELOPER_MENU)
108110
case 3: GOTO_SCREEN(DeveloperMenu); break;
109111
#endif
110112
default: return false;

Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ constexpr static ChangeFilamentScreenData &mydata = screen_data.ChangeFilamentSc
7676

7777
/****************** COLOR SCALE ***********************/
7878

79-
uint32_t getWarmColor(uint16_t temp, uint16_t cool, uint16_t low, uint16_t med, uint16_t high) {
79+
uint32_t ChangeFilamentScreen::getWarmColor(uint16_t temp, uint16_t cool, uint16_t low, uint16_t med, uint16_t high) {
8080
rgb_t R0, R1, mix;
8181

8282
float t;

Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class ChangeFilamentScreen : public BaseScreen, public CachedScreen<CHANGE_FILAM
3838
static uint8_t getSoftenTemp();
3939
static ExtUI::extruder_t getExtruder();
4040
static void drawTempGradient(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
41-
static uint32_t getTempColor(uint32_t temp);
4241
static void doPurge();
4342
public:
43+
static uint32_t getWarmColor(uint16_t temp, uint16_t cool, uint16_t low, uint16_t med, uint16_t high);
4444
static void onEntry();
4545
static void onExit();
4646
static void onRedraw(draw_mode_t);

Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,8 @@ void FilesScreen::onIdle() {
262262
#endif
263263
}
264264

265+
void FilesScreen::onMediaRemoved() {
266+
if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen);
267+
}
268+
265269
#endif // FTDI_FILES_SCREEN

Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.h

+1
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@ class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, F
7272
static void onRedraw(draw_mode_t);
7373
static bool onTouchEnd(uint8_t tag);
7474
static void onIdle();
75+
static void onMediaRemoved();
7576
};

0 commit comments

Comments
 (0)