DiabloAvionics — Architecture Rebuild
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.
What's getting fixed
-
Two
common/directories. Top-level has pin maps;Hotfire_Code/common/has hotfire configs + OTA. Someplatformio.inifiles literally do-I../common -I../../common. Merging into onecommon/with subdirs (common/pins/,common/hotfire/) so there's one source of truth. -
Inconsistent
platformio.inifiles. Same ESP32-S3 target across boards, but every project duplicateslib_extra_dirs,build_flags,build_unflagswith subtle drift (PT hasqio_opi, Actuator has it commented out, etc.). Replacing with one top-levelplatformio.iniand an[env:base_esp32s3]base; each board becomesextends = env:base_esp32s3and shrinks to a few lines. -
Active vs. archived is unclear. Moving every dead variant into
archive/so a newcomer can tell what's flying. -
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 -
Hotfire vs. board projects. Right now
PT_Board/andHotfire_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. - 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.