Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Generation of JSON for boolean settings #1044

Merged
merged 1 commit into from
Nov 5, 2023

Conversation

michmela44
Copy link
Contributor

FluidNC currently generates JSON options for boolean settings like /axes/x/homing/soft_limits such that the option values are serialized like this:

 {
    "F":"tree",
    "P":"/axes/x/soft_limits",
    "H":"/axes/x/soft_limits",
    "T":"B",
    "V":"0",
    "O": [
        {
            "False":"0",
            "True":"1"
        }
      ]
    },

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.

image

image

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

 {
    "F":"tree",
    "P":"/axes/x/soft_limits",
    "H":"/axes/x/soft_limits",
    "T":"B",
    "V":"0",
    "O": [
        {
            "False":"0"
        },
        {
            "True":"1"
        }
      ]
    },

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.

@bdring bdring merged commit f5508af into bdring:Devt Nov 5, 2023
12 checks passed
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