Validate requested arm_config, fall back to default - #21
Open
evanscott7 wants to merge 1 commit into
Open
Conversation
handle_selected_arm_config / load_and_send_arm_config could be called with a missing or unknown arm_config filename (e.g. a stale `.current_arm_config` or a client requesting a config that no longer exists), which raised on the open() and left the client without a usable config. load_arm_config now validates the requested filename against the known arm_config_files; if it's empty or unknown it logs an error, loads arm_config_files[0] as a default, and — when it had to substitute — sends a corrected `arm_config_selected` state update so the client re-syncs to what was actually loaded. load_arm_config() takes a websocket param to do this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi Bee! I'm restoring your robot arm and love this project. While pulling the code off its SD card, I found this local change that isn't in the repo so thought you might want it back.
handle_selected_arm_config/load_and_send_arm_configcould be called with a missing or unknown arm_config filename (e.g. a stale.current_arm_config, or a client requesting a config that no longer exists), which raised on theopen()and left the client without a usable config.load_arm_confignow validates the requested filename against the knownarm_config_files; if it's empty or unknown it logs an error, loadsarm_config_files[0]as a default, and — when it had to substitute — sends a correctedarm_config_selectedstate update so the client re-syncs to what was actually loaded.load_arm_config()takes awebsocketparam to do this.