Fix reset from ui

This commit is contained in:
hodasemi 2022-11-19 06:16:03 +01:00
parent d7243aff99
commit bfc28c532f
2 changed files with 5 additions and 1 deletions

View file

@ -73,6 +73,8 @@ fn main() {
} }
} }
drop(port_lock);
thread::sleep(Duration::from_millis(10)); thread::sleep(Duration::from_millis(10));
} }
}); });

View file

@ -69,7 +69,7 @@ impl Port {
} }
fn loop_usb_devices(usb_device: UsbId) -> Result<String> { fn loop_usb_devices(usb_device: UsbId) -> Result<String> {
loop { for _ in 0..3 {
if let Some(device) = Self::find_macroboard(&usb_device)? { if let Some(device) = Self::find_macroboard(&usb_device)? {
return Ok(device); return Ok(device);
} }
@ -81,6 +81,8 @@ impl Port {
std::thread::sleep(Duration::from_secs(2)); std::thread::sleep(Duration::from_secs(2));
} }
Err(anyhow!("no device found"))
} }
fn find_macroboard(usb_device: &UsbId) -> Result<Option<String>> { fn find_macroboard(usb_device: &UsbId) -> Result<Option<String>> {