reset brokenithm input on close controller

pull/13/head
4yn 2022-03-18 20:57:53 +08:00
parent 61505c2375
commit 8fbb9e4d9f
1 changed files with 6 additions and 0 deletions

View File

@ -136,12 +136,18 @@ async fn handle_brokenithm(
} }
Message::Close(_) => { Message::Close(_) => {
info!("Websocket connection closed"); info!("Websocket connection closed");
let mut input_handle = state_handle.input.lock();
input_handle.ground.fill(0);
input_handle.air.fill(0);
break; break;
} }
_ => {} _ => {}
}, },
Err(e) => { Err(e) => {
error!("Websocket connection error: {}", e); error!("Websocket connection error: {}", e);
let mut input_handle = state_handle.input.lock();
input_handle.ground.fill(0);
input_handle.air.fill(0);
break; break;
} }
}, },