Skip to content

Changes to remove dependancy on Arduino, for ESPIDF and Pico among others.#66

Open
mwinters-stuff wants to merge 5 commits intoDCC-EX:mainfrom
mwinters-stuff:main
Open

Changes to remove dependancy on Arduino, for ESPIDF and Pico among others.#66
mwinters-stuff wants to merge 5 commits intoDCC-EX:mainfrom
mwinters-stuff:main

Conversation

@mwinters-stuff
Copy link
Copy Markdown

I didnt want to write Arduino code for my controller, so I looked and saw the only reason for Arduino.h includes were for millis() and the built-in Stream class.

This was easy to resolve.

I have

  • Removed Arduino.h
  • Added a namespace - DCCExController to keep the code seperate.
  • Added a replacement for the Serial class - called DCCStream, and this is passed in place of Stream.
  • Added a DCCMillis interface, an simple implementation is passed to DCCEXProtocol If Null is passed this will freeze the program.
  • Updated the examples, to add simple implementations of DCCMillis and DCCStream
  • Added example ESPIDF code.
  • Updated the tests to mock and include appropriate examples. PlatformIO is no-longer needed to run the tests, cmake now has a target for building the tests.
  • cmake has been updated/included to handle the ESPIDF targets, just add a git repo in idf_component.yml

@github-actions github-actions Bot added the DCCEXProtocol Item relates to the DCCEXProtocol Arduino library specifically label Mar 17, 2026
Copy link
Copy Markdown
Contributor

@peteGSX peteGSX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the driver for making these changes? These will be significant breaking changes for existing library uses, and in the recent version, we explicitly moved away from cmake based tests to PlatformIO tests. I'd also much prefer not to include any IDE specific files. This needs to maintain compatibility with both the Arduino IDE and PlatformIO, have you tested with those?

@mwinters-stuff
Copy link
Copy Markdown
Author

My driver was originally to use a RPI Pico2-W which was not well supported in platformio, So i initially made the change for using the Pico CPP SDK, without arduino. Finding that was not sufficient I "upgraded" to a ESP32S3, with a graphic screen. This too I wanted to use the base sdk, that is the ESP-IDF, so was able to use it there.

This is one of the libraries where Arduino is not necessary and only used for "millis()" and the "Stream" interface/class. Both of these were easy to replace. I did originally add "millis()" into the delegate, but that was not super useful with your upgraded tests.

I did run the tests both in platformio and via cmake (which integrates better for running/debugging individual tests in vscode). I also ran all the examples after making the changes (all of which are the same) on platformio. The code there is basically exactly what someone using Arduino.h would need.

I prefer to be able to easily debug my code - platformio / arduino is not so easy to setup.

You can look at my current development - mostly been working on the connectivity and basic screens at
https://github.com/mwinters-stuff/esp32-dcc-controller

@peteGSX
Copy link
Copy Markdown
Contributor

peteGSX commented Mar 28, 2026

While we're not against making changes to support more than just the Arduino framework, we're not keen on accepting this PR exactly as it is given it's a breaking change.

If you were able to add some #ifdef statements or similar so that existing users see no difference while adding support for the other platforms we'd be happy to review and do some testing.

@peteGSX
Copy link
Copy Markdown
Contributor

peteGSX commented Mar 28, 2026

I should also add feel free to join us in Discord and talk directly on the topic also, which might be easier than going back and forth in GitHub comments. The invite link is here: https://discord.gg/y2sB4Fp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DCCEXProtocol Item relates to the DCCEXProtocol Arduino library specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants