⚡️ Fix, enhance FTDI Eve Touch UI (#22619)
This commit is contained in:
parent
d1db17c6f5
commit
c06a183f28
@ -23,6 +23,10 @@
|
||||
|
||||
#if ENABLED(FTDI_EXTENDED)
|
||||
|
||||
#define IS_LINE_SEPARATOR(c) c == '\n' || c == '\t'
|
||||
#define IS_WORD_SEPARATOR(c) c == ' '
|
||||
#define IS_SEPARATOR(c) IS_LINE_SEPARATOR(c) || IS_WORD_SEPARATOR(c)
|
||||
|
||||
namespace FTDI {
|
||||
/**
|
||||
* Given a str, end will be set to the position at which a line needs to
|
||||
@ -37,11 +41,11 @@ namespace FTDI {
|
||||
const char *next = p;
|
||||
const utf8_char_t c = get_utf8_char_and_inc(next);
|
||||
// Decide whether to break the string at this location
|
||||
if (c == '\n' || c == '\0' || c == ' ') {
|
||||
if (IS_SEPARATOR(c) || c == '\0' ) {
|
||||
end = p;
|
||||
result = lw;
|
||||
}
|
||||
if (c == '\n' || c == '\0') break;
|
||||
if (IS_LINE_SEPARATOR(c) || c == '\0') break;
|
||||
// Measure the next character
|
||||
const uint16_t cw = use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c];
|
||||
// Stop processing once string exceeds the display width
|
||||
@ -69,7 +73,7 @@ namespace FTDI {
|
||||
const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8);
|
||||
width = max(width, line_width);
|
||||
height += utf8_fm.get_height();
|
||||
if (*line_end == '\n' || *line_end == ' ') line_end++;
|
||||
if (IS_SEPARATOR(*line_end)) line_end++;
|
||||
if (*line_end == '\0') break;
|
||||
if (line_end == line_start) break;
|
||||
line_start = line_end;
|
||||
@ -124,7 +128,7 @@ namespace FTDI {
|
||||
}
|
||||
y += utf8_fm.get_height();
|
||||
|
||||
if (*line_end == '\n' || *line_end == ' ') line_end++;
|
||||
if (IS_SEPARATOR(*line_end)) line_end++;
|
||||
if (*line_end == '\0') break;
|
||||
if (line_end == line_start) break;
|
||||
line_start = line_end;
|
||||
|
@ -229,5 +229,31 @@ namespace Theme {
|
||||
0x00, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
constexpr PROGMEM bitmap_info_t Light_Bulb_Info = {
|
||||
.format = L1,
|
||||
.linestride = 4,
|
||||
.filter = BILINEAR,
|
||||
.wrapx = BORDER,
|
||||
.wrapy = BORDER,
|
||||
.RAMG_offset = 8685,
|
||||
.width = 31,
|
||||
.height = 32,
|
||||
};
|
||||
|
||||
const unsigned char Light_Bulb[128] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x40,
|
||||
0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00,
|
||||
0x00, 0x0F, 0xE0, 0x00, 0x00, 0x18, 0x30, 0x00, 0x00, 0x36, 0x18, 0x00,
|
||||
0x00, 0x2C, 0x08, 0x00, 0x00, 0x58, 0x04, 0x00, 0x00, 0x50, 0x04, 0x00,
|
||||
0x7C, 0x50, 0x04, 0x7C, 0x00, 0x40, 0x04, 0x00, 0x00, 0x40, 0x04, 0x00,
|
||||
0x00, 0x60, 0x0C, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00,
|
||||
0x00, 0x10, 0x10, 0x00, 0x00, 0x88, 0x22, 0x00, 0x01, 0x08, 0x21, 0x00,
|
||||
0x02, 0x08, 0x20, 0x80, 0x04, 0x0F, 0xE0, 0x40, 0x00, 0x07, 0xC0, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
constexpr PROGMEM uint32_t UTF8_FONT_OFFSET = 10000;
|
||||
constexpr PROGMEM uint32_t BACKGROUND_OFFSET = 40000;
|
||||
}; // namespace Theme
|
||||
|
Loading…
Reference in New Issue
Block a user