Fixing JSON representation of WifiSettings #91
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.
Hello :)
Currently in
lib/framework/WiFiSettingsService.htheread()method creates an invalid structured JSON representation ofWifiSettings, what leads to inconsistent read/update operations, especially if you intend to use static IP configuration.The issue is, that within the for loop, while iterating through the networks, the network's properties are written to the JSON root level instead of to the network's particular array item. As a consequence, the resulting JSON missmatches the expected structure by the front end and the network settings properties cannot be visualized correctly.
The same effect should apply to persisting the settings file to the flash FS.
Independent from the bugfix:
I find the WiFi Station settings dialog somewhat unintuitive when using multiple network configurations. I found it difficult to understand how the respective configuration is loaded into the fields at the bottom of the dialog and how the "Add/Update Network" and "Apply Settings" buttons work.
Therefore, I changed the layout slightly and implemented a separate edit dialog (modal), which I think simplifies usage.
If there's interest, I could create a PR for that as well.