feat(superhack): give the console time to initialize
Some checks failed
Publish nightly release / build (push) Has been cancelled
Some checks failed
Publish nightly release / build (push) Has been cancelled
This commit is contained in:
parent
a785fb69eb
commit
88b6a22182
1 changed files with 11 additions and 1 deletions
12
src/input.rs
12
src/input.rs
|
@ -458,6 +458,10 @@ pub async fn update_button_state_task(
|
|||
// replace this with the input filter of your choice, if you so desire.
|
||||
let mut input_filter = DummyFilter;
|
||||
|
||||
let mut initializing = true;
|
||||
|
||||
let init_time = Instant::now();
|
||||
|
||||
loop {
|
||||
update_button_states(
|
||||
&mut gcc_state,
|
||||
|
@ -522,7 +526,13 @@ pub async fn update_button_state_task(
|
|||
} else {
|
||||
input_filter.apply_filter(&mut gcc_state);
|
||||
if input_consistency_mode == InputConsistencyMode::SuperHack {
|
||||
if gcc_state != previous_state {
|
||||
// transmit state always for the first 5 seconds to give the console time to initialize the controller
|
||||
if initializing && Instant::now().duration_since(init_time) > Duration::from_secs(5)
|
||||
{
|
||||
initializing = false;
|
||||
}
|
||||
|
||||
if gcc_state != previous_state || initializing {
|
||||
gcc_publisher.publish_immediate(gcc_state);
|
||||
previous_state = gcc_state;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue