feat(HID): get state on-demand to improve latency

This commit is contained in:
Naxdy 2024-04-02 10:12:23 +02:00
parent 84d531e80a
commit c7fd7e72c9
Signed by: Naxdy
GPG key ID: CC15075846BCE91B

View file

@ -353,11 +353,16 @@ pub async fn usb_transfer_task(
ticker.next().await; ticker.next().await;
} }
let state = gcc_subscriber.next_message_pure().await; match writer
let report = get_gcinput_hid_report(&state); .write(&{
match writer.write(&report).await { let state = gcc_subscriber.next_message_pure().await;
Ok(()) => { let report = get_gcinput_hid_report(&state);
trace!("Report Written: {:08b}", report); trace!("Report Written: {:08b}", report);
report
})
.await
{
Ok(()) => {
let currtime = Instant::now(); let currtime = Instant::now();
let polltime = currtime.duration_since(lasttime); let polltime = currtime.duration_since(lasttime);
let micros = polltime.as_micros(); let micros = polltime.as_micros();