Skip to content

Validate requested arm_config, fall back to default - #21

Open
evanscott7 wants to merge 1 commit into
littlebee:mainfrom
evanscott7:contrib/validate-arm-config
Open

Validate requested arm_config, fall back to default#21
evanscott7 wants to merge 1 commit into
littlebee:mainfrom
evanscott7:contrib/validate-arm-config

Conversation

@evanscott7

Copy link
Copy Markdown

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_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.

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.
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.

1 participant