thingy drives

added deadzone to gamepad controller

mended drive polarity

wait to start telem until awakened by northbridge
(linux doesn't boot in 300 cycles)
This commit is contained in:
Andy Killorin 2025-02-04 15:48:14 -05:00
commit 17553cf2a3
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -24,7 +24,6 @@ async fn main() -> anyhow::Result<()> {
let mut active_gamepad = None;
sleep(Duration::from_secs(5)).await; // bad
loop {
while let Some(Event { id,..}) = gamepads.next_event() {
active_gamepad = Some(id);
@ -41,8 +40,14 @@ async fn main() -> anyhow::Result<()> {
let values = gamepad.state();
dbg!(values);
let ly= values.axis_data(ly).map(|d| d.value()).unwrap_or(0.0);
let rx= values.axis_data(rx).map(|d| d.value()).unwrap_or(0.0);
let mut ly= values.axis_data(ly).map(|d| d.value()).unwrap_or(0.0);
let mut rx= values.axis_data(rx).map(|d| d.value()).unwrap_or(0.0);
for axis in [&mut rx, &mut ly] {
if axis.abs() < 0.05 {
*axis = 0.0;
}
}
let cmd = Command::Twist(ly, rx);