Skip to main content

← All posts

Build Log

The ESP-IDF Migration and Auto-Discovery

· 6 min read

This was the biggest week of the project so far. 126 commits across 19 repositories. Three things happened at once, and all of them were load-bearing.

Every firmware repo moved to ESP-IDF

Up until this week, most of our firmware lived on PlatformIO and the Arduino ESP32 core. That was fine for getting started and terrible for anything that needed partition control, OTA with rollback, or fine-grained power management. So we migrated. All of it. In one week.

Bearing, Solstice, Picket, Switchback, Ampline, Milepost, Torrent, Tapper, Aftline, Borealis, Plateau, and Spotter all now build on ESP-IDF. The OTA path was rewritten to match. Partition tables were corrected. Build artifacts got cleaned out of the repos. Every module now reports its firmware version back to Headwaters after an update, which is a capability we've wanted since the beginning.

Auto-discovery over CAN

Before this week, if you added a new module to the bus, you had to tell Headwaters about it. This week, you don't. Modules now announce themselves when they join the CAN bus, and Headwaters adds them to the PWA automatically. If you plug in a second Switchback, the UI grows a second set of light buttons on its own, wired to the right toggle IDs. This is the "it just works" behavior we've been heading toward, and it finally works.

Getting discovery to coexist with normal CAN traffic took the whole week across every repo. There was a subtle bug where the discovery handshake would interrupt regular messaging, and it had to be fixed in every firmware project. Every repo now has the same commit: "Fixing issue with CAN Bus stops responding when discovery happens." That is the sound of a bus-level bug being hunted down.

Node-RED is out

Node-RED served us well for rapid workflow prototyping, but it has become complexity we no longer need. This week it came out of the Headwaters stack. The first-login script now walks you through setup directly. The initial CM5 image ships with North American map data by default, so a fresh install can discover devices and run without network access from the very first boot.

Other notables

Milepost moved to a Waveshare 7-inch touch panel with built-in CAN, which eliminates a wiring headache. Bearing got a redesigned case with a Blender render in the readme. Tapper can now be paired with either Torrent or Switchback via build flags, so the same hardware can drive different downstream modules depending on how you configure it. System stats (CPU, memory, temperature) now flow from Headwaters to Farwatch, so you can see the health of the edge box from anywhere.

A heavy week. A good week.