Skip to content

Commit 410b9b2

Browse files
marciotDarred
authored andcommitted
⚡️ Fix, enhance FTDI Eve Touch UI (MarlinFirmware#22619)
1 parent 82b8e2d commit 410b9b2

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
#if ENABLED(FTDI_EXTENDED)
2525

26+
#define IS_LINE_SEPARATOR(c) c == '\n' || c == '\t'
27+
#define IS_WORD_SEPARATOR(c) c == ' '
28+
#define IS_SEPARATOR(c) IS_LINE_SEPARATOR(c) || IS_WORD_SEPARATOR(c)
29+
2630
namespace FTDI {
2731
/**
2832
* Given a str, end will be set to the position at which a line needs to
@@ -37,11 +41,11 @@ namespace FTDI {
3741
const char *next = p;
3842
const utf8_char_t c = get_utf8_char_and_inc(next);
3943
// Decide whether to break the string at this location
40-
if (c == '\n' || c == '\0' || c == ' ') {
44+
if (IS_SEPARATOR(c) || c == '\0' ) {
4145
end = p;
4246
result = lw;
4347
}
44-
if (c == '\n' || c == '\0') break;
48+
if (IS_LINE_SEPARATOR(c) || c == '\0') break;
4549
// Measure the next character
4650
const uint16_t cw = use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c];
4751
// Stop processing once string exceeds the display width
@@ -69,7 +73,7 @@ namespace FTDI {
6973
const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8);
7074
width = max(width, line_width);
7175
height += utf8_fm.get_height();
72-
if (*line_end == '\n' || *line_end == ' ') line_end++;
76+
if (IS_SEPARATOR(*line_end)) line_end++;
7377
if (*line_end == '\0') break;
7478
if (line_end == line_start) break;
7579
line_start = line_end;
@@ -124,7 +128,7 @@ namespace FTDI {
124128
}
125129
y += utf8_fm.get_height();
126130

127-
if (*line_end == '\n' || *line_end == ' ') line_end++;
131+
if (IS_SEPARATOR(*line_end)) line_end++;
128132
if (*line_end == '\0') break;
129133
if (line_end == line_start) break;
130134
line_start = line_end;

Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/bitmaps.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,5 +229,31 @@ namespace Theme {
229229
0x00, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00
230230
};
231231

232+
constexpr PROGMEM bitmap_info_t Light_Bulb_Info = {
233+
.format = L1,
234+
.linestride = 4,
235+
.filter = BILINEAR,
236+
.wrapx = BORDER,
237+
.wrapy = BORDER,
238+
.RAMG_offset = 8685,
239+
.width = 31,
240+
.height = 32,
241+
};
242+
243+
const unsigned char Light_Bulb[128] PROGMEM = {
244+
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
245+
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x40,
246+
0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00,
247+
0x00, 0x0F, 0xE0, 0x00, 0x00, 0x18, 0x30, 0x00, 0x00, 0x36, 0x18, 0x00,
248+
0x00, 0x2C, 0x08, 0x00, 0x00, 0x58, 0x04, 0x00, 0x00, 0x50, 0x04, 0x00,
249+
0x7C, 0x50, 0x04, 0x7C, 0x00, 0x40, 0x04, 0x00, 0x00, 0x40, 0x04, 0x00,
250+
0x00, 0x60, 0x0C, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00,
251+
0x00, 0x10, 0x10, 0x00, 0x00, 0x88, 0x22, 0x00, 0x01, 0x08, 0x21, 0x00,
252+
0x02, 0x08, 0x20, 0x80, 0x04, 0x0F, 0xE0, 0x40, 0x00, 0x07, 0xC0, 0x00,
253+
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
254+
0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
255+
};
256+
232257
constexpr PROGMEM uint32_t UTF8_FONT_OFFSET = 10000;
258+
constexpr PROGMEM uint32_t BACKGROUND_OFFSET = 40000;
233259
}; // namespace Theme

0 commit comments

Comments
 (0)