Open
Conversation
- Added a custom lightweight YAML stream parser in `yamlData.ino`. - Replicated the original project's memory-efficient "seek-and-find" logic to avoid external dependencies and high RAM usage. - Updated `MacroPad.ino` to automatically detect and prefer `config.yaml` over `config.xml`. - Updated `README.md` with instructions for the new YAML format. - Maintained full backward compatibility with existing XML configurations.
Owner
|
Awesome, I like it! |
Author
|
Off course please do. If you find problems let me know. I couldn't test it on the device so it's possible there are issues I overlooked. But I'll gladly fix issues. I love the project! Thanks for open sourcing it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request adds support for YAML configuration, providing a cleaner and more human-readable alternative to the original XML format.
Why this change?
While the original XML system is functional, XML is often tedious to edit manually and contains significant visual noise. YAML offers a much more streamlined experience for users wanting to customize their macro profiles and motor tuning.
Technical Approach
To ensure this remains compatible with the RP2040's limited RAM, this PR does not add any heavy external dependencies or libraries. Instead, it implements a custom stream-based YAML parser in
yamlData.ino.Following the project's existing design pattern, the parser "seeks" through the file on the SD card using
file.find()rather than loading the entire document into memory. This ensures the device can still support up to 256 profiles without any risk of memory exhaustion.Key Changes
yamlData.ino: Contains the stream-parsing logic to extract settings, profile names, and macro actions from a YAML file.MacroPad.inoUpdates: Added a format detection flag ininitialiseSD(). The firmware now checks forconfig.yamlon boot; if found, it prefers it over the originalconfig.xml.Example YAML Format
Hardware Disclaimer & Testing
I have not had the chance to test this on the physical Haptic Pad hardware yet, but I have verified the parsing logic for the YAML format.
Because this implementation mirrors your original XML logic exactly—using the built-in
Stream::find,Stream::parseInt, andStream::parseFloatmethods—the file navigation behavior remains consistent with the original design. I would appreciate it if someone with the physical hardware could do a final verification of the SD card integration!