Check if the focus command is supported when doing backup #132
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.
As per #128, the firmware update can fail with "because the settings could not be saved" when you are on an older firmware. This is because the old firmwares didn't support certain command (specifically macros.map) and due to the way the focus api works it would only return an empty string causing errorFlag to be set to true.
This PR fixes that by using the very handy "help" command to check what commands are supported before doing the update, and skipping the ones it can't find.
I've tested the fix by downgrading to the firmware in the release/0.1.2 branch and tried to upgrade to latest. Without this fix it will throw the "settings could not be saved" error.
As an expansion of this PR, I feel like the Focus class should probably get the supported commands in the constructor, and do all the checking in there instead and possibly add a specific exception just for that (or a return value you can check for). This PR however is just a simple fix to get around the issue.