Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(device): Focus follows its design; a question comes up to be read

0xdiego2529e0512119f5
diff --git a/devices/harness-device/firmware/assets/README.md b/devices/harness-device/firmware/assets/README.md
index c35ae6f4a..d4f5bf053 100644
--- a/devices/harness-device/firmware/assets/README.md
+++ b/devices/harness-device/firmware/assets/README.md
@@ -1,21 +1,39 @@
-# Art lifted out of the firmware that came before habitat
+# Art the glyphs are built from
-`mic.png` and `sparkle.png` are `icon_v_mic` and `icon_sparkle_fill` from `main/ui/icons_voice.c`,
-which was deleted with the LVGL renderer on 2026-09-29. They are kept as images rather than redrawn,
-because a redraw is a different drawing: the first hand-made microphone here grew a base bar the
-original never had.
+Nothing here is read at runtime — the device has no image decoder and no font engine.
+`scripts/gen_habitat_fonts.py` turns each file into a glyph and quantises it to the 2 bits per pixel
+every habitat font uses.
-**Their alpha channel is not the mark.** Both were exported as ARGB8888 in B,G,R,A order and
-CIRCULAR-MASKED — alpha 0 outside the coloured disc they sat on, alpha 255 across the whole disc. So
-alpha traces the disc and tells you nothing about the shape. The mark is white on that disc, and what
-recovers it is the minimum of the three colour channels: the disc floors that minimum at 51, its
-antialiased edge reaches about 90, and the mark itself runs to 255. Gate above 90, rescale, crop to
-the ink.
+## `mic.png` — lifted from the design, at 1:1
+
+The Focus face's microphone is the mark in `mockup/newdesign.html`, screen "Agent — recap", the
+27 x 34 box at (220, 377). That screen is rendered at the device's own 466 x 466, so the mark is
+already at the size the glass draws it and is placed into its cell **without scaling** — the only
+change between the design and the device is the quantisation to four levels.
+
+It is #00ff2f on black, so the green channel IS the coverage. Red stays near zero on the mark and
+only rises in the neutral UI around it; `g > r + 40` keeps that out.
+
+Two earlier microphones were wrong, and both ways are worth remembering. The first was drawn by hand
+from strokes and read as a different icon. The second was `icon_v_mic` from the old firmware's
+`main/ui/icons_voice.c` — a 24 x 32 white mark inside a 72 px blue disc — enlarged to fill the cell:
+40% bigger than the design, and without the design's base bar.
+
+## `sparkle.png`, `sparkle_fill.png` — from the old firmware
+
+`icon_sparkle` and `icon_sparkle_fill` from `main/ui/icons_voice.c`, which was deleted with the LVGL
+renderer on 2026-09-29. Scaled into their cell.
+
+**The old icons' alpha channel is not the mark.** They were exported as ARGB8888 in B,G,R,A order.
+The disc icons (`icon_v_mic`, `icon_v_rec`, `icon_v_orb`) are CIRCULAR-MASKED — alpha 0 outside the
+coloured disc, 255 across it — so alpha traces the disc and says nothing about the shape; the mark
+comes out of the colour channels instead. The sparkles are not on a disc, and their alpha is the
+shape.
Regenerate from git if they are ever needed again:
git show <rev>:devices/harness-device/firmware/main/ui/icons_voice.c
-`scripts/gen_habitat_fonts.py` scales each one into its glyph cell and quantises it to the 2 bits per
-pixel every habitat font uses. Nothing here is read at runtime — the device has no image decoder and
-no font engine.
+## `engines/*.png` — from the old firmware
+
+`main/ui/icons_engine.c`, same export and the same disc caveat. Scaled to cap height.
diff --git a/devices/harness-device/firmware/assets/mic.png b/devices/harness-device/firmware/assets/mic.png
index 66836abc3..c6ce427eb 100644
Binary files a/devices/harness-device/firmware/assets/mic.png and b/devices/harness-device/firmware/assets/mic.png differ
diff --git a/devices/harness-device/firmware/main/ui/habitat/character_layout.c b/devices/harness-device/firmware/main/ui/habitat/character_layout.c
index afd82adc4..56324b202 100644
--- a/devices/harness-device/firmware/main/ui/habitat/character_layout.c
+++ b/devices/harness-device/firmware/main/ui/habitat/character_layout.c
@@ -133,13 +133,29 @@ void ht_recap_lines(ht_scene_t *s, int y, uint16_t ink, const char *recap)
}
void ht_inbox_card(ht_scene_t *s, const char *mark, const char *name,
const char *message, uint16_t foreground, uint16_t status_ink)
+{
+ ht_inbox_card_badged(s, mark, name, message, foreground, status_ink, NULL, 0);
+}
+void ht_inbox_card_badged(ht_scene_t *s, const char *mark, const char *name,
+ const char *message, uint16_t foreground, uint16_t status_ink,
+ const char *badge, uint16_t badge_ink)
{
// One balanced text block. A fixed 28 px gap separates label and message,
// whether they take two lines or six. No divider or empty reserved rows.
+ /*
+ * With a badge the status mark goes, and the NAME carries the status colour instead — the
+ * design's reading of this row (a green name for a finished turn), and what stops "claude ?"
+ * reading as two marks in a row. Without one the mark stays: on a creature skin it is the only
+ * thing on the card that says done, failed or asking.
+ */
char title[HT_TEXT_BYTES];
- snprintf(title, sizeof title, "%s %s", mark, name);
+ if (badge) snprintf(title, sizeof title, "%s", name);
+ else snprintf(title, sizeof title, "%s %s", mark, name);
int start = s->count;
- lines(s, 0, 374, 2, &ht_mono_28, foreground, title, true, NULL);
+ // The badge spends part of the title's width, so the title is wrapped in what is left. Without
+ // this the pair is wider than the row it was measured for and its ends reach the bezel.
+ int badge_w = badge ? ht_engine.width + 8 : 0;
+ lines(s, 0, 374 - badge_w, 2, &ht_mono_28, badge ? status_ink : foreground, title, true, NULL);
while (s->count > start && !s->runs[s->count - 1].text[0]) s->count--;
int body = s->count;
recap_lines(s, 0, 391, HT_CHARACTER_RECAP_ROWS, false, NULL,
@@ -150,7 +166,14 @@ void ht_inbox_card(ht_scene_t *s, const char *mark, const char *name,
int top = 72 + (310 - title_height - 28 - body_height) / 2;
for (int i = start; i < s->count; i++)
s->runs[i].y += i < body ? top : top + title_height + 28;
- if (body > start) {
+ if (body > start && badge) {
+ // The badge leads the FIRST title line, and the pair is centred together.
+ ht_run_t *r = &s->runs[start];
+ int x = (HT_WIDTH - badge_w - r->w) / 2;
+ r->x = x + badge_w;
+ ht_text(s, x, r->y, ht_engine.width, &ht_engine, badge_ink, s->background, badge);
+ }
+ if (body > start && !badge) {
// Put the colored symbol in its own immutable run. Avoid a shared
// mutable per-cell palette between the compositor's two scene buffers.
ht_run_t *r = &s->runs[start];
diff --git a/devices/harness-device/firmware/main/ui/habitat/character_layout.h b/devices/harness-device/firmware/main/ui/habitat/character_layout.h
index cd4e7c611..8ffde4fb4 100644
--- a/devices/harness-device/firmware/main/ui/habitat/character_layout.h
+++ b/devices/harness-device/firmware/main/ui/habitat/character_layout.h
@@ -24,6 +24,12 @@ void ht_character_layout(ht_scene_t *s, const ht_character_face_t *f, uint8_t fr
// Text-only inbox, deliberately distinct from the companion's home recap.
void ht_inbox_card(ht_scene_t *scene, const char *mark, const char *name,
const char *message, uint16_t foreground, uint16_t status_ink);
+// The same card with the agent's engine badge (an ht_engine glyph) leading its title line, as the
+// Focus skin's design draws it. `badge` NULL is exactly ht_inbox_card; "" keeps the badge's run and
+// draws nothing, for an agent whose engine this dial does not know.
+void ht_inbox_card_badged(ht_scene_t *scene, const char *mark, const char *name,
+ const char *message, uint16_t foreground, uint16_t status_ink,
+ const char *badge, uint16_t badge_ink);
void ht_notification_bell(ht_scene_t *scene, unsigned count, uint16_t ink);
/*
* The same badge, placed.
diff --git a/devices/harness-device/firmware/main/ui/habitat/focus.c b/devices/harness-device/firmware/main/ui/habitat/focus.c
index bb210e7bf..69140818c 100644
--- a/devices/harness-device/firmware/main/ui/habitat/focus.c
+++ b/devices/harness-device/firmware/main/ui/habitat/focus.c
@@ -70,7 +70,7 @@ enum { FOCUS_BODY_Y = 118 + 38 + 27 };
* has a line of text over it; the widths are re-measured for the y they actually use.
*/
static const struct { int y, width; const ht_font_t *font; } ROWS[FOCUS_ROWS] = {
- { 60, 288, &ht_mono_20 },
+ { 50, 240, &ht_mono_20 }, // the pill: 38 tall from 50, 20 cells of name — see pill()
{ 118, 384, &ht_mono_28 },
{ FOCUS_BODY_Y, 442, &ht_mono_28 },
{ FOCUS_BODY_Y, 408, &ht_mono_28 },
@@ -153,7 +153,7 @@ static const uint32_t ENGINE_INK[] = {
_Static_assert(sizeof ENGINE_INK / sizeof ENGINE_INK[0] == sizeof ENGINES / sizeof ENGINES[0],
"one ink per engine");
-static bool engine_mark(const char *engine, char out[4], uint32_t *ink)
+bool ht_focus_engine_mark(const char *engine, char out[4], uint32_t *ink)
{
if (!engine || !*engine) return false;
for (unsigned i = 0; i < sizeof ENGINES / sizeof ENGINES[0]; i++) {
@@ -283,16 +283,58 @@ static const char *meter(unsigned level)
return bars[level > 4 ? 4 : level];
}
+/*
+ * THE TAB PILL, as the design draws it: a rounded box with a thin lighter rim.
+ *
+ * Habitat fills rectangles and nothing else, so the outline is a run of ht_pill glyphs — two cells of
+ * left cap, one body cell per letter, two of right cap — whose coverage levels 1 and 2 are the fill
+ * and the rim (see HT_THEME_PILL). The name is a second run laid over the body cells with exactly
+ * level 1 as its background, from ht_blend(), so the two meet without a seam. The caps are the
+ * padding: the name starts where the left cap's curve ends.
+ *
+ * TWO RUNS, ALWAYS — with no tab both are one empty cell — so the face's run count never moves.
+ * The name's cell sits 4 px into the pill, which centres its cap height (rows 8..22 of ht_mono_20)
+ * on the pill's middle rather than centring the cell and leaving the letters high.
+ */
+static void pill(ht_scene_t *s, const ht_character_face_t *f, const char *tab)
+{
+ const ht_font_t *font = ROWS[0].font;
+ int cells = ROWS[0].width / font->width;
+ char line[HT_TEXT_BYTES] = "";
+ if (*tab) {
+ const char *rest = tab, *end = ht_take_display_line(&rest, cells, font);
+ size_t n = (size_t)(end - tab);
+ if (n >= sizeof line) n = sizeof line - 1;
+ memcpy(line, tab, n);
+ line[n] = 0;
+ }
+ int glyphs = 0;
+ for (const char *p = line; *p; glyphs++) ht_utf8_next(&p);
+ if (!glyphs) {
+ ht_text(s, 0, ROWS[0].y, ht_pill.width, &ht_pill, s->background, s->background, "");
+ ht_text(s, 0, ROWS[0].y, font->width, font, f->foreground, s->background, "");
+ return;
+ }
+ char outline[HT_TEXT_BYTES];
+ int used = snprintf(outline, sizeof outline, "%s", HT_PILL_LEFT);
+ for (int i = 0; i < glyphs && used + 4 < (int)sizeof outline - 7; i++)
+ used += snprintf(outline + used, sizeof outline - (size_t)used, "%s", HT_PILL_BODY);
+ snprintf(outline + used, sizeof outline - (size_t)used, "%s", HT_PILL_RIGHT);
+ int width = (glyphs + 4) * ht_pill.width, x = (HT_WIDTH - width) / 2;
+ uint16_t ink = ht_rgb(HT_THEME_PILL);
+ ht_text(s, x, ROWS[0].y, width, &ht_pill, ink, s->background, outline);
+ ht_text(s, x + 2 * ht_pill.width, ROWS[0].y + 4, glyphs * font->width, font, f->foreground,
+ ht_blend(ink, s->background, 1), line);
+}
+
void ht_focus_face(ht_scene_t *s, const ht_character_face_t *f, uint8_t frame, uint16_t ink,
const char *recap)
{
(void)ink;
if (f->voice) { voice_face(s, f, frame); return; }
- uint16_t card = ht_rgb(HT_THEME_CARD);
// The pane this agent belongs to. It stands where the old face drew the repository name, which
// does not exist anywhere in the cable vocabulary — see ht_character_face_t.
- const char *tab = f->tab && *f->tab ? f->tab : "";
- row(s, 0, f->foreground, tab[0] ? card : s->background, &tab);
+ pill(s, f, f->tab && *f->tab ? f->tab : "");
/*
* The name, and the engine's badge beside it.
@@ -306,7 +348,7 @@ void ht_focus_face(ht_scene_t *s, const ht_character_face_t *f, uint8_t frame, u
*/
char mark[4];
uint32_t mark_ink = 0;
- bool badged = engine_mark(f->engine, mark, &mark_ink);
+ bool badged = ht_focus_engine_mark(f->engine, mark, &mark_ink);
const char *who = f->recipient ? f->recipient : "";
int cells = 0;
for (const char *p = who; *p; cells++) ht_utf8_next(&p);
diff --git a/devices/harness-device/firmware/main/ui/habitat/focus.h b/devices/harness-device/firmware/main/ui/habitat/focus.h
index d6d997d61..af4c04db4 100644
--- a/devices/harness-device/firmware/main/ui/habitat/focus.h
+++ b/devices/harness-device/firmware/main/ui/habitat/focus.h
@@ -24,3 +24,10 @@ void ht_focus_portrait(ht_scene_t *s, const ht_character_face_t *f, uint8_t fram
bool ht_focus_motion_tick(ht_character_motion_t *m, uint32_t now, ht_character_mood_t mood,
bool quiet, bool visible, bool down, int x, unsigned level,
uint32_t activity);
+
+/*
+ * The engine's badge: `out` gets its ht_engine glyph as UTF-8, `ink` its own colour as 0xRRGGBB, or 0
+ * for "no colour of its own — draw it in the row's ink". False, and nothing written, for an engine
+ * this build has no mark for; an unknown engine gets no badge rather than a wrong one.
+ */
+bool ht_focus_engine_mark(const char *engine, char out[4], uint32_t *ink);
diff --git a/devices/harness-device/firmware/main/ui/habitat/fonts.c b/devices/harness-device/firmware/main/ui/habitat/fonts.c
index 7f20dcf07..cd22831ed 100644
--- a/devices/harness-device/firmware/main/ui/habitat/fonts.c
+++ b/devices/harness-device/firmware/main/ui/habitat/fonts.c
@@ -6032,24 +6032,24 @@ static const uint8_t ht_open_28_pixels[] = {
const ht_font_t ht_open_28 = {8599,8599,17,38,ht_open_28_pixels};
static const uint8_t ht_mic_footer_pixels[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 90,165,0,0,0,0,0,0,0,6,191,254,144,0,0,0,0,0,0,27,255,255,228,0,
- 0,0,0,0,0,127,255,255,253,0,0,0,0,0,1,255,255,255,255,64,0,0,0,0,
- 6,255,255,255,255,144,0,0,0,0,7,255,255,255,255,208,0,0,0,0,11,255,255,255,
- 255,224,0,0,0,0,27,255,255,255,255,228,0,0,0,0,27,255,255,255,255,228,0,0,
- 0,0,31,255,255,255,255,228,0,0,0,0,31,255,255,255,255,244,0,0,0,0,31,255,
- 255,255,255,244,0,0,0,0,31,255,255,255,255,244,0,0,0,0,31,255,255,255,255,244,
- 0,0,0,0,31,255,255,255,255,244,0,0,0,0,31,255,255,255,255,244,0,0,0,0,
- 31,255,255,255,255,244,0,0,0,0,31,255,255,255,255,244,0,0,0,0,31,255,255,255,
- 255,244,0,0,0,80,31,255,255,255,255,244,5,0,0,164,31,255,255,255,255,244,26,0,
- 1,184,31,255,255,255,255,244,46,64,1,185,27,255,255,255,255,228,110,64,1,185,27,255,
- 255,255,255,228,110,64,1,189,11,255,255,255,255,224,126,0,0,126,7,255,255,255,255,208,
- 189,0,0,126,2,255,255,255,255,128,189,0,0,47,65,255,255,255,255,65,248,0,0,31,
- 144,127,255,255,253,6,244,0,0,11,224,27,255,255,228,11,224,0,0,7,248,6,191,254,
- 144,47,208,0,0,1,254,0,90,165,0,191,64,0,0,0,191,144,0,0,6,254,0,0,
- 0,0,31,233,64,1,107,244,0,0,0,0,6,255,169,106,255,144,0,0,0,0,1,191,
- 255,255,254,64,0,0,0,0,0,22,255,254,148,0,0,0,0,0,0,1,91,229,64,0,
- 0,0,0,0,0,0,7,208,0,0,0,0,0,0,0,0,7,208,0,0,0,0,0,0,
- 0,0,7,208,0,0,0,0,0,0,0,0,7,208,0,0,0,0,0,0,0,0,7,208,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,27,228,0,0,0,0,0,0,0,0,191,254,0,0,0,0,0,0,0,2,255,255,
+ 128,0,0,0,0,0,0,7,255,255,208,0,0,0,0,0,0,11,255,255,224,0,0,0,
+ 0,0,0,15,255,255,240,0,0,0,0,0,0,15,255,255,240,0,0,0,0,0,0,15,
+ 255,255,240,0,0,0,0,0,0,15,255,255,240,0,0,0,0,0,0,15,255,255,240,0,
+ 0,0,0,0,0,15,255,255,240,0,0,0,0,0,0,15,255,255,240,0,0,0,0,1,
+ 128,15,255,255,240,1,128,0,0,3,208,15,255,255,240,7,208,0,0,3,224,15,255,255,
+ 240,11,224,0,0,3,224,11,255,255,224,11,208,0,0,3,224,7,255,255,208,15,192,0,
+ 0,3,244,2,255,255,128,15,192,0,0,2,248,0,191,254,0,47,128,0,0,1,253,0,
+ 27,228,0,63,0,0,0,0,190,0,0,0,0,190,0,0,0,0,127,128,0,0,2,252,
+ 0,0,0,0,47,224,0,0,27,248,0,0,0,0,11,254,0,1,191,224,0,0,0,0,
+ 2,255,250,171,255,128,0,0,0,0,0,47,255,255,249,0,0,0,0,0,0,2,255,255,
+ 144,0,0,0,0,0,0,0,11,228,0,0,0,0,0,0,0,0,11,224,0,0,0,0,
+ 0,0,0,0,11,224,0,0,0,0,0,0,0,26,171,234,168,0,0,0,0,0,0,127,
+ 255,255,253,0,0,0,0,0,0,127,255,255,253,0,0,0,0,0,0,42,170,170,164,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const ht_font_t ht_mic_footer = {57345,57345,40,48,ht_mic_footer_pixels};
@@ -6339,6 +6339,33 @@ static const uint8_t ht_wave_pixels[] = {
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,247,253,26,64,0,
};
const ht_font_t ht_wave = {57360,57375,6,124,ht_wave_pixels};
+static const uint8_t ht_pill_pixels[] = {
+ 0,0,0,0,0,1,0,0,26,0,0,165,0,6,85,0,25,85,0,101,85,0,149,85,
+ 2,85,85,6,85,85,9,85,85,25,85,85,37,85,85,37,85,85,101,85,85,85,85,85,
+ 149,85,85,149,85,85,149,85,85,149,85,85,149,85,85,149,85,85,85,85,85,101,85,85,
+ 37,85,85,37,85,85,25,85,85,9,85,85,6,85,85,2,85,85,0,149,85,0,101,85,
+ 0,25,85,0,6,85,0,0,165,0,0,26,0,0,1,0,0,0,5,170,170,169,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,169,85,85,5,170,170,170,170,170,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,170,170,170,170,170,80,85,85,106,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,106,170,170,80,
+ 0,0,0,64,0,0,164,0,0,90,0,0,85,144,0,85,100,0,85,89,0,85,86,0,
+ 85,85,128,85,85,144,85,85,96,85,85,100,85,85,88,85,85,88,85,85,89,85,85,85,
+ 85,85,86,85,85,86,85,85,86,85,85,86,85,85,86,85,85,86,85,85,85,85,85,89,
+ 85,85,88,85,85,88,85,85,100,85,85,96,85,85,144,85,85,128,85,86,0,85,89,0,
+ 85,100,0,85,144,0,90,0,0,164,0,0,64,0,0,0,0,0,
+};
+const ht_font_t ht_pill = {57408,57412,12,38,ht_pill_pixels};
static const uint8_t ht_viet_16_pixels[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,44,0,3,208,0,106,0,10,96,0,146,
0,12,36,1,130,128,47,248,2,149,208,96,9,6,0,160,160,6,0,0,0,1,128,0,
diff --git a/devices/harness-device/firmware/main/ui/habitat/terminal.c b/devices/harness-device/firmware/main/ui/habitat/terminal.c
index a18c97d41..edb42b415 100644
--- a/devices/harness-device/firmware/main/ui/habitat/terminal.c
+++ b/devices/harness-device/firmware/main/ui/habitat/terminal.c
@@ -609,12 +609,16 @@ static void fill(uint16_t *p, size_t n, uint16_t c)
for (size_t i = 0; i < n; i++)
p[i] = c;
}
-static uint16_t blend(uint16_t fg, uint16_t bg, unsigned alpha)
+uint16_t ht_blend(uint16_t fg, uint16_t bg, unsigned alpha)
{
unsigned r = (((fg >> 11) * alpha + (bg >> 11) * (3 - alpha)) + 1) / 3;
unsigned g = ((((fg >> 5) & 63) * alpha + ((bg >> 5) & 63) * (3 - alpha)) + 1) / 3;
unsigned b = (((fg & 31) * alpha + (bg & 31) * (3 - alpha)) + 1) / 3;
- return panel16((r << 11) | (g << 5) | b);
+ return (uint16_t)((r << 11) | (g << 5) | b);
+}
+static uint16_t blend(uint16_t fg, uint16_t bg, unsigned alpha)
+{
+ return panel16(ht_blend(fg, bg, alpha));
}
// The small ASCII artwork uses only a handful of characters. Expand each used
diff --git a/devices/harness-device/firmware/main/ui/habitat/terminal.h b/devices/harness-device/firmware/main/ui/habitat/terminal.h
index 8b975422a..be9946c81 100644
--- a/devices/harness-device/firmware/main/ui/habitat/terminal.h
+++ b/devices/harness-device/firmware/main/ui/habitat/terminal.h
@@ -40,6 +40,14 @@ extern const uint8_t ht_right_20_ink[1][4];
#define HT_WAVE_LEVELS 16
extern const ht_font_t ht_bell_20, ht_bell_28;
extern const ht_font_t ht_bell_footer, ht_done_28, ht_failed_28, ht_mic_footer;
+// The Focus tab pill's outline in five pieces — left cap (two cells), body, right cap (two cells).
+extern const ht_font_t ht_pill;
+#define HT_PILL_LEFT "\xee\x81\x80\xee\x81\x81"
+#define HT_PILL_BODY "\xee\x81\x82"
+#define HT_PILL_RIGHT "\xee\x81\x83\xee\x81\x84"
+// The colour a glyph pixel at coverage `alpha` (0..3) takes between `fg` and `bg`, exactly as the
+// rasteriser computes it. For a run that has to sit seamlessly on another run's coverage level.
+uint16_t ht_blend(uint16_t fg, uint16_t bg, unsigned alpha);
// The voice screen: one sparkle, and six bar heights that a row of nine draws a waveform with.
extern const ht_font_t ht_spark, ht_wave;
// One badge per engine, from U+E020 in the order focus.c lists them. 24 px in a 38 px cell, so a
diff --git a/devices/harness-device/firmware/main/ui/habitat/theme.h b/devices/harness-device/firmware/main/ui/habitat/theme.h
index 8c3e97851..04502567f 100644
--- a/devices/harness-device/firmware/main/ui/habitat/theme.h
+++ b/devices/harness-device/firmware/main/ui/habitat/theme.h
@@ -5,6 +5,9 @@
// All colors are RGB565-representable at full brightness. Conversion and the
// existing saved brightness setting remain at the UI boundary; no theme heap.
#define HT_THEME_CANVAS 0x181818u
+// The Focus skin's canvas. Its design (mockup/newdesign.html, every screen) is on black, not on the
+// terminal's charcoal — Focus is the pre-habitat layout and brings its ground with it.
+#define HT_THEME_FOCUS_CANVAS 0x000000u
#define HT_THEME_TEXT 0xefe7deu
#define HT_THEME_SECONDARY 0xada6adu
#ifdef DEVICE_HABITAT_ORANGE
@@ -14,18 +17,17 @@
#endif
#define HT_THEME_SELECTION 0x392c4au
#define HT_THEME_ERROR 0xe7a6adu
-// A raised block behind a label — the tab pill on the Focus face.
-//
-// It is the one near-neutral dark colour besides the canvas, and near-neutral darks are a trap here:
-// RGB565 has an extra green bit, so truncating one per channel tints it green. color() quantises the
-// canvas to exact multiples of 8 for that reason and must do the same for this — see ui_habitat.c.
-#define HT_THEME_CARD 0x282828u
+// The Focus tab pill's INK — not its fill. The pill is a run of ht_pill glyphs, which carry their fill
+// and rim as coverage levels 1 and 2 of this ink over the black canvas: level 1 ≈ #19181f, the
+// design's #141519 fill, and level 2 ≈ #31313a, its #333842 rim. Level 3, this colour itself, is
+// never drawn. See gen_habitat_fonts.py (ht_pill) and focus.c (pill).
+#define HT_THEME_PILL 0x484a5au
// Desktop activityColor() / darkTerminalTheme ANSI status colors.
//
// The inbox status mark was the only coloured thing on the glass until the Focus skin, which reads a
-// live status in HT_THEME_DONE and marks the engine in the accent. On the creature skins the rule is
-// unchanged: pane name, message and navigation stay neutral.
-// The recording waveform's green, and only that.
+// live status in HT_THEME_DONE and draws each engine in its own ink (focus.c, ENGINE_INK). On the
+// creature skins the rule is unchanged: pane name, message and navigation stay neutral.
+// The voice green: the recording waveform and the microphone that starts it.
//
// It is a pure channel — brighter and harder than HT_THEME_DONE, which is the terminal's "finished"
// green and is what a status line uses. The old firmware kept the two apart for the same reason: the
diff --git a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c
index a6bb9c581..f9f2124f4 100644
--- a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c
+++ b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c
@@ -9,6 +9,7 @@
#include "draft.h"
#include "gestures.h"
#include "character.h"
+#include "focus.h"
#include "perf_bench.h"
#include "command_face.h"
#include "theme.h"
@@ -373,6 +374,17 @@ static void notice_mark_read(cable_notif_t *n)
// Read is not answered, removed or focused. Keep this exact card in place.
change();
}
+// Put one agent's question on the glass: its inbox card, which is the prompt whole and nothing to
+// press but the card, whose tap opens the pane on the desktop. The answer is given there.
+static void notice_show_question(const char *id)
+{
+ for (int i = 0; i < s.notice_count; i++)
+ if (s.notice[i].question && !strcmp(s.notice[i].agent_id, id)) {
+ view(INBOX);
+ s.offset = i;
+ return;
+ }
+}
static void notice_open(void)
{
view(s.notice_count ? INBOX : HOME);
@@ -566,17 +578,18 @@ static bool is_question(const char *id)
static uint16_t color(unsigned rgb)
{
unsigned b = s.brightness < 8 ? 8 : s.brightness;
- if (rgb == HT_THEME_CANVAS || rgb == HT_THEME_CARD) {
+ if (rgb == HT_THEME_CANVAS) {
// RGB565 has an extra green bit. Independently truncating a dim gray
- // makes it green; the neutral range has exact steps of 8, and both the canvas and the card
- // fill behind a Focus label are dim neutrals that would tint without this.
+ // makes it green; the neutral range has exact steps of 8.
unsigned gray = (((rgb & 255) * b + 400) / 800) * 8;
return ht_rgb(gray * 0x010101u);
}
return ht_rgb((((rgb >> 16) * b / 100) << 16) | ((((rgb >> 8) & 255) * b / 100) << 8) |
((rgb & 255) * b / 100));
}
-#define BG color(HT_THEME_CANVAS)
+// Which ground this skin stands on. One answer for the whole glass, not per screen: the inbox, lists
+// and settings under Focus are on the same black as its home face, as they are in its design.
+#define BG color(character.id == HT_CHARACTER_FOCUS ? HT_THEME_FOCUS_CANVAS : HT_THEME_CANVAS)
#define FG color(HT_THEME_TEXT)
#define DIM color(HT_THEME_SECONDARY)
#define ACCENT color(HT_THEME_ACCENT)
@@ -791,6 +804,9 @@ static void render_workspace_preview(ht_scene_t *f)
}
static void render_home(ht_scene_t *f)
{
+ // Where the Focus face's microphone target begins: a little above the mark's ink at 377, so the
+ // top of the mark is not its edge. A_PET ends here on Focus.
+ enum { FOCUS_MIC_TOP = 366 };
s.caption_arc = (ht_rect_t){0};
if (!s.connected || s.loading) { render_brand(f); return; }
if (workspace.touching && workspace.moved && !workspace.cancelled) { render_workspace_preview(f); return; }
@@ -801,7 +817,10 @@ static void render_home(ht_scene_t *f)
!s.nap && !s.voice_retry_until && !carry.active && !carry.error[0] ? a->preview : NULL;
// A live turn can outlast its terminal footer (or have no readable footer).
// Keep its busy state visible while more specific activity is unavailable.
- const char *activity = a && a->busy && s.connected && !s.loading && !s.nap ?
+ // An agent with a question open is not working, whatever its turn says: it is waiting on this
+ // person. The face says so instead of a "Working" that sends them nowhere.
+ const char *activity = a && s.connected && !s.loading && !s.nap && is_question(a->id) ?
+ "Needs your answer" : a && a->busy && s.connected && !s.loading && !s.nap ?
(a->tool[0] ? a->tool : "Working") : "";
home_caption_tick(ms());
/*
@@ -820,7 +839,7 @@ static void render_home(ht_scene_t *f)
// Seconds since THIS DIAL heard about the turn, not since it began: turn.started carries no
// timestamp. The 25 s staleness fuse (ui_prune_stale_busy) is what keeps this from counting a
// turn nobody is running any more.
- uint32_t since = a && a->busy && a->busy_ms ? (ms() - a->busy_ms) / 1000 : 0;
+ uint32_t since = a && a->busy && a->busy_ms && !is_question(a->id) ? (ms() - a->busy_ms) / 1000 : 0;
int tab_index = workspace_index(s.selected_tab);
ht_character_face_t f_ = {.recipient = caption, .status = bell ? "" : status,
.hint = "",
@@ -884,14 +903,36 @@ static void render_home(ht_scene_t *f)
if (focus_face && !carry.active && !carry.error[0] && !visit.available) {
bool can_say = s.connected && !s.loading && a != NULL;
int n = s.hit_count++;
- s.hits[n] = (hit_t){{143, 389, 180, 50}, A_VOICE, 0, can_say};
- ht_text(f, (HT_WIDTH - ht_mic_footer.width) / 2, 392, ht_mic_footer.width, &ht_mic_footer,
- !can_say ? DIM : n == s.pressed ? ACCENT : color(HT_THEME_DONE), BG, HT_MIC);
+ /*
+ * THE TARGET RUNS TO THE BOTTOM OF THE GLASS, and that is the whole point of it.
+ *
+ * It was {143, 389, 180, 50} — 50 px tall around a 48 px glyph drawn at y 392, so three
+ * pixels of slack above the mark and NONE below it. A thumb pressing the lower half of a
+ * circle held in the hand rolls downward, and the roll left the rect. That loses the entire
+ * contact rather than just the release: the press path records `pressed_action` from the
+ * FIRST sample, and both the scroll guard above and the release rule below ask
+ * home_footer(pressed_action.kind), so a DOWN one pixel low makes the contact a terminal
+ * scroll and nothing can recover it. Pressing the TOP of the mark worked immediately because
+ * the row above is A_PET, whose tap opens the microphone too.
+ *
+ * Nothing else on the Focus face claims this band — A_PET is cut short to end where it
+ * starts (see the bottom of this function), the bell sits at the top — so the rect takes it
+ * whole, down to the bottom edge. The corners fall outside the round glass, which costs
+ * nothing: a touch out there does not exist.
+ */
+ s.hits[n] = (hit_t){{143, FOCUS_MIC_TOP, 180, HT_HEIGHT - FOCUS_MIC_TOP}, A_VOICE, 0, can_say};
+ // Cell at 370 puts the mark's ink at y 377..411 — the design's own rows (mockup/newdesign.html,
+ // "Agent — recap"). It sat 22 px lower before, close enough to the bezel to read as crowded.
+ ht_text(f, (HT_WIDTH - ht_mic_footer.width) / 2, 370, ht_mic_footer.width, &ht_mic_footer,
+ // The design's own green, which is also the recording meter's: the thing that starts
+ // speech and the thing that shows it are one colour. HT_THEME_DONE, which this used to
+ // be, is the terminal's "finished" teal and read on glass as a different button.
+ !can_say ? DIM : n == s.pressed ? ACCENT : color(HT_THEME_VOICE), BG, HT_MIC);
}
if (!carry.active && !carry.error[0] && !visit.available) {
// Both phases of the caption open the same pane picker. On Focus the caption is the pill,
// which sits below where the arc would have been.
- s.hits[s.hit_count++] = focus_face ? (hit_t){{83, 56, 300, 44}, A_AGENTS, 0, true}
+ s.hits[s.hit_count++] = focus_face ? (hit_t){{83, 54, 300, 40}, A_AGENTS, 0, true}
: (hit_t){{83, 0, 300, 66}, A_AGENTS, 0, true};
for (int i = 0; i < f->count; i++) if (f->runs[i].arc == 1) {
ht_rect_t r = ht_run_bounds(&f->runs[i]);
@@ -905,7 +946,9 @@ static void render_home(ht_scene_t *f)
: (hit_t){{83, 382, 300, 84}, A_INBOX, 0, unread > 0};
// The bell and the creature never share a target, even when the bell is
// hidden or its count changes under a finger. Centre always starts voice.
- s.hits[s.hit_count++] = (hit_t){{33, 66, 400, 316}, A_PET, 0, true};
+ // On Focus it stops where the microphone's target starts; nothing is drawn between the last recap
+ // row (y 335) and the mic, so the band belongs to the button rather than to a tap-anywhere.
+ s.hits[s.hit_count++] = (hit_t){{33, 66, 400, focus_face ? FOCUS_MIC_TOP - 66 : 316}, A_PET, 0, true};
}
static void render_agents(ht_scene_t *f)
{
@@ -1148,9 +1191,22 @@ static void render_notice(ht_scene_t *f)
int body = s.hit_count++;
s.hits[body] = (hit_t){{33, 55, 400, 327}, A_NOTICE, s.offset, s.connected};
uint16_t mark = color(n->question ? HT_THEME_QUESTION : n->failed ? HT_THEME_FAILED : HT_THEME_DONE);
- ht_inbox_card(f, n->question ? "?" : n->failed ? HT_FAILED : HT_DONE, n->name,
- n->summary[0] ? n->summary : "No preview available.",
- s.connected ? FG : DIM, s.connected ? mark : DIM);
+ /*
+ * On Focus the card leads with the agent's engine badge, as its design does. The notice carries
+ * only the agent's id, so the engine comes from the roster: a notice from an agent this dial is
+ * not carrying (another machine's) has none, and gets an empty badge rather than a guessed one.
+ */
+ char badge[4] = "";
+ uint32_t badge_ink = 0;
+ if (character.id == HT_CHARACTER_FOCUS) {
+ int i = find(n->agent_id);
+ if (i >= 0) ht_focus_engine_mark(s.agents[i].engine, badge, &badge_ink);
+ }
+ ht_inbox_card_badged(f, n->question ? "?" : n->failed ? HT_FAILED : HT_DONE, n->name,
+ n->summary[0] ? n->summary : "No preview available.",
+ s.connected ? FG : DIM, s.connected ? mark : DIM,
+ character.id == HT_CHARACTER_FOCUS ? badge : NULL,
+ !s.connected ? DIM : badge_ink ? color(badge_ink) : FG);
s.notice_frame = n->read_on_dial ? 0 : n->display_revision;
s.hits[s.hit_count++] = (hit_t){{83, 392, 300, 74}, A_HOME, 0, true};
ht_text(f, FACE_CX(20), 400, 20, &ht_nav_32,
@@ -2354,6 +2410,13 @@ void habitat_touch(bool down, int x, int y, uint32_t now)
if (s.view == VOICE) {
ESP_LOGI("habitat", "gesture tap: finish voice");
dispatch((action_t){.kind = A_VOICE_STOP});
+ } else if (character.id == HT_CHARACTER_FOCUS && s.view != SELECTION) {
+ /*
+ * On Focus the microphone starts speech and nothing else does. A creature skin has
+ * no button — the creature IS the affordance, so the middle of the glass has to be
+ * one. Focus draws its button, and the middle is the recap somebody is reading: a
+ * tap there opening the mic surprised people, and the mic is right under it.
+ */
} else if (s.connected && !s.loading && pressed_action.id[0]) {
ESP_LOGI("habitat", "gesture tap: start voice");
pressed_action.kind = A_VOICE;
@@ -3409,7 +3472,24 @@ void ui_question_show(const char *id, const char *name, const char *machine, con
s.q.valid=false; s.q.pending=false; s.q.revision++;
if (question_view(s.view)) { COPY(s.q.error,"The question changed. Open the alert again."); view(QUESTION); }
}
- change(); display_unlock();
+ /*
+ * A QUESTION TAKES THE GLASS — to be READ, not answered.
+ *
+ * An agent that asks has stopped: it is waiting on this person and nothing else. Leaving the
+ * face on its "working" line with a count in the bell said the opposite, even to somebody
+ * looking straight at that agent. So the question's card comes up now, from any screen a person
+ * is only reading, on every skin. It is the prompt and nothing else — no [later], [say] or
+ * [next]: the answer is given in the app, which is where the card's tap takes them. Not from a
+ * screen they are in the middle of — recording, drafting, a form, a question already open, a
+ * finger on the glass — where it would take their work away; there the bell counts it, as
+ * before, until the question is ANSWERED rather than until it is seen.
+ */
+ bool reading = s.view == HOME || s.view == AGENTS || s.view == AGENT || s.view == READER ||
+ s.view == INBOX || s.view == TABS || s.view == MACHINES || s.view == MESSAGE;
+ if (reading && !s.touch_down) notice_show_question(id);
+ change();
+ display_wake();
+ display_unlock();
}
void ui_question_state(const cJSON *p)
{
diff --git a/devices/harness-device/firmware/scripts/gen_habitat_fonts.py b/devices/harness-device/firmware/scripts/gen_habitat_fonts.py
index c3509e7b0..023f5eeea 100644
--- a/devices/harness-device/firmware/scripts/gen_habitat_fonts.py
+++ b/devices/harness-device/firmware/scripts/gen_habitat_fonts.py
@@ -48,6 +48,7 @@ fonts = [('ht_mono_16',mono,16,10,22,17),('ht_mono_20',mono,20,12,28,22),
('ht_spark',mono,40,40,48,40),
('ht_engine',mono,28,24,38,31),
('ht_wave',mono,40,6,124,40),
+ ('ht_pill',mono,20,12,38,30),
('ht_viet_16',viet,16,10,22,17),('ht_viet_20',viet,20,12,28,22),
('ht_viet_24',viet,24,15,32,26),('ht_viet_28',viet,28,17,38,31)]
with dest.open('w') as out:
@@ -58,7 +59,7 @@ with dest.open('w') as out:
data=[]
bounds=[]
# Latin-1 keeps common names readable; unknown Unicode renders ?, never changes wire text.
- first,last=(0xe020,0xe020+len(ENGINES)-1) if name=='ht_engine' else (0xe010,0xe01f) if name=='ht_wave' else (0xe002,0xe002) if name=='ht_spark' else (0xe001,0xe001) if name=='ht_mic_footer' else (0x1ea0,0x1ea0+0x59+len(VIET_TAIL)) if name.startswith('ht_viet_') else (0xe000,0xe000) if name.startswith('ht_bell_') else (0x2713,0x2713) if name=='ht_done_28' else (0x2717,0x2717) if name=='ht_failed_28' else (0x2190,0x2197) if name=='ht_nav_32' else (0x2197,0x2197) if name.startswith('ht_open_') else (0x2192,0x2192) if name.startswith('ht_right_') else (ord('o'),ord('o')) if name=='ht_lock_dot' else (32,255 if name!='ht_pixel_40' else 126)
+ first,last=(0xe020,0xe020+len(ENGINES)-1) if name=='ht_engine' else (0xe010,0xe01f) if name=='ht_wave' else (0xe040,0xe044) if name=='ht_pill' else (0xe002,0xe002) if name=='ht_spark' else (0xe001,0xe001) if name=='ht_mic_footer' else (0x1ea0,0x1ea0+0x59+len(VIET_TAIL)) if name.startswith('ht_viet_') else (0xe000,0xe000) if name.startswith('ht_bell_') else (0x2713,0x2713) if name=='ht_done_28' else (0x2717,0x2717) if name=='ht_failed_28' else (0x2190,0x2197) if name=='ht_nav_32' else (0x2197,0x2197) if name.startswith('ht_open_') else (0x2192,0x2192) if name.startswith('ht_right_') else (ord('o'),ord('o')) if name=='ht_lock_dot' else (32,255 if name!='ht_pixel_40' else 126)
for cp in range(first,last+1):
# The tail of the Vietnamese atlas is the eight scattered letters, in VIET_TAIL order.
glyph = VIET_TAIL[cp-0x1efa] if name.startswith('ht_viet_') and cp >= 0x1efa else chr(cp)
@@ -74,7 +75,7 @@ with dest.open('w') as out:
draw.line([(22,26),(22,34)],fill=255,width=6)
draw.arc((16,80,28,92),0,180,fill=255,width=6)
im=hi.resize((width,height),Image.Resampling.LANCZOS)
- if name in ('ht_bell_footer','ht_done_28','ht_failed_28','ht_mic_footer','ht_spark','ht_wave','ht_engine'):
+ if name in ('ht_bell_footer','ht_done_28','ht_failed_28','ht_spark','ht_wave','ht_engine'):
# The footer bell gets a round 26 px cell instead of squeezing
# a dome into a 17 px letter. Small immutable 2-bit atlases only.
hi=Image.new('L',(width*4,height*4));draw=ImageDraw.Draw(hi)
@@ -119,24 +120,10 @@ with dest.open('w') as out:
half = h * 4 // 2
draw.rounded_rectangle((0, mid - half, width * 4 - 1, mid + half),
radius=width * 2, fill=255)
- elif name in ('ht_mic_footer','ht_spark'):
- # THE OLD FIRMWARE'S OWN ART, not a redraw of it.
- #
- # Both assets come out of the deleted ui/icons_voice.c. The microphone is the
- # white mark inside icon_v_mic's 72 px blue disc — so its shape is not in the
- # alpha channel, which is the DISC; it is how far each pixel is pushed from the
- # disc's #3378ff toward white, taken only where the disc is fully opaque so its
- # own antialiased rim is not mistaken for ink. That mark is 24 x 32 and that is
- # every pixel it ever had. The sparkle is icon_sparkle_fill, where the alpha IS
- # the shape. See assets/README.md.
- #
- # An earlier version of this file traced the microphone and redrew it as strokes,
- # on the theory that enlarging a 24 px bitmap could only be soft. It was soft the
- # other way: the redraw narrowed the capsule and thinned the cradle, and on glass
- # it read as a different, worse icon. LANCZOS at 4x and reduced keeps the
- # proportions the artwork actually has, and those are the ones to keep.
- art = Image.open(root/('assets/mic.png' if name=='ht_mic_footer'
- else 'assets/sparkle_fill.png'))
+ elif name=='ht_spark':
+ # icon_sparkle_fill from the deleted ui/icons_voice.c; its alpha IS the shape.
+ # See assets/README.md. Scaled to this cell and centred.
+ art = Image.open(root/'assets/sparkle_fill.png')
# 0.92, because the crop is tight to the ink and the source had room around it.
scale = 0.92 * min(width*4/art.width, height*4/art.height)
art = art.resize((round(art.width*scale), round(art.height*scale)),
@@ -152,6 +139,40 @@ with dest.open('w') as out:
stroke([(3,17),(14,28)])
stroke([(14,17),(3,28)])
im=hi.resize((width,height),Image.Resampling.LANCZOS)
+ if name=='ht_pill':
+ # THE TAB PILL'S OUTLINE, in five pieces: left cap (two cells), body, right cap (two
+ # cells). Habitat can only fill rectangles, so a rounded box is a run of these glyphs
+ # under the tab name's own run.
+ #
+ # Three colours from a glyph that has two: the pill is drawn in an ink three times its
+ # fill, so coverage level 1 IS the fill and level 2 is the rim — a third lighter, as
+ # the design's #333842 rim is against its #141519 fill. Outside stays level 0, the
+ # canvas. So each pixel here is a LEVEL, not a coverage: 0, 85 or 170, and the only
+ # blending is at the outer edge, where black to rim passes through fill — which is
+ # what antialiasing that edge would have painted anyway.
+ #
+ # Stadium of height 38, radius 19, rim 1 px; the name's run covers the body cells
+ # and uses exactly level 1 as its background, so no seam shows. See focus.c.
+ S = 4
+ piece = cp - first # 0,1 left cap 2 body 3,4 right cap
+ big = Image.new('L', (width*S*5, height*S))
+ d = ImageDraw.Draw(big)
+ d.rounded_rectangle((0, 0, width*S*5 - 1, height*S - 1), radius=height*S//2, fill=170)
+ d.rounded_rectangle((S, S, width*S*5 - 1 - S, height*S - 1 - S),
+ radius=height*S//2 - S, fill=85)
+ x = piece * width * S
+ im = big.crop((x, 0, x + width*S, height*S)).resize((width, height), Image.Resampling.BOX)
+ elif name=='ht_mic_footer':
+ # THE DESIGN'S OWN PIXELS, at 1:1 — not scaled, not redrawn.
+ #
+ # assets/mic.png is the mark from mockup/newdesign.html, which is rendered at the
+ # device's 466 x 466, so it is already the size the glass draws. Every earlier
+ # microphone here was scaled or traced and read as a different icon; this one only
+ # loses what four levels of coverage cannot hold. Offset (7, 7): seven puts its left
+ # edge on the design's x = 220 given the cell is drawn at 213, and seven vertically
+ # centres its 34 rows in the 48.
+ im = Image.new('L', (width, height))
+ im.paste(Image.open(root/'assets/mic.png'), (7, 7))
values=[min(3,(v+42)//85) for v in im.get_flattened_data()]
if name in ('ht_mono_20','ht_open_20','ht_right_20','ht_bell_20'):
ink=[(i%width,i//width) for i,a in enumerate(values) if a]
diff --git a/devices/harness-device/firmware/test/test_character.c b/devices/harness-device/firmware/test/test_character.c
index 2c5d597f2..e5e1d8294 100644
--- a/devices/harness-device/firmware/test/test_character.c
+++ b/devices/harness-device/firmware/test/test_character.c
@@ -334,10 +334,10 @@ static void focus_face(void)
assert(above == below);
}
- // Stated as its parts rather than as a number: the tab pill, the agent name, the engine mark on
- // its own run so it can be coloured without a per-cell palette, the live status, and the four
- // recap rows the octopus reads its summary in.
- assert(expected == 1 + 1 + 1 + 1 + 4);
+ // Stated as its parts rather than as a number: the tab pill and the two rows of padding under it,
+ // the agent name, the engine mark on its own run so it can be coloured without a per-cell
+ // palette, the live status, and the four recap rows the octopus reads its summary in.
+ assert(expected == 1 + 1 + 1 + 1 + 1 + 4);
}
static void footer_layout(void)
diff --git a/devices/harness-device/firmware/test/test_question_ui.py b/devices/harness-device/firmware/test/test_question_ui.py
index 6007943c7..38e94e765 100644
--- a/devices/harness-device/firmware/test/test_question_ui.py
+++ b/devices/harness-device/firmware/test/test_question_ui.py
@@ -50,7 +50,7 @@ static cJSON object(cJSON *children,int n) {
for (int i=0;i<n;i++) children[i].next=i+1<n ? &children[i+1] : NULL;
return (cJSON){.type=JOBJECT,.child=n ? children : NULL};
}
-static struct { question_t q; bool voice_open,voice_waiting; uint32_t voice_question_revision,notice_sequence; int voice_question_index; view_t voice_return; char title[80],message[256]; view_t view; int offset,pressed,hit_count,active,notice_count; char pending_focus[ID_MAX],opening_notice[ID_MAX]; bool connected; hit_t hits[24]; } s;
+static struct { question_t q; bool voice_open,voice_waiting,touch_down; uint32_t voice_question_revision,notice_sequence; int voice_question_index; view_t voice_return; char title[80],message[256]; view_t view; int offset,pressed,hit_count,active,notice_count; char pending_focus[ID_MAX],opening_notice[ID_MAX]; bool connected; hit_t hits[24]; } s;
typedef struct { char id[64],name[96]; } agent_t;
static agent_t agents[2]={{.id="a",.name="Research helper"},{.id="b",.name="Remote helper"}};
static bool b_known;
@@ -76,6 +76,10 @@ static void view(view_t v) { input_cancel(); s.view=v; s.offset=0; }
static void voice_close(void) { s.voice_open=s.voice_waiting=false; }
static void display_lock(void) {}
static void display_unlock(void) {}
+static int wakes;
+static void display_wake(void) { wakes++; }
+static int shown;
+static void notice_show_question(const char *id) { assert(id && *id); shown++; view(INBOX); }
static bool queue(action_t a) {
if (congested) return false;
queued=a; if (a.kind==A_ANSWER) queued_answers++; return true;
@@ -225,6 +229,16 @@ int main(int argc,char **argv) {
reset(false);s.view=MESSAGE;visit.available=true;strcpy(visit.agent,"b");b_known=false;
ui_focus_project("b");assert(!strcmp(s.pending_focus,"b") && s.view==MESSAGE);
b_known=true;ui_focus_project("b");assert(s.view==QUESTION && s.q.loading && !strcmp(s.q.agent,"b"));
+ // A question TAKES THE GLASS from a screen a person is only reading — its card, to be read; the
+ // answer is given in the app. No answer screen opens and nothing is fetched to answer with.
+ reset(false);view(HOME);reads=0;wakes=0;shown=0;
+ ui_question_show("b","Other","M2","q-b2",NULL);
+ assert(s.view==INBOX && shown==1 && wakes==1 && reads==0);
+ // ...and not from one they are in the middle of, nor from under a finger. The alert still counts.
+ reset(false);view(HOME);s.touch_down=true;notices=0;shown=0;
+ ui_question_show("b","Other","M2","q-b3",NULL);assert(s.view==HOME && notices==1 && !shown);
+ reset(false);s.view=VOICE;shown=0;ui_question_show("b","Other","M2","q-b4",NULL);assert(s.view==VOICE && !shown);
+ reset(false);s.view=DRAFT;shown=0;ui_question_show("b","Other","M2","q-b5",NULL);assert(s.view==DRAFT && !shown);
// The ESP32 compiler's -O0 restrict analysis sees the enclosing global s,
// not the disjoint options/answer fields. Exercise every selected subset
// at their real capacities and prove that no neighboring state changes.
diff --git a/devices/harness-device/firmware/test/test_touch_ui.py b/devices/harness-device/firmware/test/test_touch_ui.py
index 97c11d4c8..e945e2e19 100644
--- a/devices/harness-device/firmware/test/test_touch_ui.py
+++ b/devices/harness-device/firmware/test/test_touch_ui.py
@@ -29,6 +29,7 @@ code = r'''
#include "draft.h"
#include "octopus.h"
#include "character.h"
+#include "focus.h"
#include "workspace.h"
#include "command_face.h"
#include "arc_geometry.inc"
@@ -125,7 +126,8 @@ static char target[64];
#include "theme.h"
static uint16_t color(unsigned rgb);
static unsigned preview_brightness = 100;
-#define BG color(HT_THEME_CANVAS)
+// Kept in step with ui_habitat.c by hand: the Focus skin stands on its own black ground.
+#define BG color(character.id == HT_CHARACTER_FOCUS ? HT_THEME_FOCUS_CANVAS : HT_THEME_CANVAS)
#define FG color(HT_THEME_TEXT)
#define DIM color(HT_THEME_SECONDARY)
#define ACCENT color(HT_THEME_ACCENT)
@@ -1716,11 +1718,42 @@ int main(int argc, char **argv) {
* the footer and registers the rect itself. Every row of that rect has to answer — a button whose
* top half works reads as a broken button, not as a small one.
*/
- for (int y = 392; y <= 436; y += 4) {
+ // The Focus SKIN's home face, footer and all — the "focus" portrait above is the legacy
+ // focus-face option on the default character, which draws no microphone.
+ reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take(); portrait(dir, "focus-skin");
+ // A question's card on Focus: the engine badge, the "?" and the name, then the prompt — the whole
+ // of what a question puts on the glass. It is answered in the app.
+ reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); strcpy(s.agents[0].engine, "claude");
+ {
+ cable_notif_t asked={.question=true,.summary="Which database should the retry queue use?"};
+ COPY(asked.agent_id, s.agents[0].id); COPY(asked.name, "Kinh T\u1ebf");
+ ui_notif_replace(&asked,1); ui_notif_open(); scene_take(); portrait(dir, "focus-question");
+ assert(s.view == INBOX);
+ }
+ for (int y = 366; y < HT_HEIGHT; y += 4) {
+ // Inside the round glass only: a target row whose centre is off the panel is not a row.
+ if ((y - 233) * (y - 233) >= 230 * 230) continue;
reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
tap(1000, 233, y);
assert(starts == 1);
}
+ /*
+ * AND THE ROLL DOWNWARD, which is how this button was actually failing.
+ *
+ * The drift case below moves down by half its drift from y 410 and so never leaves the old
+ * 389..439 rect. A thumb pressing the LOWER half of the mark on a circle held in the hand rolls
+ * further than that, and the old rect ended one pixel above the mark's own last row — so the
+ * contact left the target with nothing below it to land on. It is the press that matters, not
+ * just the release: pressed_action is read from the first sample, so a DOWN one row low turned
+ * the whole contact into a terminal scroll.
+ */
+ for (int y = 424; y <= 448; y += 8) for (int roll = 0; roll <= 16; roll += 8) {
+ reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
+ habitat_touch(true, 233, y, 1000);
+ habitat_touch(true, 233, y + roll, 1400);
+ habitat_touch(false, 233, y + roll, 1800);
+ assert(starts == 1);
+ }
/*
* A THUMB, not an idealised tap. 12 px is 1.20 mm and 350 ms is quick; a real press on a circle
* held in the hand drifts past both. A footer button answers a press that comes back up inside
@@ -1739,11 +1772,12 @@ int main(int argc, char **argv) {
habitat_touch(false, 233, 300, 1200);
assert(!starts); // dragged off the button; a press that leaves is not a press
- // And the middle of the glass, which every skin has always answered with speech.
+ // And NOT the middle of the glass. The creature skins start speech from anywhere on the creature;
+ // Focus has a button for it, and the middle is the recap being read.
for (int y = 120; y <= 360; y += 40) {
reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
tap(1000, 233, y);
- assert(starts == 1);
+ assert(!starts);
}
reset(); s.straight_title=true; scene_take(); portrait(dir,"straight-title");
reset(); s.nap=true; scene_take(); portrait(dir,"asleep");