forked from NaxdyOrg/NaxGCC-FW
feat(hid): improve rate limiting in SuperHack mode
This commit is contained in:
parent
64ec44c933
commit
7f675c895d
1 changed files with 4 additions and 7 deletions
|
@ -361,7 +361,6 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
|
|||
let mut gcc_subscriber = CHANNEL_GCC_STATE.subscriber().unwrap();
|
||||
|
||||
let mut last_report_time = Instant::now();
|
||||
let mut last_loop_time = Instant::now();
|
||||
let mut ticker = Ticker::every(Duration::from_micros(8333));
|
||||
|
||||
loop {
|
||||
|
@ -378,12 +377,10 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
|
|||
InputConsistencyMode::SuperHack => {
|
||||
// In SuperHack mode, we send reports only if the state changes, but
|
||||
// in order to not mess up very fast inputs (like sticks travelling, for example),
|
||||
// we still need a delay that is higher than the polling rate, but ideally also
|
||||
// a multiple/divisor of the game's frame rate.
|
||||
// This doesn't quite hit the 8.33ms every time though, so inputs during lots of
|
||||
// stick movement might still be a bit off.
|
||||
Timer::at(last_loop_time + Duration::from_micros(8333)).await;
|
||||
last_loop_time = Instant::now();
|
||||
// we still need to "rate limit" the reports to every 8.33ms at most.
|
||||
// This does rate limit it to ~8.33ms fairly well, my only
|
||||
// gripe with it is that I hate it :)
|
||||
Timer::at(last_report_time + Duration::from_micros(8100)).await;
|
||||
}
|
||||
InputConsistencyMode::ConsistencyHack => {
|
||||
// Ticker better maintains a consistent interval than Timer, so
|
||||
|
|
Loading…
Reference in a new issue