Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Breaking rules, SemVer mapping, and examples: [CONTRIBUTING.md](CONTRIBUTING.md)
- **Mods** — optional add-ons under `mods/<mod_name>/`. Models live in `3d_models/{cad,parts}/`. Commit `type(mods)` and name the mod in the summary. `feat(mods)` / `fix(mods)` do not version stock CAD. See [mods/README.md](mods/README.md).
- **PCB** — [docs/pcb.md](docs/pcb.md) checklist + KiCad review rules below. Run `python3 scripts/check_pcb.py` (KiCad 10). New board paths need `REUSE.toml`. CERN-OHL-S.
- **Motion** — poses −1..1 mapped to saved min/max; see [docs/robot-movement.md](docs/robot-movement.md). Do not widen NVS servo clamps without testing on a real robot.
- **OLED eye styles** — add/register under [`src/display/eyes/styles/`](src/display/eyes/styles/README.md). Keep `draw` cheap so I2S audio does not underrun (slow/gappy speech, clipped welcome); see **Keep audio fed** in that README.
- **Secrets** — no `.env`, tokens, or Wi-Fi passwords in logs or screenshots.

## KiCad / PCB review
Expand Down Expand Up @@ -121,6 +122,7 @@ Contribute/review process: [docs/pcb.md](docs/pcb.md). `expected-nets.yml`: [doc
| Drive robot from any IDE | [docs/integration.md](docs/integration.md) |
| Settings layers | [docs/settings.md](docs/settings.md) |
| Servo axes / ranges | [docs/robot-movement.md](docs/robot-movement.md) |
| OLED eye styles / audio underrun | [src/display/eyes/styles/README.md](src/display/eyes/styles/README.md#keep-audio-fed-i2s-underrun) |
| Tests | [docs/testing.md](docs/testing.md) |
| PCB / KiCad | [docs/pcb.md](docs/pcb.md) |
| Humans contributing | [CONTRIBUTING.md](CONTRIBUTING.md) |
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ Pick a path. Depth lives in the linked pages.
| **Share a finished build** | [Show and tell](https://github.com/jamro/tiny-engineer/discussions/categories/show-and-tell) — [how to post](../CONTRIBUTING.md#share-your-build) |
| **Public landing content** (tinyengineer.dev `/`) | [`web/landing-page.md`](../web/landing-page.md) — messaging brief; visuals in [`web/STYLE.md`](../web/STYLE.md) |

Also: [robot-movement.md](robot-movement.md) (servo axes and safe ranges); optional [macos-lock-unlock.md](macos-lock-unlock.md) (sleep/wake on Mac screen lock).
Also: [robot-movement.md](robot-movement.md) (servo axes and safe ranges); optional [macos-lock-unlock.md](macos-lock-unlock.md) (sleep/wake on Mac screen lock); OLED eye styles / avoid I2S underrun when adding a face: [`src/display/eyes/styles/README.md`](../src/display/eyes/styles/README.md).

**Source of truth:** pin constants in firmware (`include/pins.h`); electrical detail in `docs/hardware/`; HTTP shapes in [api.md](api.md). Overall build order: [getting-started.md](getting-started.md).
10 changes: 7 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ curl http://tiny-engineer.local/settings
| `lcd1602_line1` / `lcd1602_line2` | Configured boot lines when `lcd1602_boot` is `config` (max **64** bytes each, no C0 control bytes, default empty). Persists when off. Applies **immediately** |
| `continuous_timeout` | Minutes a continuous animation (`typing` / `reading` / `thinking` / `talking` / `waiting`) may run before the firmware switches to `attention` then idle (default **5**) |
| `loading` | Boot loading screen: `progress` (bar + large IP for 3 s) or `sleep_inertia` (eyes wake; no bar/IP). Default **`progress`**. Applies on **next reboot** |
| `eyes_style` | OLED eyes look: `classic` (procedural rounded eyes), `kaomoji` (animated faces), `cover` (full-half bars for an eye-hole mask), `dots` (12×12 circles), or `kawaii` (round eyes with big moving pupils, a talking mouth, and blush). Default **`classic`**. Applies **immediately**. Classic, cover, and dots sequences are described under [`POST /anim`](#post-anim); kaomoji face mapping is under [Kaomoji eyes](#kaomoji-eyes); cover drawing is under [Cover eyes](#cover-eyes); dots drawing is under [Dots eyes](#dots-eyes); kawaii moods are under [Kawaii eyes](#kawaii-eyes) |
| `eyes_style` | OLED eyes look: `classic` (procedural rounded eyes), `kaomoji` (animated faces), `cover` (full-half bars for an eye-hole mask), `dots` (12×12 circles), `kawaii` (round eyes with big moving pupils, a talking mouth, and blush), or `evil` (solid white scowling silhouettes). Default **`classic`**. Applies **immediately**. Classic, cover, and dots sequences are described under [`POST /anim`](#post-anim); kaomoji face mapping is under [Kaomoji eyes](#kaomoji-eyes); cover drawing is under [Cover eyes](#cover-eyes); dots drawing is under [Dots eyes](#dots-eyes); kawaii moods are under [Kawaii eyes](#kawaii-eyes); evil drawing is under [Evil eyes](#evil-eyes) |
| `access_token_set` | `true` when a non-empty access token is stored (secret itself is never returned) |
| `link_mode` | `""` unprovisioned, `"wifi"`, or `"usb"` (connection mode; see [`serial.md`](serial.md)) |
| `wifi_configured` | `true` when at least one WiFi network is saved |
Expand Down Expand Up @@ -290,7 +290,7 @@ curl -X POST "http://192.168.4.1/settings" \
| `lcd1602_line1` / `lcd1602_line2` | string | Boot lines for `config` (max **64** bytes, no C0 control bytes) |
| `continuous_timeout` | integer | 1–1440 minutes (positive) |
| `loading` | string | `progress` or `sleep_inertia` |
| `eyes_style` | string | `classic`, `kaomoji`, `cover`, `dots`, or `kawaii` |
| `eyes_style` | string | `classic`, `kaomoji`, `cover`, `dots`, `kawaii`, or `evil` |
| `access_token` | string | 0–64 printable ASCII, no space at either end; empty string clears the token and disables auth. Setting or rotating a non-empty value disconnects WebSocket `/events` subscribers (they must reconnect with the new token); clearing does not |
| `link_mode` | string | `wifi` or `usb`; setup Connection step uses `usb` for USB-only; Wi-Fi mode is usually set when saving networks via [`PUT /settings/wifi`](#put-settingswifi) |
| `servo_mins` | integer array | Five integers `0`–`180` (`head, neck, left, right, body`); setup AP only; must be sent with `servo_maxs` |
Expand Down Expand Up @@ -743,7 +743,7 @@ curl -X POST "http://tiny-engineer.local/anim?name=none"
{ "ok": true, "animation": "typing" }
```

Eye detail below for `eyes_style=classic` (default). With `eyes_style=cover`, the same sequences drive full-half bars ([Cover eyes](#cover-eyes)). With `eyes_style=dots`, the same sequences drive 12×12 circles ([Dots eyes](#dots-eyes)). With `eyes_style=kawaii`, the same sequences move and blink a kawaii face whose expression follows the animation and whose mouth says the voice clips ([Kawaii eyes](#kawaii-eyes)). With `eyes_style=kaomoji`, faces follow [Kaomoji eyes](#kaomoji-eyes) instead of procedural blinks, glances, flicker, or X eyes. Servo/audio behavior is the same for every style.
Eye detail below for `eyes_style=classic` (default). With `eyes_style=cover`, the same sequences drive full-half bars ([Cover eyes](#cover-eyes)). With `eyes_style=dots`, the same sequences drive 12×12 circles ([Dots eyes](#dots-eyes)). With `eyes_style=kawaii`, the same sequences move and blink a kawaii face whose expression follows the animation and whose mouth says the voice clips ([Kawaii eyes](#kawaii-eyes)). With `eyes_style=evil`, the same sequences drive solid white scowling silhouettes ([Evil eyes](#evil-eyes)). With `eyes_style=kaomoji`, faces follow [Kaomoji eyes](#kaomoji-eyes) instead of procedural blinks, glances, flicker, or X eyes. Servo/audio behavior is the same for every style.

Durations and quoted lines below are the stock clips in [`assets/`](../assets/). A filesystem built with `custom_audio_mod` can replace some of those WAVs. Phrase timing then follows that clip's `.cue` file on LittleFS (`/welcome.cue` and the same pattern for `attention`, `error`, `abort`, and `dead`). See [flash.md](flash.md).

Expand Down Expand Up @@ -790,6 +790,10 @@ When `eyes_style=cover`, each eye is a solid white rectangle filling one half of

When `eyes_style=dots`, each eye is a filled circle. At the classic open height the circle’s bounding box is 12×12 px, centered on the classic eye. Diameter scales with rendered height (`12 * height / 14`), so blinks, squints, wide looks, and the `dead` flicker shrink or grow the dots. Height 0 draws nothing (full blink or sleep close). Glance, scan, and look-up/down move the circle with the classic center. The `dead` X hold draws X marks in 12×12 boxes at those centers. Diameter is capped at the 32 px panel height.

#### Evil eyes

When `eyes_style=evil`, each eye is one solid white filled silhouette on black (no pupil, iris, outline, or separate brow stroke). The outer corner ends in a sharp tip higher than the rest of that eye; the inner corner sits lower and stays rounded. The top edge has a concave brow notch (scowl); the bottom edge is a smooth convex curve. Left and right are horizontal mirrors. At the default open pose the gap between the inner corners is roughly half an eye width. Animations keep the classic pose and blink timing: height tracks the rendered classic eye (closed height draws nothing), glances move both silhouettes with the classic centers, and the look stays menacing for every mode. The `dead` X hold draws X marks in boxes centered on those eyes instead of open silhouettes.

#### Kawaii eyes

When `eyes_style=kawaii`, each eye is a round eye about 23 px across with a big dark pupil and white catch-lights in it (one round light and two small dots). A small mouth sits between the eyes, with dithered blush under the outer corners. The classic pose still drives position, height, glances, and blinks, and the pupils look where its glances point: at the task or the human, up while thinking. Two animations lead the eyes themselves: `typing` reads code instead of following the typing jitter, and `ring` keeps the eyes full size instead of the classic small circles. Moods change pupil size (small when surprised or angry, large when sad). A pupil otherwise keeps its size: lids, smiles, and blinks cover it like eyelids, and a white rim always stays around it. A closed eye draws a `‿` lid line (`∩` while smiling). Each animation picks a mood, and the face eases into it. Eye size, happy crescents, and mouth opening use springs with a little overshoot. Shape changes that cannot morph (round eyes to `> <`, `x x`, or hearts) happen behind a quick blink.
Expand Down
2 changes: 2 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ python3 scripts/test_audio_pack.py

The optional [expression library](../lib/TinyEngineerExpressions/README.md) has deterministic asset checks and native renderer tests. These checks require Node 18+ and PlatformIO; they do not access hardware. On the robot, enable those faces with Config / `eyes_style=kaomoji` (default remains `classic`).

Adding a procedural `eyes_style` (not only kaomoji assets): keep the OLED `draw` cheap so welcome/attention audio does not underrun — [Keep audio fed](../src/display/eyes/styles/README.md#keep-audio-fed-i2s-underrun).

```bash
node scripts/expressions/generate.js --check
node scripts/expressions/test-assets.js
Expand Down
2 changes: 2 additions & 0 deletions openspec/changes/evil-eyes-style/.openspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-20
55 changes: 55 additions & 0 deletions openspec/changes/evil-eyes-style/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Design

## Context

See proposal.md — Why. Eye styles plug in via `EyeStyleRenderer` (`styles/*.cpp` → `registry.cpp` + `eye_style_ids.cpp`). Pose/blink live in `display/eyes/core`; `dots` is the closest precedent: `needsPoseUpdate` + `needsBlink`, paint from `renderEye` + `blinkOpenAmount`, dead X via `drawDeadXEyes`. Settings validate uses registered ids only. Config `EYES_STYLES` and `docs/api.md` list the strings.

Canonical open look (from the reference silhouette): solid white filled shapes on black — pointed high outer tips, lower rounded inners, concave brow notch on top, smooth convex bottom, mirrors, no pupil/outline. Earlier pupil-notch frames are out of v1 scope.

## Goals / Non-Goals

**Goals:**

- Ship `evil` as a sixth registered style with dots-tier motion coupling
- Procedural draw that reads as the reference on 128×32
- Keep settings / HTTP / UI / docs in sync in one change

**Non-Goals:**

- New `POST /anim` names or servo/audio variants
- Kawaii-style mood director or kaomoji expression remap
- Bitmap/RLE asset pack or flash-heavy frame library
- Per-mode geometry redesigns beyond height/position from classic pose

## Decisions

### D1. Style id `evil`
Short, matches the persona, fits NVS/JSON string lists. Alternatives `menace` / `scowl` rejected as vaguer.

### D2. Follow dots architecture
One `drawEvil` in `styles/evil.cpp`, `kEvilEyeStyle` with `needsPoseUpdate`/`needsBlink` true. Scale/place a mirrored polygon (or filled path) from each rendered `Eye`. Height ≤ 0 → skip draw. Dead X hold → `drawDeadXEyes` on boxes centered like dots. Alternatives: static full-screen bitmap (no glance/blink fidelity); kawaii mood stack (overkill for “always evil”).

### D3. Procedural geometry, not assets
Encode swoosh as polygon / triangle fan / mask scaled to the eye box so blinks shrink cleanly. Pixel-perfect PNG copy deferred unless procedural fails visual check on device. Alternative: host-generated masks like expression RLE — more pipeline, unnecessary for one shape.

### D4. Docs and gallery in the same change
Update `docs/api.md`, UI ApiReference, Config select, styles README. Add a `web/eyes` card + preview path (cover stays optional/hidden). Keeps “list evil” requirement honest for the public gallery.

### D5. No settings schema version bump
New enum member only; unknown old firmware ignores / rejects; new firmware accepts. Factory default stays `classic`.

## Risks / Trade-offs

- [Swoosh hard to fill with Adafruit primitives] → Start with triangle/polygon fill or row-scan inside the eye AABB; fall back to a small PROGMEM mask if jagged
- [Look too soft when height-scaled during blink] → Prefer vertical squash of the same outline over morphing to classic ovals
- [Preview JS drifts from firmware] → Approximate like other styles; note gallery is not a C++ port
- [Flash/CPU on fill] → Profile against dots; keep fill bounded to eye boxes only

## Migration Plan

- Flash firmware that includes `evil`; set via Config or `POST /settings {"eyes_style":"evil"}`
- Rollback: flash prior firmware, or set another style; orphaned `evil` in NVS → validate fails on old builds that only know five ids — user re-selects a known style (same as any unknown style string)

## Open Questions

- Exact polygon control points vs on-device tweak after first flash (does not change requirements)
32 changes: 32 additions & 0 deletions openspec/changes/evil-eyes-style/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Proposal

## Why

Users can pick classic, kaomoji, cover, dots, or kawaii OLED faces, but nothing matches a sharp, always-menacing “evil eyes” look. A sixth `eyes_style` lets the desk robot wear that persona without new animation names or servo/audio changes.

## What Changes

- Add `eyes_style` value **`evil`**: solid white scowling silhouettes (pointed high outers, rounded low inners, concave brow notch, convex bottoms; no pupils), mirrored left/right on the 128×32 OLED
- Reuse the classic eye pose pipeline for blinks, glances, height, sleep close/open, and dead X — same motion language as `dots`, different paint
- Always look evil for every `EyeMode` / `POST /anim` (no cute moods, no kaomoji face table)
- Wire the id through settings validate, style registry, Config UI, API docs, and (optionally) the public `/eyes` preview gallery
- Default stays `classic`; existing saved styles unchanged

## Capabilities

### New Capabilities

- `evil-eyes`: OLED face style `evil` — registration, look, and how it tracks classic pose / blink / sleep / dead

### Modified Capabilities

- (none)

## Impact

- Firmware: `src/display/eyes/styles/` (new renderer + registry / `eye_style_ids`), settings validate already keyed off registered ids
- HTTP/settings: `eyes_style` accepts `evil`; GET/POST unchanged otherwise
- Web UI Config select; `docs/api.md` + `ui` ApiReference param lists
- Marketing gallery `web/eyes/` + preview JS (same pattern as dots/classic)
- Tests: `pio test -e native` eyes-style validate; `pio run` after style code
- No new `/anim` names, packages, NVS key rename, or flash-size asset pack (procedural draw preferred)
Loading
Loading