← Back to Work

DiabloAvionics — Architecture Rebuild

PlatformIO · ESP32-S3 / C6 · Monorepo · Comms protocols · STAR rocketry · 2026 – current

Why this exists

DiabloAvionics is STAR's full avionics monorepo — flight computer, sense boards, actuator, ground-station GUIs, shared libraries — and after a couple of campaigns it had drifted. Two common/ directories. Every platformio.ini was a near-copy with subtle drift. Old variants (Old_PT_*, RTD_Old, Drafts/) sat next to live code. Hotfire_Code/ duplicated entire board projects. The comms layer was an ad-hoc UDP port pair (5005 / 5006).

My goal: rebuild the architecture and firmware structure from the ground up, and rework the way the boards communicate — so that next year's campaign starts from a repo a newcomer can navigate in a day.

Current shape

An interactive overview of the live repo and its subsystems. Click around.

Open the overview in a new tab →

What's getting fixed

  1. Two common/ directories. Top-level has pin maps; Hotfire_Code/common/ has hotfire configs + OTA. Some platformio.ini files literally do -I../common -I../../common. Merging into one common/ with subdirs (common/pins/, common/hotfire/) so there's one source of truth.
  2. Inconsistent platformio.ini files. Same ESP32-S3 target across boards, but every project duplicates lib_extra_dirs, build_flags, build_unflags with subtle drift (PT has qio_opi, Actuator has it commented out, etc.). Replacing with one top-level platformio.ini and an [env:base_esp32s3] base; each board becomes extends = env:base_esp32s3 and shrinks to a few lines.
  3. Active vs. archived is unclear. Moving every dead variant into archive/ so a newcomer can tell what's flying.
  4. Top-level is doing too many jobs. Flattening from ~20 sibling dirs to a clean shape:
    firmware/        # one PlatformIO project per board
      dan-e/  pt/  actuator/  rtd/  lc/  tc/  encoder/  env-tracker/  stacklight/
    firmware/tests/  # ADC, IC, Ethernet, multi-board comms tests
    common/          # merged shared headers
    libraries/       # in-house drivers (ADS126X, ISM330DH, LIS3DH, MCP3201, EthernetHandler, DAQv2-Comms)
    gui/             # ground-station GUIs (sense, combined, actuator, calibration)
    archive/         # everything Old_*/Drafts
  5. Hotfire vs. board projects. Right now PT_Board/ and Hotfire_Code/PT_Hotfire/ coexist; Actuator lives in three places. Picking one: one project per board, with hotfire becoming an [env:hotfire] inside it instead of a duplicate tree.
  6. Folder names with spaces ("DAN-E Avionics", "State Machine", "Stacklight Driver", "Environmental Tracker") get renamed — they bite CI eventually.

Reworking the comms layer

The current model: boards send SENSOR_DATA / BOARD_HEARTBEAT to the GUI on UDP port 5006, and the GUI sends heartbeat / config / abort back on 5005. It works on a clean network, but framing is implicit, schemas drift between firmware and GUI, and there's no way to detect dropped frames or re-key after a comms gap.

Where I'm taking it: a single shared message schema (one source of truth for sensor / actuator / heartbeat / abort packet definitions), explicit framing so partial packets can't lie about themselves, sequence numbers + ACKs on safety-critical paths, and a thin transport layer that lets us swap UDP for an Ethernet-framed protocol or a CAN backbone without rewriting board firmware.

Why not symlinks

Tempting fix for the duplicate common/ problem, but they break Windows contributors and CI. PlatformIO already gives us the right tool — extends on the env, a shared [platformio] section, and lib_extra_dirs in the base config. That fixes the structural problem without papering over it.