-
Notifications
You must be signed in to change notification settings - Fork 7
refactor: Controller API #87
base: main
Are you sure you want to change the base?
Conversation
use snafu::Snafu; | ||
|
||
use crate::error::{bail_on, map_errno}; | ||
|
||
pub const CONTROLLER_MAX_LINE_LENGTH: usize = 14; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should go in pros-sys because it determines constraints on a function from that module. Also if controller display gets implemented in sim it'd be good to have that constant available because the simulator already uses other constants from pros-sys like errno values.
I think it's a little worrying how this makes it harder to read controller inputs without much obvious increase in safety. For example if you want to periodically rumble the controller from another thread but still read its inputs from opcontrol you'll need a mutex to share the controller, even though those two actions (reading joysticks and playing the haptic feedback) could happen in parallel. |
I think it is worth considering renaming the master controller to main or some similar word. |
Primary and partner might work because that's what VEXcode uses. |
Describe the changes this PR makes. Why should it be merged?
Controller
into peripherals to enforce singleton access.Additional Context
Buttons
andJoysticks
need to exist now other than as a fancy namespace struct.