Describe the bug
On Jade Plus (HOME_SCREEN_DEEP_STATUS_BAR, 320x170 display), the device name shown in the status bar (e.g. Jade ABCDEF) can lose its last character silently. My unit displays only 5 of the 6 hex characters of the device id.
Root cause analysis (from source)
deduce_jade_id() in main/process.c always generates "Jade " + 6 uppercase hex chars (11 chars total), derived from the eFuse MAC.
- In
make_status_bar() (main/gui.c), when HOME_SCREEN_DEEP_STATUS_BAR is set, the bar is split 65/35; the title lives in the bottom half of the right-hand 35% — roughly a 110px-wide, single-line-height box, rendered with GUI_TITLE_FONT (UBUNTU16_FONT).
render_text() renders non-scroll text via display_print_in_area(..., wrap=1). When the string is slightly wider than the box (which happens for ids made of wide glyphs, e.g. all A–F letters), the overflowing character(s) wrap to a second line.
- The title box is only one line tall, so the wrapped second line is clipped and never visible. The last character silently disappears.
Whether the id fits depends on the specific glyph widths, so some units show 6 chars and others 5 — which makes the truncation easy to mistake for the actual id.
Expected behavior
The full device id is visible in the status bar (or is at least truncated in a visible/predictable way).
Possible fixes (happy to turn one of these into a PR)
- Widen the name area in the deep status bar split (e.g. 65/35 → 60/40), if the large logo leaves room; or
- Fall back to a narrower font for the status bar title when the string exceeds the box; or
- In
render_text(), when the padded box is less than two font-heights tall, truncate the string to the characters that fit instead of wrapping onto an invisible second line, e.g.:
} else { // without noise
_fg = node->is_selected ? data->selected_color : data->color;
// If the box only fits a single line, don't wrap overflow onto a
// second (clipped, invisible) line - print only the chars that fit.
const int box_w = cs->x2 - cs->x1;
const int box_h = cs->y2 - cs->y1;
char* const text = data->text;
size_t len = strlen(text);
char saved = '\0';
if (box_h < 2 * display_get_font_height()) {
while (len && display_get_string_width(text) > box_w) {
if (saved) {
text[len] = saved;
}
--len;
saved = text[len];
text[len] = '\0';
}
}
display_print_in_area(text, resolve_halign(0, data->halign), resolve_valign(0, data->valign), cs, 1);
if (saved) {
text[len] = saved; // restore
}
}
(Untested proposal — I can build and verify under QEMU / on hardware and submit a PR if one of these directions is acceptable.)
Environment
- Device: Jade Plus (retail), firmware 1.0.41
- Repro: any unit whose 6 id characters are wide glyphs (e.g. all letters A–F)
Describe the bug
On Jade Plus (
HOME_SCREEN_DEEP_STATUS_BAR, 320x170 display), the device name shown in the status bar (e.g.Jade ABCDEF) can lose its last character silently. My unit displays only 5 of the 6 hex characters of the device id.Root cause analysis (from source)
deduce_jade_id()inmain/process.calways generates"Jade "+ 6 uppercase hex chars (11 chars total), derived from the eFuse MAC.make_status_bar()(main/gui.c), whenHOME_SCREEN_DEEP_STATUS_BARis set, the bar is split 65/35; the title lives in the bottom half of the right-hand 35% — roughly a 110px-wide, single-line-height box, rendered withGUI_TITLE_FONT(UBUNTU16_FONT).render_text()renders non-scroll text viadisplay_print_in_area(..., wrap=1). When the string is slightly wider than the box (which happens for ids made of wide glyphs, e.g. all A–F letters), the overflowing character(s) wrap to a second line.Whether the id fits depends on the specific glyph widths, so some units show 6 chars and others 5 — which makes the truncation easy to mistake for the actual id.
Expected behavior
The full device id is visible in the status bar (or is at least truncated in a visible/predictable way).
Possible fixes (happy to turn one of these into a PR)
render_text(), when the padded box is less than two font-heights tall, truncate the string to the characters that fit instead of wrapping onto an invisible second line, e.g.:(Untested proposal — I can build and verify under QEMU / on hardware and submit a PR if one of these directions is acceptable.)
Environment