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 untrusted user: Naxdy
GPG key ID: CC15075846BCE91B

View file

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