Fix Generation of JSON for boolean settings #1044
Merged
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.
FluidNC currently generates JSON options for boolean settings like /axes/x/homing/soft_limits such that the option values are serialized like this:
WebUI 2.1 handles this fine, however, WebUI 3 requires this to be formatted correctly.
There are 2 other places in the code where "O" members are generated, and both of those other places handle this by putting each value option as a member of it's own object in JSON.
This PR makes all 3 versions consistent, which makes it possible for the WebUI 3 settings page to work correctly. I tested with WebUI 2.1 and it also still works correctly. After this commit, the setting would come in as
I don't believe this should have an effect on the current version, but I wanted to put this in as a separate fix as I believe this may have been the original intent of the code, but it went unnoticed as the WebUI currently handles it.
I am not super familiar with the FluidNC codebase, though, so it would be good for someone else to also check this commit and make sure this doesn't affect anything outside of the WebUI.