Skip to content

Add support for YAML configuration#1

Open
DDecoene wants to merge 1 commit intodmcke5:mainfrom
DDecoene:main
Open

Add support for YAML configuration#1
DDecoene wants to merge 1 commit intodmcke5:mainfrom
DDecoene:main

Conversation

@DDecoene
Copy link
Copy Markdown

@DDecoene DDecoene commented Jan 9, 2026

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

  • New yamlData.ino: Contains the stream-parsing logic to extract settings, profile names, and macro actions from a YAML file.
  • Minimal MacroPad.ino Updates: Added a format detection flag in initialiseSD(). The firmware now checks for config.yaml on boot; if found, it prefers it over the original config.xml.
  • Backward Compatibility: No existing features were removed. If a user does not have a YAML file, the pad functions exactly as it did before.
  • Updated README: Includes a clear example of the new YAML structure for users.

Example YAML Format

Settings:
  LED_Mode: Bands
  LED_Primary: [255, 0, 0]
  Clicky_P: 0.5

Profiles:
  - name: "Shortcuts"
    WheelMode: Clicky
    Buttons:
      - label: "Undo", actions: [[0, 90], [0, 0], [0, 0]]
      - label: "Save", actions: [[0, 83], [0, 0], [0, 0]]

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, and Stream::parseFloat methods—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!

- 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.
@dmcke5
Copy link
Copy Markdown
Owner

dmcke5 commented Jan 10, 2026

Awesome, I like it!
I'm a bit out of the loop with software stuff as I don't work in the industry, but this YAML defintiely seems like its easier to read than the XML is. I'll load this up onto my device sometime this week and check that it works before I merge.

@DDecoene
Copy link
Copy Markdown
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!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants