Blockstream / Blockstream/Jade

Device name (jade_id) last character invisibly clipped in deep status bar on Jade Plus

Open
#341 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
496
Forks
127
PR merge metrics
No merged PRs in 30d

Description

**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)**

1. `deduce_jade_id()` in `main/process.c` always generates `"Jade "` + 6 uppercase hex chars (11 chars total), derived from the eFuse MAC.
2. 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`).
3. `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.
4. 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.:

```c
} 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)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in main/gui.c at make_status_bar() and render_text(), then check main/process.c for deduce_jade_id(). Reproduce the HOME_SCREEN_DEEP_STATUS_BAR layout on a Jade Plus build under QEMU or on hardware, and verify that the complete device name remains visible or is truncated predictably without an invisible wrapped line.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.