add a timeout for the network to disconnect before starting update

this is to avoid panics due to malformed "packets" being received
as the EC is updating and not working correctly.
This commit is contained in:
bunnie 2022-04-21 01:22:17 +08:00
parent b39f4c38eb
commit ee39b9643e

View file

@ -487,6 +487,9 @@ impl<'a> ShellCmdApi<'a> for EcUpdate {
}
env.netmgr.connection_manager_stop().unwrap();
env.com.wlan_leave().ok();
env.ticktimer.sleep_ms(4000).unwrap(); // give a few seconds for any packets/updates to clear so we don't tigger panics as the EC is about to disappear...
self.in_progress = true;
let start = env.ticktimer.elapsed_ms();
self.start_time = Some(start);