mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-08-07 22:13:56 -06:00
🚸 More TFT Color UI fixes (#27388)
This commit is contained in:
parent
0876bcd027
commit
80bd10025b
21 changed files with 2911 additions and 4209 deletions
|
@ -3513,6 +3513,8 @@
|
|||
#define LCD_WIDTH 21
|
||||
#elif IS_DWIN_MARLINUI
|
||||
// Defined by header
|
||||
#elif HAS_GRAPHICAL_TFT
|
||||
#define LCD_WIDTH ((TFT_WIDTH) / 16)
|
||||
#else
|
||||
#define LCD_WIDTH TERN(IS_ULTIPANEL, 20, 16)
|
||||
#endif
|
||||
|
|
|
@ -375,9 +375,9 @@ void MarlinUI::init() {
|
|||
}
|
||||
}
|
||||
#else
|
||||
theCard.longFilename[
|
||||
TERN(UTF_FILENAME_SUPPORT, utf8_byte_pos_by_char_num(theCard.longFilename, maxlen), maxlen)
|
||||
] = '\0'; // cutoff at screen edge
|
||||
// Simply cut off at maxlen
|
||||
const uint8_t chop = TERN(UTF_FILENAME_SUPPORT, utf8_byte_pos_by_char_num(theCard.longFilename, maxlen), maxlen);
|
||||
theCard.longFilename[_MAX(chop, LONG_FILENAME_LENGTH - 1)] = '\0';
|
||||
#endif
|
||||
}
|
||||
return outstr;
|
||||
|
|
File diff suppressed because one or more lines are too long
1049
Marlin/src/lcd/tft/images/bootscreen_576x478x16.cpp
Normal file
1049
Marlin/src/lcd/tft/images/bootscreen_576x478x16.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -77,10 +77,10 @@ class TFT {
|
|||
static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.fill(x, y, width, height, color); }
|
||||
static void canvas(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { queue.canvas(x, y, width, height); }
|
||||
static void set_background(uint16_t color) { queue.set_background(color); }
|
||||
static void add_text(uint16_t x, uint16_t y, uint16_t color, TFT_String tft_string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, tft_string.string(), maxWidth); }
|
||||
static void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, string, maxWidth); }
|
||||
static void add_text(uint16_t x, uint16_t y, uint16_t color, TFT_String tft_string, uint16_t maxWidth=0) { queue.add_text(x, y, color, tft_string.string(), maxWidth); }
|
||||
static void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth=0) { queue.add_text(x, y, color, string, maxWidth); }
|
||||
static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) { queue.add_image(x, y, image, colors); }
|
||||
static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); }
|
||||
static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); }
|
||||
static void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
|
||||
static void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
|
||||
static void draw_edit_screen_buttons();
|
||||
|
|
|
@ -108,6 +108,7 @@ extern const tImage NoLogo;
|
|||
extern const tImage MarlinLogo240x250x16;
|
||||
extern const tImage MarlinLogo320x240x16;
|
||||
extern const tImage MarlinLogo480x320x16;
|
||||
extern const tImage MarlinLogo576x478x16;
|
||||
extern const tImage MarlinLogo1024x600x16;
|
||||
#endif
|
||||
extern const tImage Background320x30x16;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#define COLOR_MENU_TEXT COLOR_WHITE
|
||||
#define COLOR_MENU_STATIC_TEXT COLOR_WHITE
|
||||
#define COLOR_MENU_BACK_TEXT COLOR_YELLOW
|
||||
#define COLOR_MENU_EDIT_TEXT COLOR_LIME2
|
||||
#define COLOR_MENU_VALUE_FONT COLOR_ORANGE2
|
||||
#define COLOR_SLIDER COLOR_ORANGE2
|
||||
#define COLOR_INCREASE COLOR_WHITE
|
||||
|
|
|
@ -112,6 +112,9 @@
|
|||
#ifndef COLOR_MENU_BACK_TEXT
|
||||
#define COLOR_MENU_BACK_TEXT COLOR_CYAN
|
||||
#endif
|
||||
#ifndef COLOR_MENU_EDIT_TEXT
|
||||
#define COLOR_MENU_EDIT_TEXT COLOR_LIGHT_BLUE
|
||||
#endif
|
||||
#ifndef COLOR_MENU_VALUE
|
||||
#define COLOR_MENU_VALUE COLOR_WHITE
|
||||
#endif
|
||||
|
|
|
@ -110,6 +110,9 @@
|
|||
#ifndef COLOR_MENU_BACK_TEXT
|
||||
#define COLOR_MENU_BACK_TEXT COLOR_WHITE
|
||||
#endif
|
||||
#ifndef COLOR_MENU_EDIT_TEXT
|
||||
#define COLOR_MENU_EDIT_TEXT COLOR_VIVID_GREEN
|
||||
#endif
|
||||
#ifndef COLOR_MENU_VALUE
|
||||
#define COLOR_MENU_VALUE COLOR_WHITE
|
||||
#endif
|
||||
|
|
|
@ -58,27 +58,29 @@
|
|||
// MarlinUI::show_bootscreen()
|
||||
#ifndef BOOTSCREEN_LOGO
|
||||
#if ENABLED(BOOT_MARLIN_LOGO_SMALL)
|
||||
#define BOOTSCREEN_LOGO MarlinLogo195x59x16
|
||||
#define BOOTSCREEN_LOGO_W 195
|
||||
#define BOOTSCREEN_LOGO_H 59
|
||||
#define BOOTSCREEN_SITE_URL_Y (TFT_HEIGHT - 70)
|
||||
#define BOOTSCREEN_LOGO MarlinLogo195x59x16
|
||||
#define BOOTSCREEN_LOGO_W 195
|
||||
#define BOOTSCREEN_LOGO_H 59
|
||||
#define BOOTSCREEN_SITE_URL_Y (TFT_HEIGHT - 70)
|
||||
#elif ENABLED(BOOT_MARLIN_LOGO_HUGE)
|
||||
#define BOOTSCREEN_LOGO MarlinLogo1024x600x16
|
||||
#define BOOTSCREEN_LOGO_W TFT_WIDTH
|
||||
#define BOOTSCREEN_LOGO_H TFT_HEIGHT
|
||||
#define BOOTSCREEN_SITE_URL_Y (TFT_HEIGHT - 40)
|
||||
#elif ENABLED(BOOT_MARLIN_LOGO_ROUND)
|
||||
#define BOOTSCREEN_LOGO MarlinLogo576x478x16
|
||||
#define BOOTSCREEN_LOGO_W 576
|
||||
#define BOOTSCREEN_LOGO_H 478
|
||||
#define BOOTSCREEN_LOGO_Y ((TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2 - 10)
|
||||
#define BOOTSCREEN_SITE_URL_Y (TFT_HEIGHT - 50)
|
||||
#else
|
||||
#if ENABLED(BOOT_MARLIN_LOGO_HUGE)
|
||||
#define BOOTSCREEN_LOGO MarlinLogo1024x600x16
|
||||
#define BOOTSCREEN_LOGO_W TFT_WIDTH
|
||||
#define BOOTSCREEN_LOGO_H TFT_HEIGHT
|
||||
#else
|
||||
#define BOOTSCREEN_LOGO MarlinLogo480x320x16
|
||||
#define BOOTSCREEN_LOGO_W 480
|
||||
#define BOOTSCREEN_LOGO_H 320
|
||||
#endif
|
||||
#define BOOTSCREEN_SITE_URL_Y (TFT_HEIGHT - 90)
|
||||
#define BOOTSCREEN_LOGO MarlinLogo480x320x16
|
||||
#define BOOTSCREEN_LOGO_W 480
|
||||
#define BOOTSCREEN_LOGO_H 320
|
||||
#endif
|
||||
#ifndef BOOTSCREEN_SITE_URL_Y
|
||||
#define BOOTSCREEN_SITE_URL_Y (TFT_HEIGHT - 90)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOTSCREEN_LOGO_X) && !defined(BOOTSCREEN_LOGO_Y)
|
||||
#define BOOTSCREEN_LOGO_X (TFT_WIDTH - BOOTSCREEN_LOGO_W) / 2
|
||||
#define BOOTSCREEN_LOGO_Y (TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2
|
||||
#endif
|
||||
|
||||
#if !defined(NAVIGATION_PAGE_UP_X) && !defined(NAVIGATION_PAGE_UP_Y) && !defined(NAVIGATION_PAGE_DOWN_X) && !defined(NAVIGATION_PAGE_DOWN_Y) && !defined(NAVIGATION_BACK_X) && !defined(NAVIGATION_BACK_Y)
|
||||
|
|
|
@ -62,11 +62,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOTSCREEN_LOGO_X) && !defined(BOOTSCREEN_LOGO_Y)
|
||||
#define BOOTSCREEN_LOGO_X (TFT_WIDTH - BOOTSCREEN_LOGO_W) / 2
|
||||
#define BOOTSCREEN_LOGO_Y (TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2
|
||||
#endif
|
||||
|
||||
#if !defined(NAVIGATION_PAGE_UP_X) && !defined(NAVIGATION_PAGE_UP_Y) && !defined(NAVIGATION_PAGE_DOWN_X) && !defined(NAVIGATION_PAGE_DOWN_Y) && !defined(NAVIGATION_BACK_X) && !defined(NAVIGATION_BACK_Y)
|
||||
#define NAVIGATION_PAGE_UP_X 24
|
||||
#define NAVIGATION_PAGE_UP_Y TFT_HEIGHT - 34
|
||||
|
|
|
@ -62,11 +62,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOTSCREEN_LOGO_X) && !defined(BOOTSCREEN_LOGO_Y)
|
||||
#define BOOTSCREEN_LOGO_X (TFT_WIDTH - BOOTSCREEN_LOGO_W) / 2
|
||||
#define BOOTSCREEN_LOGO_Y (TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2
|
||||
#endif
|
||||
|
||||
#if !defined(NAVIGATION_PAGE_UP_X) && !defined(NAVIGATION_PAGE_UP_Y) && !defined(NAVIGATION_PAGE_DOWN_X) && !defined(NAVIGATION_PAGE_DOWN_Y) && !defined(NAVIGATION_BACK_X) && !defined(NAVIGATION_BACK_Y)
|
||||
#define NAVIGATION_PAGE_UP_X 48
|
||||
#define NAVIGATION_PAGE_UP_Y TFT_HEIGHT - 34
|
||||
|
|
|
@ -62,11 +62,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOTSCREEN_LOGO_X) && !defined(BOOTSCREEN_LOGO_Y)
|
||||
#define BOOTSCREEN_LOGO_X (TFT_WIDTH - BOOTSCREEN_LOGO_W) / 2
|
||||
#define BOOTSCREEN_LOGO_Y (TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2
|
||||
#endif
|
||||
|
||||
#if !defined(NAVIGATION_PAGE_UP_X) && !defined(NAVIGATION_PAGE_UP_Y) && !defined(NAVIGATION_PAGE_DOWN_X) && !defined(NAVIGATION_PAGE_DOWN_Y) && !defined(NAVIGATION_BACK_X) && !defined(NAVIGATION_BACK_Y)
|
||||
#define NAVIGATION_PAGE_UP_X 48
|
||||
#define NAVIGATION_PAGE_UP_Y TFT_HEIGHT - 38
|
||||
|
|
|
@ -65,11 +65,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOTSCREEN_LOGO_X) && !defined(BOOTSCREEN_LOGO_Y)
|
||||
#define BOOTSCREEN_LOGO_X (TFT_WIDTH - BOOTSCREEN_LOGO_W) / 2
|
||||
#define BOOTSCREEN_LOGO_Y (TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2
|
||||
#endif
|
||||
|
||||
#if !defined(NAVIGATION_PAGE_UP_X) && !defined(NAVIGATION_PAGE_UP_Y) && !defined(NAVIGATION_PAGE_DOWN_X) && !defined(NAVIGATION_PAGE_DOWN_Y) && !defined(NAVIGATION_BACK_X) && !defined(NAVIGATION_BACK_Y)
|
||||
#define NAVIGATION_PAGE_UP_X 104
|
||||
#define NAVIGATION_PAGE_UP_Y TFT_HEIGHT - 34
|
||||
|
|
|
@ -62,11 +62,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOTSCREEN_LOGO_X) && !defined(BOOTSCREEN_LOGO_Y)
|
||||
#define BOOTSCREEN_LOGO_X (TFT_WIDTH - BOOTSCREEN_LOGO_W) / 2
|
||||
#define BOOTSCREEN_LOGO_Y (TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2
|
||||
#endif
|
||||
|
||||
#if !defined(NAVIGATION_PAGE_UP_X) && !defined(NAVIGATION_PAGE_UP_Y) && !defined(NAVIGATION_PAGE_DOWN_X) && !defined(NAVIGATION_PAGE_DOWN_Y) && !defined(NAVIGATION_BACK_X) && !defined(NAVIGATION_BACK_Y)
|
||||
#define NAVIGATION_PAGE_UP_X 104
|
||||
#define NAVIGATION_PAGE_UP_Y TFT_HEIGHT - 34
|
||||
|
|
|
@ -301,7 +301,7 @@ void MarlinUI::draw_status_screen() {
|
|||
tft.add_image(0, 0, imgFeedRate, color);
|
||||
tft_string.set(i16tostr3rj(feedrate_percentage));
|
||||
tft_string.add('%');
|
||||
tft.add_text(36, tft_string.vcenter(30), color , tft_string);
|
||||
tft.add_text(36, tft_string.vcenter(30), color, tft_string);
|
||||
TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, FEEDRATE_X, FEEDRATE_Y, FEEDRATE_W, FEEDRATE_H));
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
|
@ -312,7 +312,7 @@ void MarlinUI::draw_status_screen() {
|
|||
tft.add_image(FLOWRATE_ICON_X, FLOWRATE_ICON_X, imgFlowRate, color);
|
||||
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
||||
tft_string.add('%');
|
||||
tft.add_text(FLOWRATE_TEXT_X, FLOWRATE_TEXT_Y, color , tft_string);
|
||||
tft.add_text(FLOWRATE_TEXT_X, FLOWRATE_TEXT_Y, color, tft_string);
|
||||
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, FLOWRATE_X, FLOWRATE_Y, FLOWRATE_W, FLOWRATE_H, active_extruder));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -364,9 +364,6 @@ void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, c
|
|||
tft_string.set(string, itemIndex, itemStringC, itemStringF);
|
||||
tft.add_text(text_x + line_shift, MENU_TEXT_Y, color, tft_string);
|
||||
|
||||
#ifndef MENU_ITEM_SUBMENU_ICON_X
|
||||
#define MENU_ITEM_SUBMENU_ICON_X (TFT_WIDTH - 32)
|
||||
#endif
|
||||
if (post_char == LCD_STR_ARROW_RIGHT[0])
|
||||
tft.add_image(MENU_ITEM_SUBMENU_ICON_X, MENU_ITEM_ICON_Y, imgRight, color, lineColor);
|
||||
}
|
||||
|
@ -375,11 +372,12 @@ void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, c
|
|||
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
|
||||
(void)menu_item(row, sel);
|
||||
|
||||
constexpr uint8_t text_x = (TFT_WIDTH >= 480) ? MENU_ITEM_ICON_SPACE : MENU_TEXT_X;
|
||||
tft_string.set(ftpl, itemIndex, itemStringC, itemStringF);
|
||||
tft.add_text(MENU_TEXT_X, MENU_TEXT_Y, COLOR_MENU_TEXT, tft_string);
|
||||
tft.add_text(text_x, MENU_TEXT_Y, COLOR_MENU_EDIT_TEXT, tft_string);
|
||||
if (inStr) {
|
||||
tft_string.set(inStr);
|
||||
tft.add_text(TFT_WIDTH - MENU_TEXT_X - tft_string.width(), MENU_TEXT_Y, COLOR_MENU_VALUE, tft_string);
|
||||
tft.add_text(MENU_EDIT_ITEM_RIGHT_X - tft_string.width(), MENU_TEXT_Y, COLOR_MENU_VALUE, tft_string);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,8 +415,9 @@ void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t s
|
|||
const uint16_t lineColor = menu_item(row, sel);
|
||||
constexpr uint8_t line_shift = (TFT_WIDTH >= 480) ? MENU_ITEM_ICON_SPACE : 0;
|
||||
if (isDir) tft.add_image(MENU_ITEM_ICON_X + line_shift, MENU_ITEM_ICON_Y, imgDirectory, COLOR_MENU_TEXT, lineColor);
|
||||
uint8_t maxlen = (MENU_ITEM_HEIGHT) - (MENU_TEXT_Y) + 1;
|
||||
tft.add_text(MENU_ITEM_ICON_SPACE + line_shift, MENU_TEXT_Y, COLOR_MENU_TEXT, ui.scrolled_filename(theCard, maxlen, sel));
|
||||
const char * const filename = ui.scrolled_filename(theCard, LCD_WIDTH - 1, sel);
|
||||
//SERIAL_ECHOLNPGM("Drawing filename: ", filename);
|
||||
tft.add_text(MENU_ITEM_ICON_SPACE + line_shift, MENU_TEXT_Y, COLOR_MENU_TEXT, filename);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,11 +43,25 @@
|
|||
#define UI_INCL_(W, H) STRINGIFY_(ui_##W##x##H.h)
|
||||
#define UI_INCL(W, H) UI_INCL_(W, H)
|
||||
|
||||
#include "ui_theme.h"
|
||||
#include UI_INCL(TFT_WIDTH, TFT_HEIGHT)
|
||||
#include "ui_theme.h"
|
||||
#include "tft_font.h"
|
||||
#include "tft_color.h"
|
||||
|
||||
#ifndef BOOTSCREEN_LOGO_X
|
||||
#define BOOTSCREEN_LOGO_X (TFT_WIDTH - BOOTSCREEN_LOGO_W) / 2
|
||||
#endif
|
||||
#ifndef BOOTSCREEN_LOGO_Y
|
||||
#define BOOTSCREEN_LOGO_Y (TFT_HEIGHT - BOOTSCREEN_LOGO_H) / 2
|
||||
#endif
|
||||
|
||||
#ifndef MENU_EDIT_ITEM_RIGHT_X
|
||||
#define MENU_EDIT_ITEM_RIGHT_X ((TFT_WIDTH) - (MENU_TEXT_X))
|
||||
#endif
|
||||
#ifndef MENU_ITEM_SUBMENU_ICON_X
|
||||
#define MENU_ITEM_SUBMENU_ICON_X (TFT_WIDTH - 32)
|
||||
#endif
|
||||
|
||||
// Common Implementation
|
||||
#define Z_SELECTION_Z 1
|
||||
#define Z_SELECTION_Z_PROBE -1
|
||||
|
|
|
@ -31,5 +31,10 @@
|
|||
#define TFT_THEME_INCL(M) TFT_THEME_INCL_(M)
|
||||
|
||||
#include "tft_color.h"
|
||||
|
||||
#if ENABLED(BOOT_MARLIN_LOGO_HUGE)
|
||||
#define COLOR_WEBSITE_URL COLOR_YELLOW
|
||||
#endif
|
||||
|
||||
#include TFT_THEME_INCL(TFT_THEME)
|
||||
#include "themes/theme_default.h"
|
||||
|
|
BIN
buildroot/share/pixmaps/logo/tft-boot-1024x600.png
Normal file
BIN
buildroot/share/pixmaps/logo/tft-boot-1024x600.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 574 KiB |
|
@ -66,7 +66,7 @@ if len(sys.argv) <= 2:
|
|||
print("Utility to export a image in Marlin TFT friendly format.")
|
||||
print("It will dump a raw bin RGB565 image or create a CPP file with an array of 16 bit image pixels.")
|
||||
print("Usage: gen-tft-image.py INPUT_IMAGE.(png|bmp|jpg) OUTPUT_FILE.(cpp|bin) [--transparency]")
|
||||
print("Author: rhapsodyv")
|
||||
print("Authors: rhapsodyv, thinkyhead")
|
||||
exit(1)
|
||||
|
||||
transparency = len(sys.argv) > 3 and sys.argv[3] == "--transparency"
|
Loading…
Add table
Add a link
Reference in a new issue