Feat/esp32 glasses - #7
Open
Re1veN7 wants to merge 28 commits into
Open
Conversation
firmware/ was listed in .git/info/exclude, so nothing under it had ever been committed — it was absent from main and every remote branch. That exclude file is local to one clone and is never pushed, so the firmware was invisible to git here while nobody else had any copy of it at all. Drop the exclusion and commit the project. .pio/ and .vscode/ stay ignored via the project's own .gitignore, so only sources, docs and the wiring diagrams land. Also add an env:motorlink so src/main.cpp actually builds. Every build_src_filter starts with -<*> and names exactly one file, and none of them named main.cpp — it compiled in zero environments and `pio run` gave no hint of it. Verified: builds clean under -Wall, 20.4% flash.
Bring-up aid for the Pi <-> ESP32 UART: latch the first ACK ever seen and print once, so a wiring or baud problem is distinguishable from a board that is simply idle. Latched rather than per-packet, otherwise it prints at frame rate. _check_ack() moves into an ack_seen local. Same single call per iteration as before — it just gets read twice now.
…O board configs Adds a new PlatformIO project (esp32_haptic_feedback) driving three motors off BMI160 IMU telemetry, with a MAC-mode incremental fade test and a deployment UART/JSON mode. Also moves the shared `board` and port settings out of `[env]` into each control-panel environment so `motorlink` can target the XIAO ESP32-C3 independently, and switches the motor controller to a dedicated HardwareSerial (UART1) instead of Serial2.
Re1veN7
force-pushed
the
feat/esp32-glasses
branch
from
September 8, 2026 14:44
976864f to
dfddc11
Compare
…e logic to esp32_haptic_feedback
Adds sendImuTelemetry(), an outbound 0x02 packet type on the existing PiSerial link (D6/D7) alongside the inbound motor-command protocol. Reuses the state/raw_pitch/raw_yaw values the BMI160 block already computes every 200ms tick, encoding them as start+type+state+pitch(2) +yaw(2)+checksum. No ACK is expected back for this packet type.
Decodes the new inbound 0x02 packet off the existing PiSerial link.
Reuses _check_ack's single per-iteration port.read() rather than
adding a second reader: the same drained chunk is scanned for both
the ACK prefix (unchanged, all 12 existing tests still pass) and a
telemetry frame, with the decoded reading staged on the port object
for a new _take_imu_telemetry() to collect.
Signed pitch/yaw are decoded via struct.unpack(">h", ...) for correct
two's-complement handling. A partial frame that stalls mid-packet is
abandoned after 0.5s so it can't permanently desync later frames.
Latest reading lands on a new lock-guarded ImuTelemetry class,
mirroring SystemConfig's get/update/snapshot shape, exposed as
user_data.imu_telemetry. No downstream consumer is wired yet — that's
the separate turning-body task.
…extraction Covers the v1 0x02 protocol logic that shipped without dedicated tests: negative-value signed int16 decode (struct.unpack byte order pinned explicitly), checksum rejection (dropped frame does not update ImuTelemetry), a frame split across two reads, a stale partial frame being abandoned rather than corrupting the next one, ACK and telemetry both being detected from one shared drain, and ImuTelemetry's thread-safety under concurrent update/snapshot. Purely additive — 210 insertions, 0 deletions. All 41 pre-existing tests pass unmodified; all 9 new tests pass. No bug found in the v1 logic.
Adds a temporary [BENCH MOTOR] print in handlePacket() so a received 0x01 motor-update packet's left/center/right duty is visible on the ESP32's USB debug console, plus scripts/test_motor_packet.py to send manual motor-update packets from the RPi5 side for bench verification without needing the full depth-estimation pipeline running.
…o the ESP32
sv-main.sh predates the --serial-port flag and never passed it, so every
real run silently built motor packets and dropped them
("running without an ESP32"). The manual bench test worked because it
opens the port directly; the real pipeline never did.
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.
No description provided.