Skip to content

fix: harden Dig-Next-2 wearable runtime - #180

Closed
clairernovotny wants to merge 6 commits into
MoonModules:mainfrom
novotnyllc:codex/dignext2-runtime-hardening
Closed

fix: harden Dig-Next-2 wearable runtime#180
clairernovotny wants to merge 6 commits into
MoonModules:mainfrom
novotnyllc:codex/dignext2-runtime-hardening

Conversation

@clairernovotny

@clairernovotnyclairernovotny commented Aug 17, 2026

Copy link
Copy Markdown

Summary

Dig-Next-2 wearable controllers can now serve the full MoonLight UI, remain discoverable by their configured .local hostname, and use the built-in PDM microphone without competing with LED output for I2S. The runtime remains garment-independent: the previously merged White Vest layout stays selected on this device, while future coat geometry can use the same firmware once its canonical map exists.

The implementation moves HTTP response buffers into bounded internal-RAM chunks, refreshes mDNS across DHCP and routed TTL boundaries, reserves RMT for LEDs when PDM pins are present, uses a bounded current-API PDM capture ring, and avoids unsupported internal pull-ups on classic ESP32 GPIO34-39.

Validation

  • pio run -e esp32-d0-pico2 completed successfully.
  • App-only flash completed with esptool data-hash verification. The device reports 1.0.1-dignext2.2 and sketch size 2754064.
  • / returned HTTP 200 in 0.31 s; /rest/drivers returned its complete 2,330-byte body in 0.32 s.
  • white-vest-next.local resolved and returned 3/3 ping replies after 185 seconds uptime, beyond the original 120-second mDNS TTL.
  • The live layout reports 95 RGB pixels, a 6x6x20 extent, and 95 unique occupied cells in the 720-cell virtual volume.
  • LED output is GPIO2 through RMT. PDM status is active; captured samples advanced from 78,214,400 to 80,602,880 and the live level changed from 196 to 120.
  • The staged diff passed git diff --cached --check and a focused added-line secret scan.

Remaining physical gates

  • Connect the known 12 V, 95-pixel vest string and validate a low-brightness solid color before mapped effects.
  • Confirm a sound-reactive effect visibly follows microphone input.
  • Capture the private full-flash restoration image only after those checks pass.

Summary by CodeRabbit

  • New Features

    • Added native support for the 95-pixel White Vest layout, including automatic migration from legacy layout references.
    • Added PDM microphone support and audio-reactive lighting with improved telemetry.
    • Improved compatibility between audio input and LED hardware resources.
  • Bug Fixes

    • Improved Wi-Fi reconnection timing and mDNS availability after obtaining an IP address.
    • Increased reliability when serving larger web responses.
    • Improved network responsiveness during data transfers.
  • Release

    • Updated the firmware identity to version 1.0.1-dignext2.2.

CopilotAI lite review requested due to automatic review settings August 17, 2026 04:15

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitaiBot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8bc75ad4-28ec-4143-8354-81438b054747

📥 Commits

Reviewing files that changed from the base of the PR and between 6586921 and a363a82.

📒 Files selected for processing (18)
  • docs/plans/2026-08-16-1954-feat-native-white-vest-firmware-plan.md
  • docs/plans/2026-08-16-2130-fix-vest-runtime-hardening-plan.md
  • firmware/esp32-d0.ini
  • lib/PsychicHttp/src/PsychicFileResponse.cpp
  • lib/PsychicHttp/src/PsychicHttpServer.cpp
  • lib/PsychicHttp/src/PsychicJson.cpp
  • lib/PsychicHttp/src/PsychicResponse.cpp
  • lib/framework/ESP32SvelteKit.cpp
  • lib/framework/WiFiSettingsService.cpp
  • lib/framework/WiFiSettingsService.h
  • scripts/merge_bin.py
  • scripts/rename_fw.py
  • src/MoonBase/Nodes.h
  • src/MoonLight/Modules/ModuleDrivers.h
  • src/MoonLight/Modules/ModuleLightsControl.h
  • src/MoonLight/Nodes/Drivers/D_FastLEDAudio.h
  • src/MoonLight/Nodes/Drivers/D_FastLEDDriver.h
  • src/MoonLight/Nodes/Layouts/L_WhiteVest95.h

Walkthrough

Changes

White Vest Runtime

Layer / File(s)Summary
Runtime plans and release identity
docs/plans/*, firmware/esp32-d0.ini, scripts/*.py
Adds implementation, validation, flashing, and publication plans. Sets the ESP32-D0-PICO2 firmware identity and makes the last matching build flag take precedence.
HTTP delivery and network lifecycle
lib/PsychicHttp/src/*, lib/framework/ESP32SvelteKit.cpp, lib/framework/WiFiSettingsService.*
Uses internal 512-byte buffers, enables TCP_NODELAY, paces chunk sends, and ties mDNS and reconnect timing to usable WiFi addresses.
PDM audio and RMT coordination
src/MoonLight/Nodes/Drivers/*, src/MoonLight/Modules/ModuleLightsControl.h
Adds bounded PDM capture, audio telemetry, cleanup, and error handling. Reserves RMT for PDM and changes input handling for ESP32 GPIOs 34–39.
Native White Vest layout registration
src/MoonBase/Nodes.h, src/MoonLight/Modules/ModuleDrivers.h, src/MoonLight/Nodes/Layouts/L_WhiteVest95.h
Adds the native 95-pixel layout, coordinate mapping, discovery, allocation, and migration from the script-based layout.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Poem

A rabbit found bright pixels in a vest,
And mapped each one from east to west.
PDM beats now hop in time,
WiFi names resolve just fine.
With sturdy buffers, lights can glow—
The White Vest’s ready for the show!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@clairernovotny

Copy link
Copy Markdown
Author

Opened against the upstream parent by the GitHub CLI default-repository heuristic. Closing this copy; the work is maintained in novotnyllc/MoonLight.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@clairernovotny