Skip to content

HDZero goggle OSD via ELRS backpack (ESP-NOW): last lap, best 3 conse… - #21

Open
renanbsantos wants to merge 2 commits into
LouisHitchcock:V1.9.0-alphafrom
renanbsantos:hdzero-osd
Open

renanbsantos wants to merge 2 commits into
LouisHitchcock:V1.9.0-alphafrom
renanbsantos:hdzero-osd

Conversation

@renanbsantos

Copy link
Copy Markdown

How it works

  • New files: lib/WEBSERVER/elrs_osd.h/.cpp (kept inside WEBSERVER to avoid a new lib folder).
  • Sends MSP v2 MSP_ELRS_SET_OSD (0x00B6) over ESP-NOW, unicast to the bind-phrase UID (MD5 of -DMY_BINDING_PHRASE="..."), same as the ExpressLRS Timer backpack / VRxC_ELRS.
  • main.cpp: elrsOsd.begin() before ws.init(); in loop() feeds setStatus() (C5 online, race pilot, RSSI, enter threshold, timer.isRaceRunning()) and calls elrsOsd.loop(); elrsOsd.onLap() right after broadcastLapEvent().
  • webserver.cpp: in AP mode with the OSD enabled, uses WIFI_AP_STA, sets the STA MAC to the UID (+ LR protocol), forces the softAP to channel 1, then starts ESP-NOW. Stops ESP-NOW when switching to STA. Registers the settings routes.
  • Race start/stop comes from isRaceRunning() edges, so LapTimer is untouched.
  • All ESP-NOW sends happen from loop(); lap events are queued (safe from other tasks).
  • Best 3 consecutive excludes Gate 1, same rule as the web UI.
  • UID hash uses MD5Builder: mbedtls_md5_starts doesn't link on Arduino core 2.0.17.

Settings

  • Stored in NVS (namespace elrsosd), not in the EEPROM config struct. I didn't touch _reservedELRS / the config version; happy to move them into the config if you prefer.
  • Standalone page at /elrsosd. API: GET/POST /api/elrsosd, POST /api/elrsosd/test.
  • Enabling/disabling or changing the bind phrase reboots the device (Wi-Fi mode, MAC and channel only apply on a fresh AP start).

Not tested / limitations

  • Multi-pilot C5 races: those laps don't go through LapTimer, so the OSD only covers the single race pilot.
  • STA mode: OSD is off (needs channel 1).
  • Boards other than the DevKitC-1.
  • OSD strings are #defines at the top of elrs_osd.cpp (English); the settings page is standalone and not hooked into the main settings UI or i18n yet.

Written with AI assistance (Claude); please review accordingly.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3fb6df8c-9873-436c-84b3-2c774dd1ffcb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Sign up for free to 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.

1 participant