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:
parent
1c268bba12
commit
17553cf2a3
1 changed files with 36 additions and 24 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue