I recently made a few changes to the controller firmware repo and wanted add more context.
Background: Since the days of the second controller and first custom PCB we’ve used Github branches to separate out code between the board versions. This was needed because different components and connections required their own configuration. As we’ve grown we not only have at least 4 versions of the X4 controller but also added a whole new controller for the SP140. Keeping libraries and features synced across devices has been difficult, especially while maintaining code quality and best practices.
Update: Today I merged in the beginnings of a re-architecture of the code to help us focus on quickly adding features while ensuring reliability for the controllers.
What does this mean?
- We had to drop support for the default Arduino IDE. All code is still build using Arduino libraries and base code, the IDE is very limited and doesnt support the new folder structure (see point 3).
- We are promoting PlatformIO to be the default way of building controller code. A year and a half ago I posted an intro to using PlatformIO and started using it more and more for new development. Its worked out great. I think our community will also enjoy the flexibility and features they’ve added, especially since its built on top of VSCode.
- Theres a new folder structure. You’ll notice some files have been moved around and much of the important device specific code is now under its own folders in the src directory. This allows lots of code sharing and reuse across controller types and will continue to simplify building features for older batches.
- Bonus: Automatic firmware builds including flashable .uf2 files. I’m most excited about this one because Github is now set up to run all the steps to automatically compile firmware and convert it .uf2. As a reminder, the .uf2 files are what we already use on config.openppg.com tool to drag-and-drop firmware update from your phone or computer). This will happen on every commit (heres an example) so technically you could add a feature and flash the firmware all in your browser editor!
There’s more work to do but this change should allow us to move even faster on the firmware side so stay tuned!
As always, feedback is welcome.