Repository navigation
Firmware: sync upstream (I2C recovery, kawaii eyes, actions) + this robot's servo map - #3
Merged
Merged
Conversation
Co-authored-by: Andre <24884291+AndreLYL@users.noreply.github.com>
- Revised the 3D printing section in README.md to clarify that users can either print parts themselves or order them from a provider. - Enhanced the 3D model (screw thread reduced from 2.2mm to 2.1mm) - Introduced new aggregated part sets (PartsSetA.3mf and PartsSetB.3mf) for easier ordering. - Updated all stl/3mf/step files
Adding a bulge on one side of the neck component to facilitate correct orientation of the part during assembly
…amro#15) Census of the shipped sg90 meshes (~2.1 mm pilots): 27 screw locations across 11 parts. Shopping list: ~30x M2x6 + ~5x M2x12 pan/button head. Notes that the 5 deep chest channels are servo-wire routing (not screws) and only the head ships servo-tab pilots. Co-authored-by: Pip <pip@muse.ai>
* docs: add assembly guide documentation * docs: align documentation with assembly guide * docs: enhance assembly guide with detailed build steps and clarifications * docs: update assembly guide with visuals * docs: revise assembly and build path documentation for clarity and interleaved steps
- Added options to export selected PRINT_LAYOUT children in multiple formats (3MF, STL, STEP). - Introduced a command dialog for selecting servos and formats during export. - Improved error handling in servo parameter application to provide user feedback. - Updated documentation to reflect changes in export functionality and user interaction.
…idle behavior - Added a delay for releasing PWM signals after servos are idle or in sleep mode, ensuring servos go limp after a specified duration. - Updated the animation controller to ensure all servo outputs are activated when transitioning from the 'none' animation. - Introduced functions to track servo movement and manage PWM release, improving overall servo control and responsiveness. - Enhanced documentation to reflect changes in servo behavior during idle and sleep states.
…ed documentation - Added `dead.wav` audio playback for the out-of-power state, enhancing user experience. - Updated animation logic to handle the new dead state, including servo collapse behavior. - Modified documentation to reflect changes in the `dead` animation and its requirements. - Included `dead.wav` in asset management scripts and ensured proper integration in the animation controller.
Adds a 26x44mm fabricatable carrier PCB sized to the real enclosure, routing power, I2C, I2S, servo, OLED, PCA9685, MAX98357A, and USB D+/D- fully on-board. --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Adds a main control PCB with goldpin headers for stacking all components, reducing wiring and simplifying assembly. The board is too bulky for smalest servos, but works well with SG90-based setups. Includes KiCad design files, validation checks, documentation, and a JLCPCB BOM The PCB can be ordered either fully assembled or as a bare board for manual assembly.
- Added a new eye style called 'cover' that displays full-half bars for a mask with eye holes, enhancing visual options. - Updated documentation to reflect the new eye style and its behavior. - Modified related settings and validation to support the new style in the configuration. - Ensured compatibility with existing eye styles and updated UI elements accordingly.
…CAD modifications
Deleted obsolete audio files form data folder
- Introduced a new eye style called 'dots' that displays 12×12 filled circles, enhancing visual options for the OLED display. - Updated documentation to include the new eye style and its behavior. - Modified settings and validation to support the new style in the configuration. - Ensured compatibility with existing eye styles and updated UI elements accordingly.
…amro#97) * fix(web): prevent Object URL memory leaks in laptop screen generator * fix(web): revoke object URL immediately on successful image load * fix(web): ignore stale image loads before updating preview
…amro#98) * fix(web): handle image loading failures in laptop screen generator Clear the previous image when a new file is picked, and report decode failures and non-image files in the status line. The PDF download stays disabled until a valid image loads. Fixes jamro#95 Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com> * fix(web): allow re-picking the same image after a failed one Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com> --------- Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
* feat(scripts): extract assembled part placements from the Fusion design Read every occurrence's solved transform from 3d_models/cad/TinyEngineer.f3d (via ezf3d, no Fusion needed) and combine it with the PRINT_LAYOUT transform to take each exported STL from its print pose to its assembled pose. Servos, OLED and the main control board are tessellated from the design's own bodies. Every placement is checked against the exported SG90 STLs and the named joints; the run fails otherwise. build_glb.mjs packs the result into one GLB. CI job 'assembly' builds it and uploads it as an artifact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): add 3D assembly viewer with per-part colours New /assembly/ page on GitHub Pages: the SG90 robot built from the printed meshes, with a colour per part or per print set (filament palette or custom), click-to-select, explode, an electronics toggle and shareable colour links. The Pages workflow builds the model with scripts/assembly on deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): add step-by-step build mode to the assembly viewer 41 steps in 19 sections following docs/3d/assembly.md: each shows the robot so far, slides the new parts in, frames them, and lists screws, the section photo and a link to the guide. Play, arrow keys, section outline, #s= links. CI checks that the steps add every part of the extracted model once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): animate the servo joints in the assembly viewer Rig the five servo joints on their shafts (axis and pivot from each servo's placement in the model): body -> neck -> head, body -> hands. Sliders in the firmware's -1..1 pose scale, a selectable range, and loops built from the firmware's pose constants (typing, talking, ring the bell, wave). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(mods): show the Halloween mod in the assembly viewer extract.py --mod reads the mod design's own parts (checked against its STLs); merge_mod.mjs lines them up with the stock robot per web/assembly/mods/ halloween.json (shared Head frame, lamp on the stock lamp's axis, cauldron on the mug's spot, pumpkin prop by the desk), swaps Mug/Coffee for Pot/Mixture and drops Hat. The viewer gets a Model switch (#m=halloween) with the mod's colours and build steps. build.sh builds stock and mods for CI and Pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): stage sub-assemblies in the assembly viewer's build steps A step can now move parts added earlier (`move`): until that step they wait at its offset, summed with any later moves, so a sub-assembly is built where it waits and is mounted in one piece (the head onto the chest, the body onto BellyJoint, the desk onto the chair). offsetsAt() gives every part's offset at a step for both the viewer and the clipping check. Steps and mods can declare overlaps the check lets through (`fits`, a step's `allow`); mods map their ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(scripts): check the assembly viewer's build steps for clipping parts check_clipping.mjs walks every moving part along its path in 1 mm steps and measures how deep it goes into each part shown, then checks the finished robot pair by pair. Depth is measured on the meshes (surface samples tested inside the other part through a BVH, depth = distance to its surface), so faces that only touch pass. Reports step, part pair, depth and where along the move. No dependencies; build.sh runs it for stock and every mod. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): build the robot in the viewer without parts clipping Follow docs/3d/assembly.md as sub-assemblies: head and neck are built apart and joined, mounted on the chest, the body lowered onto BellyJoint in the chair and the seats pushed in, and the desk with its electronics and props slid up to the chair. Parts drop into open pockets from above (OLED, servos, hat), the laptop screen slides along the lid and the forearms come in from the front. The neck yoke and the control board need a flex or tilt the viewer cannot show: their steps declare it. In the Halloween mod the pumpkin goes on after the head is mounted. Before: 24 clipping problems (stock), 34 (Halloween). Now none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): run the assembly clipping tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): deploy pull requests to the fork's GitHub Pages as a preview The pull_request trigger is for this fork only. A guard job fails every pull request run on purpose, so the trigger is not merged upstream by accident; the deploy job does not depend on it and still deploys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scripts): mount the assembly model's arms at shoulder height The design is saved with the hands raised about 30° above the shoulders. The guide mounts each arm with the hand at shoulder height and the forearm pointing forward at 90° (assembly.md step 18). The extractor now turns each arm 29° down about its servo shaft after the placement checks. The elbow approach turns with the arm. The arms are built further out, so the Halloween lamp is clear of them, and the mod declares the left hand's tilt over that lamp while the arm is pressed on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): ring the bell with the hand in the assembly viewer The ring loop turned the body only a third of the way, so the right hand came down beside the bell. It now follows the firmware's sequence: body fully right, right hand up, a fast strike that stops on the bell (RING_RIGHT_HIT, where the hand meets it at the viewer's ±25°), a bounce to -5/9, then the hand lifts again. The head looks down at the bell during the strike. The joint table moves to poses.js (no three.js), so Node can use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(scripts): check the assembly viewer's poses and animations for clipping check_poses.mjs turns the parts about the servo shafts as the viewer does. It checks moving pairs on the meshes at 90°, at rest and every 0.1 s through each animation loop, and checks that the ring strike lands the right hand on the bell. build.sh runs it for stock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(scripts): add the ESP32-C3-Zero to the assembly model The module is not in the Fusion design. Its mesh is canfactory's drawing of the Waveshare board: castellated PCB, USB-C, BOOT/RESET buttons, LED, chip, regulator, crystal and antenna, in their own colours. It is exported with canfactory_board.ts, and the colours are stored in the STL's attribute bytes. build_glb.mjs turns them into COLOR_0. The extractor seats the module on MainControlBoard's socket stack, which it finds in the board's mesh, with the 5 V column in J7 (expected-nets.yml). That puts RESET under LampButton and the LED on the lamp's axis. The build step that seats it now adds it, and it moves with the desk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): show the ESP32-C3-Zero in its own colours in the assembly viewer A mesh with vertex colours keeps them; the module's default tint is white. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): strike the bell where each servo preset's hand meets it The hand meets the bell at a different angle in each preset's robot: -0.97 at SG90, -0.88 at FS0307 and HD-1370A, -0.96 at ES9051. The ring loop takes the preset, and check_poses.mjs reads it from the manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(scripts): build the assembly model at every servo preset The design is saved at SG90 only. presets.py places the robot at FS0307, ES9051 and HD-1370A the way Fusion does: by following the design's joints outward from the body servo. - Servo-side frames come from servos.json. - Frames on printed parts move with the feature they sit on, found in each preset's STEP exports. - The chest's servo pack is placed by its contacts with the chest. Validated against the design's history: from the design saved at SG90 (268ad4b), it reproduces the design saved at FS0307 (22afc31) to 0.001 mm, and also the other way round (test_presets.py --history). build.sh builds and checks every preset: steps, clipping, poses, and check_contacts.mjs, which checks that parts touching in the SG90 robot still touch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): switch servo presets in the assembly viewer A Servo switch (#p=fs0307) loads models/<preset>.glb. Mods are built for SG90 only, so the other presets are disabled while a mod is shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): rebuild Pages when any servo preset's parts change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(scripts): place the M2 screws and nuts in the assembly model fasteners.py finds every screw of the screw list in the parts' STEP hole stacks at each servo preset and adds it, with nuts, to assembly.json; a count that does not match fails the build. The preset servo mesh gets its tabs' screw holes, and the step and pose checks take the fasteners in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): show screws and nuts in black or silver in the assembly viewer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): run the fastener tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe the screws and nuts of the assembly model Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(scripts): stage the print files for the GitHub Pages site Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): download the shown robot's print files as a ZIP Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): stage the print files on the Pages deploy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe the print file download Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(scripts): show the main control board from its KiCad design, with the ESP32's pin headers main_control_board.py reads main-control-board.kicad_pcb (no KiCad needed) and writes the rev 3 board with its parts, registered to the design's simplified board by the mounting holes and socket rows, and the two 1x9 male headers under the ESP32-C3-Zero. The board hangs from the headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): solder the ESP32-C3-Zero's pin headers and plug them into the board in the build steps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): run the main control board mesh tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe the KiCad board model and soldering the ESP32 headers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scripts): draw the ESP32-C3-Zero in boards.py and share one mesh module meshes.py holds the triangulation, prisms, solids of revolution and the STL writer that boards.py, fasteners.py and the preset servo used to repeat. boards.py (was main_control_board.py) also draws the ESP32-C3-Zero from Waveshare's drawing, so the external exporter goes. matrix_of lives next to column_major, and the ESP32 pin grid is defined once. Every placement is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scripts): resolve mesh paths and load steps in one place Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(web): share the viewer's link and storage settings and its selected-pill style Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): run test_boards.py Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: tidy the assembly model docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): redeploy the Pages preview Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): remove the fork preview guard job Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ci): stop deploying Pages previews from pull requests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(web): implement interactive shopping cart for servo selection and JLCPCB ordering * feat(fab): automate JLCPCB manufacturing package generation for main control board * refactor(web): update text and structure across various pages for clarity and consistency * feat(print): implement print queue page with live STL previews and dual-format downloads * feat(print): add print queue page with structured JSON data, live STL previews, and dual-format downloads * refactor(web): update build guide stages and navigation for beginner-friendly flow * feat(web): enhance board preparation guidance with 3D walkthrough for ESP32 installation * refactor(web): enhance print layout and styling for improved usability and visual consistency * feat(web): enhance setup page with mobile-friendly instructions and interactive setup flow * docs: update main control board documentation to clarify testing status and ordering process * docs: simplify screw specifications in 3D models and shopping documentation * docs: update jumper wire specifications in getting started, shopping, and assembly documentation * fix(scripts): add explicit error handling in export_main_control_board.sh to ensure robust file operations * fix(scripts): refine zip file filtering in export_main_control_board.sh and run_fabrication_toolkit.py to avoid excluding valid files * refactor(web): wrap smooth scroll behavior in media query for reduced motion preference on shop and print pages * fix(web): improve servo selection functionality with keyboard navigation and focus management * refactor(web): add vendor libraries for three.js and esp-web-tools with automated packaging script * fix(web): clarify servo selection summary on shop page to include robot size indication * fix(web): update three.js vendor libraries to include core module and enhance packaging script * fix(web): remove touch-action property and add comment for pointer-events in button styles * fix(web): update camera pose handling on resize to prevent incorrect home position after user movement * fix(web): add three.js ESM entry to .gitignore and include core module in vendor directory * chore(web): update REUSE.toml with new annotations for Lit and add BSD-3-Clause license file; modify navigation links and clipboard copy functionality in HTML files * refactor(web): consolidate clipboard copy functionality into a separate script and update page classes for build consistency * refactor(web): simplify servo validation logic and enhance file download handling in print queue * chore(web): update REUSE.toml to include new annotations for esptool-js and its dependencies, specifying copyright holders and licenses * fix(scripts): redirect download message to stderr for better visibility during toolkit download * chore(licenses): add Apache 2.0, MIT, and zlib license files to the project * feat(copy-button): enhance copy functionality with error handling and user feedback
* doc(extension): document push-button extension: implement outbound event hub and button event publishing, including new settings and UI controls * feat(firmware): add push-button extension add settings, outbound event hub, and WebSocket support for button events; update documentation and hardware references * refactor(push-button): enhance button event handling and WebSocket integration * feat(api): enhance access token handling and WebSocket disconnection * Updated API documentation to clarify that setting or rotating a non-empty access token will disconnect current WebSocket subscribers, requiring them to reconnect with the new token. * Implemented a new function to disconnect all WebSocket clients upon access token rotation. * Modified settings handler to invoke the disconnection function when the access token is changed. * docs(firmware): update specs with push-button extension with outbound event hub * feat(firmware): implement gesture recognition for button events (click, double_click, long_click) * feat(firmware): add configurable push-button pin and update documentation * feat(firmware): add click sound effect and configurable sound settings * style(ui): add code block styling to enhance readability * feat(cad): add extension cables tunnels * feat(mod): add bell button 3d models with README documentation * chore: remove obsolete appstate and telemetry JSON files * chore: add .pio-home to .gitignore for platform.io configuration * feat(cli): introduce host daemon for serial command management - Added a new `tiny-engineer daemon` command to manage serial connections, allowing multiple CLI commands to share a single serial port. - Updated documentation in `docs/integration.md` and `docs/serial.md` to reflect the new daemon functionality and its lifecycle. - Implemented IPC for the daemon using a local socket, ensuring that commands like `anim`, `play`, and `monitor` communicate through the daemon instead of opening their own serial connections. - Enhanced the pre-upload process to park servos and manage port access during firmware uploads. - Introduced new specifications for the daemon's behavior and requirements, ensuring compatibility with existing commands and transport configurations. * feat(events): implement percent-decoding for token query values * refactor(cli): migrate serialRequest to daemon and update imports * feat(mod): update 3D model of bell button and add new STEP/STL/3MF files for components * feat(cli): add CLI daemon * fix(docs): update settings endpoint documentation to include new push button sound parameters * docs(mod): update button preview by real photo * fix(cli): ensure proper session handling on close in serial link * fix(cli): update token handling in eventsWebSocketUrl to use search string format * feat(cli): introduce host event reactions with user-defined rules for outbound events * refactor(firmware): enhance sound event handling and documentation for button interactions * fix: correct formatting in ApiReference documentation for sound event parameters * refactor(cli): update daemon commands and documentation to deprecate 'stop' in favor of 'release' * refactor(cli): allow daemon replacement during active play, aborting the play and updating documentation * refactor(cli): implement immediate rejection of IPC requests on socket close or error * refactor(cli): optimize source identity handling by memoizing hashes and skipping content hashing for npm channel * refactor(cli): untangle CLI events transport by creating shared modules for events URL and transport handling * refactor(cli): implement serial port probing via host daemon, preserving candidate order and avoiding cache writes * docs(mod): add assembly guide and visuals for Bell button mod * refactor(cli): enhance serial link management by introducing session generation control and improving connection handling * refactor(cli): add post-upload script to resume daemon and improve serial reaction handling
…ommands and usage instructions
* feat(firmware): add kawaii eye style Add `eyes_style=kawaii`: round eyes with sparkle highlights, a small mouth between them, and dithered blush under the outer corners. - Parametric face renderer (eye shape, lids, happy crescents, mouth, blush, twinkles) so every feature eases between moods; springs give eye size, smiles and mouth opening a little overshoot - Shape swaps that cannot morph (> <, x x, hearts) happen behind a blink - Idle personality: mostly smiles, with occasional grins, winks, excitement, and rare heart eyes - Each animation maps to a mood; talking opens the mouth with speech loudness from /play - Classic pose, glances and blinks still drive position and openness - Renderer and animator are Arduino-free and covered by native tests - Register the style id, Config select option, API docs and web UI API page * feat(firmware): animate kawaii talking mouth and refactor style The kawaii mouth only moved with /play audio, so a plain `POST /anim talking` showed a still smile while the head and arms moved. Each syllable now opens the mouth into an "ah", "ee" or "o" shape and then returns to a small resting smile. With audio, loudness sets how far it opens and each syllable onset picks a new shape. Without audio, it babbles in short phrases with pauses. Also, from the review: - split mood.* into expression, animator, idle, speech and compose modules, with shared helpers in util.h - name every tuning value; idle accent odds and vowel shapes are tables with compile-time checks - break up drawRoundEye, drawMouth, drawKawaii and the animator's shape-swap blink to cut cognitive complexity - remove the static scratch buffer from render(); the eyes now clear their own gap around the blush, so render() keeps no state - rename test_kawaii_face to test_kawaii and add tests for vowel shapes, babble rhythm, millis wrap, audio follow and render purity - document kawaii in the dead and talking rows of docs/api.md - add kawaii/README.md with the module layout and tuning guide Every mood except talking renders pixel-identical to before. * fix(firmware): keep kawaii frames within the audio budget The welcome clip clipped with kawaii eyes. Audio clips and eye drawing share loop(): each pass feeds 23 ms of audio, and the refactor's two-pass blush gap made a welcome frame (Excited at the welcome pose) cost about 2.45 M instructions on the C3. With the ~12 ms OLED push, that overran the budget. - Draw each eye once; blush picks its dots against the finished eyes before drawing any, so render() still keeps no state - Draw eyes, lids, carve, sparkle holes and > < / x x strokes as per-row runs: only edge pixels are tested in float, with the exact original test, so output is unchanged - Precompute blush and heart terms per row or column, hoist loop bounds, skip the mouth wobble when there is none - Cache the animator's easing weights per frame time A welcome frame now takes about 510 k instructions (1.15 M before the refactor). Every mood renders pixel-identical. The frame budget is documented in kawaii/README.md. * fix(anim): close scripted welcome and attention blinks in the middle The scripted blinks in the welcome and attention eye modes had their easing upside down: blinkT runs 0 → 1 → 0 across the window, and open = ease(blinkT) snapped the eyes shut at the start, opened them in the middle, shut them again, and snapped them open at the end. At 33 ms frames the 100 ms welcome blink after "Hello, human" showed as shut → open → half shut → open, a visible flicker (most obvious with round kawaii eyes). Use ease(1 - blinkT) so each window is one blink: open at the edges, closed in the middle. * fix(firmware): show the kawaii lid line for nearly shut eyes A round kawaii eye squashed to a couple of pixels drew as a flat bar, which reads as a glitch rather than a blink. Draw the closed "‿" lid line once the eye is flatter than 0.22 of its width radius, compared with the width because scripted blinks squash the pose height itself. Only the deepest blink frames change. * feat(firmware): give kawaii eyes moving pupils The dark sparkle holes read as pupils on the robot, so make them real pupils: a dark disc that looks where the eye choreography points (the task or the human, down at the keyboard while typing, up while thinking), with a white catch-light inside it that cannot be mistaken for a second pupil. - Gaze comes from the shared eye-mode glances; moods add their own pupil size and look (small when surprised or angry, big and looking down when sad) - The pupil keeps a rim of eye around it: when a lid, tilt, smile or blink leaves no room where it looks, it slides toward the middle, then shrinks, so the eye outline never notches - Gaze eases quickly, like a saccade - Tests cover the catch-light, gaze direction, the rim under lids and smiles, and no pupil in a full ^ ^ smile * feat(firmware): give kawaii eyes big moving pupils Replace the dark sparkle holes, which read as small pupils, with big dark pupils that look where the robot is looking, and white catch-lights inside them (a round light and two dots) that cannot be mistaken for a pupil. - Gaze follows the shared eye-mode glances (the task or the human, up while thinking); moods set pupil size and their own look - Pupils keep one size: lids, smiles and blinks cover them like eyelids, a 2 px rim always stays white, and centers snap to whole pixels so a moving pupil never changes shape - Typing reads code: a few lines word by word, then a dart to another spot, instead of following classic's typing jitter - Thinking follows its glances halfway, for a calmer look aside - Gaze glides (150 ms); catch-lights no longer pulse - Discs centered on pixels precompute their rows: a welcome frame drops to ~420 k instructions on the C3 - Tests cover gaze, constant pupil size, the rim under lids and smiles, and the code-reading gaze * feat(firmware): add positive accents to kawaii typing, reading, thinking Working modes held one face the whole time. Give typing, reading and thinking the same personality idle has: mostly the working face, with a short accent now and then before settling back. - Typing: focused, with a pleased smile, a quick grin, or a wink; the eyes keep reading code through the accents - Reading: absorbed, with a pleased read or an "ooh, interesting" - Thinking: pondering, with an "aha!" (wide eyes looking up, glints, a hop, an open smile) - Accents come more often the longer work has gone well: the gap shrinks over ~90 s without an error, abort or dead, and resets on one - Generalize the idle director into MoodDirector with one personality table per activity; idle behaves as before - Add Pleased and Aha moods - Tests: working modes stay mostly on their base face with only their own accents, and going well brings more accents * feat(firmware): kawaii eyes mouth every voice clip and celebrate the bell The kawaii mouth now says the words of every stock voice clip in sync, and the bell gets a celebration instead of squashed surprised eyes. Spoken lines (keyed to each stock clip's loudness envelope): - welcome: "Hello, human. What are we building today?" - attention: "Psst... human... you might want to take a look." - error: "Uh-oh. Human, we have a problem." - abort: "Fine. I didn't want to finish it anyway." - dead: "Insufficient resources... shutting doooowwwnnn" Keyframes close the lips on p, b, m, t, d and k and hold pauses shut; tracks lead the audio by 40 ms. While a clip plays, the face uses the talking rest mouth. One Line table holds every track and its stock cue times; a custom clip with its own .cue gets syllable babble instead. Bell (ring): an eager wind-up, a burst of joy the moment bell.wav starts, bliss while it rings (^ ^ squeezed shut, blush, open smile, a delighted shiver), then a dreamy afterglow. The ring no longer squashes the eyes; without a bell clip the ding comes after 1.5 s. Adds Bliss and Afterglow moods and a quiver (shiver) parameter. * feat(firmware): build suspense before the kawaii bell, fade its shiver The bell's delighted shiver was hidden behind squeezed-shut eyes and stopped abruptly, and the wind-up before the ding had little to say. - Wind-up: eager, then suspense builds over 0.8 s and holds until the strike: eyes narrow onto the bell, the mouth holds its breath, and a nervous tremble grows - Bliss keeps the eyes open (soft happy eyes, big sparkling pupils), so the shiver shows for as long as bell.wav plays - When the ring ends, the shiver winds down over 500 ms, smaller and slower (14 Hz to 3 Hz), while the face blends into the afterglow - The shiver's phase now advances in the animator, so its speed can change without a jump - BellCelebration returns the face itself; Expression gains a blend() helper and quiverHz; adds a Suspense mood * feat(firmware): bell breath, yell, star burst, and ding-keyed pupil shake The bell's shake moved the whole eye, trembled through the wind-up, and ran for the full clip, including its silent tail. Rework the celebration around the ding. - Only the pupils shake, starting on the ding and following the stock bell.wav loudness (measured every 10 ms): hardest and fastest on the strike, fading and slowing to the last of the ring at ~1.4 s - Wind-up is a deep breath that deepens until the strike: the face rises, eyes widen, pupils tighten, cheeks flush, and the mouth draws in a growing "o"; the ding lets it out as an excited yell - Stars burst from the outer sides of the eyes on the ding and swirl off-screen, with trails that shorten as the bell fades - Adds the Yell mood, a breath "rise", per-eye pupil shake, and face sparks; the busiest bell frame is ~550 k instructions on the C3 - Docs: kawaii summaries, the lip-sync paragraph, the pose exceptions, and the frame budget brought up to date * fix(scripts): upload LittleFS to the same port as the firmware The post-upload hook runs `pio run -t uploadfs` as a child process, which does not inherit --upload-port. With more than one serial device plugged in, the filesystem upload auto-detected another port and failed after the firmware had flashed fine. Pass the port the firmware upload used ($UPLOAD_PORT, given or auto-detected) on to uploadfs. * fix(firmware): adapt randRangeMs to kawaii's exclusive RandRange anim::randRangeMs returns [lo, hi], but the kawaii modules expect RandRange's [lo, hi). Passing it straight through skewed the robot's rolls: winks favoured the right eye 2:1, a 0..100 odds roll could land on 100 and fall back to the first accent, and the code reader could read one line more than its maximum. - Add upperExclusive<>, which adapts an inclusive generator to [lo, hi), and use it at the firmware boundary for the mood director, babbler, and code reader - Cap the code reader's last word at the line end (found by the new worst-case test) - Tests: the adapter never returns hi, and every module stays in its bounds when fed the top of every range * perf(firmware): draw kawaii heart eyes within the audio frame budget Heart eyes cost ~1.2 M instructions a frame on the C3, over the 600 k budget that keeps audio fed. They are idle accents, but an idle face can be on screen during a /play stream with pose=none, which runs eye drawing between speaker writes. Draw each heart row from its edges instead of testing every pixel: the heart is symmetric, each half row is one run, and each row's edges are found by nudging the previous row's with the exact test. Output matches a per-pixel reference in 37,180 size and position cases. Hearts now cost ~475 k, so every kawaii frame fits the budget; the README says so and explains why any face can play during audio.
…ound and animation
* fix(firmware): detect and recover from I2C bus faults
A robot on v0.2.0-72-g946c02b froze with a dim display, dead servos and
a stuttering bell while the ESP32 kept running. Its serial log showed
i2c_master_transmit failing with ESP_ERR_INVALID_STATE every 60 ms, for
every write to the PCA9685 and the OLED. The Adafruit drivers ignore
failed writes and the firmware set both chips up only at boot, so it
never noticed and each failed write blocked the loop for its timeout.
Check both chips every 500 ms: the OLED must answer, and the PCA9685
must answer and still hold the prescale it was given, which also
catches a chip that lost power and came back with its defaults. Two
failed checks in a row count as a fault. While down, servo and display
writes are skipped so audio and HTTP keep running. Recovery restarts
Wire, clocks out a device left holding SDA, sets both chips up again
and rewrites every servo channel from the firmware's state; a failed
attempt is retried after 1 s, doubling up to 30 s. A PCA9685 that still
answers is left alone while only the OLED is retried.
Boot clears the bus the same way before Wire starts, for a reset that
lands in the middle of a transfer.
Each fault and recovery is logged with the bus line levels, and
GET /health reports i2c.ok, i2c.pca9685, i2c.faults, i2c.recoveries and
i2c.last_fault_ms. `oled` now goes false while the display is
unreachable.
Not yet run on a robot: host tests cover the fault and retry timing,
and both firmware environments build.
* fix(firmware): restore and watch the PCA9685 output mode
Bench testing the I2C recovery left a robot whose eyes animated while
its servos stayed still. The firmware saw nothing wrong: the PCA9685
answered, held its prescale and accepted every write. A register dump
taken before setup showed MODE2 at 0x10 (inverted, open-drain) where a
servo signal needs 0x04, so no usable pulse reached the servos.
The Adafruit driver never writes MODE2, and the chip keeps its
registers across an ESP32 reset, so the value survived every reboot and
every recovery. It was most likely written by a transfer corrupted
during fault injection, which forced SDA low mid-write; a real bus
glitch can do the same.
Write MODE2 as part of the PCA9685 setup, at boot and after a recovery.
Include MODE1's sleep bit and MODE2 in the health check, so a chip that
answers but lost its setup counts as a fault and is set up again. The
fault log line now carries the three register values.
On the robot: setup brought MODE2 back to 0x04 and the servos moved
again. Writing 0x10 by hand was caught after 0.9 s with
"pca9685=fail oled=ok mode1=0x20 mode2=0x10 prescale=0x79" and repaired
in 58 ms.
* fix(firmware): track each I2C chip on its own and guard the bus restart
An independent review of the I2C recovery found defects that the single
bus-wide tracker caused, and one hang.
- One tracker meant no checks while it was down. A chip that never came
back left the other unchecked for up to 30 s, so a later bus hang
could stall the loop again.
- An OLED fault always reset the PCA9685: outputs off, chip reset,
servos resynced.
- A failed Wire restart could hang the loop for good. Wire.end() drops
its buffers even when it fails, the next transfer then leaks Wire's
lock, and the following Wire.end() waits on that lock forever.
- The PCA9685 prescale reference was read back from the chip, so a lost
write at setup became the baseline, and a lost auto-increment bit
went unnoticed.
- Servo outputs were re-enabled before the setup was verified.
Give each chip its own fault tracker. The PCA9685's recovery redoes
only its setup when the chip still answers, and restarts the bus
otherwise; it then sets the OLED up again, since both share a supply.
The OLED's recovery never restarts the bus. Nothing uses Wire after a
failed restart until a later one succeeds. The PCA9685 check compares
against a computed prescale and requires auto-increment, and a restart
leaves the outputs disabled unless the setup reads back correctly.
GET /health now reports ok, faults, recoveries and last_fault_ms per
chip under i2c.pca9685 and i2c.oled. Serial lines name the chip.
Document the runtime checks in hardware/interfaces.md and add the
[i2c] lines to the troubleshooting table in hardware/testing.md.
On the robot, with a temporary injector: a held SDA line took both
chips down and both recovered after release; a corrupted MODE2 was
repaired in 55 ms with no bus restart; a display-only fault recovered
without touching the PCA9685. A healthy check of both chips takes
about 1.7 ms every 500 ms.
* chore: ignore the PlatformIO VS Code extension's generated files
The extension writes .vscode/ (IntelliSense and debug configs with
absolute paths, plus its extension recommendations) and
.gitignore.optional into the repo root. They are machine-specific and
were showing up as untracked files.
* fix(firmware): act on failed servo writes and close OLED recovery gaps
A second review of the I2C recovery found these, all fixed here:
- The OLED could stay dark until reboot. A failed OLED restart outside
an OLED fault (inside the PCA9685's recovery, or after a failed Wire
restart) cleared oledAvailable, but the check looked only at the
address ACK, so the OLED never faulted and never recovered. The check
now requires oledAvailable.
- Each chip's tracker now reads its own time. The PCA9685's recovery
stamped the OLED tracker with a later millis() than the tick's `now`,
so the unsigned subtraction wrapped and the OLED retried twice in one
tick.
- A failed servo write now stops servo writes at once. setPWM reports
failure and the firmware ignored it, so a dead bus could still stall
a blocking move that never reaches the health check. The next two
checks then fail and recovery sets the chip up again.
- A failed write while resyncing the channels fails the recovery,
instead of leaving that servo's cached pulse wrong.
- Servo outputs are switched off (OE) at a PCA9685 fault, so a
corrupted setup cannot keep driving them.
- Recovery no longer calls pwm.begin(), which programs 1 kHz before the
50 Hz setup; on a board with OE not wired the live servos got those
pulses. reset() wakes the chip instead.
- The check includes MODE1's EXTCLK bit.
- The stale "line held" flag that could keep the OLED waiting for the
PCA9685's next retry is gone.
- Boot logs a failed Wire.begin, and a sleeping robot's OLED recovery
no longer sends a second blank frame.
While a line is held, an update that retries both chips can take up to
101 ms (52 ms before), because the OLED retry now probes the bus. It
happens once per retry interval.
On the robot, with a temporary injector: a dead bus faulted both chips
after 0.74 s and both recovered after release; MODE2 = 0x10 was
repaired in 48 ms; an OLED-only fault recovered without touching the
PCA9685; a failed servo write faulted after 0.95 s and recovered in
75 ms; oledAvailable cleared outside a fault faulted after 0.96 s and
recovered in 16 ms. A 115 s soak with 25 animation changes, bells and
a sleep cycle raised no fault.
* fix(firmware): fault the PCA9685 at once on a failed write and lighten recovery
A third review of the I2C recovery found these, all fixed here:
- A failed servo write only set a flag. The outputs stayed on until two
later checks faulted the chip, and those never run inside a blocking
move or during boot. The tracker now has noteFault(): a failed write
takes the chip down at once and switches its outputs off. The
separate g_servoWriteFailed flag is gone.
- One failed write escalated to a full reset (sleep/wake cycle, OLED
re-init). A chip that still holds its setup now only gets its
channels rewritten and its outputs switched back on. The full restart
runs only when the setup was lost.
- Every PCA9685 recovery restarted the OLED, blanking a healthy panel
and counting OLED faults it never had. The OLED is now set up again
only when the PCA9685 lost its setup, the sign of a supply dip.
- An OLED restart left the panel blank, and static screens (boot IP,
servo test, orientation test) are never redrawn. The restart now
keeps the frame buffer and puts it back; a sleeping robot keeps the
panel dark but holds the frame for when it wakes.
- A recovery inside the /play loop blocked for 50 to 60 ms between
speaker writes, an audible gap. Recovery now waits while the speaker
is playing (samples within the last 250 ms), for at most 5 s after
the fault.
- Boot turned the outputs on even when the setup did not read back
correctly. Boot and recovery now share one finishing sequence: check
the setup, write every channel, then enable the outputs. A boot setup
that fails is a fault ("setup failed").
- The health check reads MODE1 and MODE2 in one transfer instead of
two.
- stopServoOutputs, a one-line wrapper, is gone.
Add tracker tests for noteFault, and update hardware/interfaces.md and
the troubleshooting table in hardware/testing.md.
Not yet run on the robot.
* fix(firmware): verify recovery writes and close the gaps Copilot found
Copilot's review of the I2C recovery found these, all fixed here:
- Outputs came back on after acknowledged channel writes without
reading them back, though the recovery promises a verified setup.
Each resync write is now read back (four registers per channel)
before OE goes low.
- The channel resync kept writing after a failure. On a dead bus each
further write waited out its timeout; it now stops at the first one,
and the next attempt rewrites every channel anyway.
- A PCA9685 recovery that restored the setup but failed a channel write
lost the pending OLED restart: the retry found the setup intact, took
the channel-only path, and a panel that lost power stayed dark. The
restart now stays pending until it has run.
- The SSD1306 driver ignores failed writes, so an OLED setup or frame
that never landed still counted as recovered, and the ACK-only check
never noticed. The OLED restart now sends the setup and the frame
itself, checking every transfer, at boot and in recovery. Without
begin() the frame buffer is not cleared, which drops the saved frame
copy (512 B of RAM).
- An OLED recovery applied the saved rotation over the one the setup
wizard was previewing. A restart now keeps the current rotation.
- The bus clear stopped clocking once SDA read high. In an interrupted
read that can be a 1 data bit, and the device then pulls SDA low again
under the STOP. It now always sends nine clocks, which pass an
acknowledge slot.
- A bus restart that left a line held kept OLED writes on, so frames
went to a dead bus until two checks failed. A held line now stops
them too.
- POST /servos/park saved the centre pose and replied 200 while the
PCA9685 was down and the move's writes were skipped. It now replies
503 "servo driver down" without saving the pose or arming the hold.
The upload hook already treats a failed park as a warning.
Document the readback, the checked OLED restart and the new park error.
Not yet run on the robot.
* fix(firmware): step the PCA9685 recovery and enable outputs between pulses
Close the two Copilot findings left open in 7c59720, and a slowdown it
introduced:
- A recovery could still cut a gap into a clip. It waited for the
speaker for up to 5 s, then ran in one go: tens of milliseconds, and
each failed transfer waited out Wire's 50 ms timeout. The PCA9685's
recovery now runs as steps, one per loop pass (probe, bus restart,
setup check, setup, channels off, settle, channels on, OLED), a pass
services at most one chip, and transfers time out after 20 ms. A pass
then costs about one timeout at worst, inside the speaker's DMA
buffer of about 65 ms (6 x 240 frames at 22,050 Hz). The audio wait
and speakerPlaying() are gone.
- Turning OE on is not synchronised to the PWM period, so enabling the
outputs while a channel was mid-pulse cut that pulse short. Channel
writes are: the PCA9685 applies new values at the end of a LOW cycle.
Boot and recovery now turn every servo channel off, wait more than one
period, turn OE on, and only then write and read back the channels,
so each servo starts on a whole pulse.
- The checked OLED transfers from 7c59720 ran at 100 kHz, where the
SSD1306 driver switches to 400 kHz, so an OLED restart took about four
times as long. They now switch the clock the same way.
Not yet run on the robot. The LOW-cycle behaviour comes from the
datasheet and wants a scope check.
* fix(firmware): keep watching an OLED whose boot setup failed
The I2C checks watched the OLED only if oledAvailable was true when
they started. Since 7c59720 a failed checked setup transfer at boot
clears it, so a panel that answered but missed part of its setup was
never checked or recovered and stayed dark until reboot.
Track "answered at boot and the driver started" separately from
"usable now". The checks watch any panel detected at boot; one whose
setup failed faults on its first checks and gets that setup retried.
Boot logs "OLED setup failed; retrying after boot", added to the
troubleshooting table.
Not yet run on the robot.
* fix(firmware): finish servo recovery with the channel resync
CodeRabbit's review of the I2C recovery found these, all fixed here:
- The recovery's last step could be the OLED restart, a pass after the
channels were rewritten. A servo command in between was cached but
not written, since the chip still counted as down, and nothing wrote
it afterwards. The OLED restart now runs before the outputs come
back, and the channel resync is the last step: the chip counts as up
in the same pass.
- The settle time started from the tick's timestamp, taken before the
channel-off writes, so the writes ate into the 25 ms. It now starts
after them.
- The setup step ran the frequency setup and its readbacks after a
failed MODE2 write, each waiting out a timeout on a dead bus. A
failed MODE2 write now ends the step.
- POST /servos/park centred the servos before checking the driver, so
a refused park still marked the centred pose for the debounced save.
It now refuses before anything changes, and still checks again after
the move.
- interfaces.md says a fault switches the outputs off; that needs OE
driven by the firmware. testing.md says a PCA9685 failure halts; only
a missing chip does, a setup that does not read back is retried.
---------
Co-authored-by: Blake Azuela <blake.azuela@bissell.com>
The servo harnesses were attached without tracking which body part went to which PCA9685 output. Identified each by driving one channel at a time: neck 0, right hand 1, body 2, left hand 3, head 4. Only the `channel` field moves. The SERVO_* constants stay 0-4 because they are ARRAY INDICES - they index SERVO_SPECS, g_servos[] and the saved min/max blob in NVS. Renumbering them would desynchronise the table, the runtime servos and the stored calibration; `channel` is free to be any output 0-15 and is the only value that reaches pwm.setPWM(). Header comment added saying so, since the two were previously identical and looked interchangeable. Consequence worth knowing: POST /test/servo?index=N no longer addresses channel N. Documented in pinout.md, which gains an index column and the channel-vs-index warning. Verified: pio run -e esp32-c3-devkitm-1 builds clean; flashed to the board over COM4, hash verified. The native test env cannot run on this host (g++ not on PATH), so the two Unity suites were not exercised. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GboNwm1xyFSrjmjdTVYzzi (cherry picked from commit 48883e4)
The stock SERVO_SPECS ranges describe the reference build; this one has a remounted neck horn and its own linkage geometry, so the committed defaults described a robot that does not exist. Sync them to the values arrived at through the setup-AP wizard: head 60-130 -> 50-130 neck 40-130 -> 30-150 (wizard recorded 0-180; narrowed deliberately) left hand 45-135 -> 40-110 right hand 35-125 -> 60-130 body 40-130 -> 36-89 (mid 62.5, verified square) The neck is the one judgement call. Nothing binds mechanically in either direction, so the wizard saved the full 0-180 electrical span; that maps animation extremes to a 90 degree yaw each way, well past what the stock design intends, so it is capped at +/-60 about forward. These are DEFAULTS only. Saved values in NVS shadow them and survive factory reset (reset.cpp writes the ranges back after prefs.clear()), so the device keeps whatever the wizard stored until a setup-AP write changes it - the neck on the bench is still 0-180 until then. robot-movement.md: ranges updated, a PCA channel column added beside the index, and the neck's min/max direction flipped - remounting its horn 180 degrees reverses which way increasing angle turns it. Verified: pio run -e esp32-c3-devkitm-1 builds clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GboNwm1xyFSrjmjdTVYzzi (cherry picked from commit 6484da7)
Brings in the carrier-board PCB work unique to the fork. Conflicts were docs/licensing only: REUSE.toml keeps both annotation sets, hardware and movement docs take upstream's newer wording, the carrier README keeps the pointer to compact-carrier-board-pinside. src/include/lib/platformio.ini are identical to 6e0c037, the build flashed to the robot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings fork
mainup to date with upstreamjamro/tiny-engineerand records the firmware now running on the robot (/health→v0.2.0-65-g6e0c037, flashed OTA 2026-11-17).What's in it
main@baf5d04: 46 commits, including I2C fault recovery (Fix/i2c fault recovery upstream jamro/tiny-engineer#111), kawaii eyes (Feat/kawaii eyes jamro/tiny-engineer#109), on-device event→action bindings, the push-button extension and wake-up fixes.48883e4(the channel map as wired: head 4, neck 0, left hand 3, right hand 1, body 2) and6484da7(measured ranges). These replace upstream's new 80–100° stock defaults.main, so this PR merges cleanly. The conflicts were all in docs or licensing:REUSE.tomlkeeps both sets of annotations.compact-carrier-board-pinside.Verification
pio run -e otabuilds: flash 93.4%, RAM 18.9%./healthreportsi2c.ok: truewith 0 faults on the PCA9685 and the OLED.src/,include/,lib/,platformio.iniand the partition tables at this branch's head are identical to6e0c037, the flashed commit.🤖 Generated with Claude Code