From 6f1ac516300cf17eba614c4a6e5c136024d2a2ea Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Mon, 12 Jun 2023 13:31:09 -0400 Subject: [PATCH] Attempt to fix "drop" Remove infinite loop from is_temp_running, add logging --- src/device.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/device.rs b/src/device.rs index 523bd6d..a09ddce 100755 --- a/src/device.rs +++ b/src/device.rs @@ -332,13 +332,23 @@ impl Device{ pub fn is_temp_running(&mut self) -> bool { self.go_to_lifecycle_menu(); self.usb_tty.write_to_device(Command::ReadTemp); - loop { + for _ in 0..10 { match self.usb_tty.read_from_device(None){ Response::TempSuccess => return true, Response::TempFailed => return false, _ => {}, } } + self.usb_tty.write_to_device(Command::ReadTemp); + for _ in 0..10{ + match self.usb_tty.read_from_device(None){ + Response::TempSuccess => return true, + Response::TempFailed => return false, + _ => {}, + } + } + log::error!("Temp read failed!!!"); + return false; } pub fn is_bp_running(&mut self) -> bool { self.go_to_lifecycle_menu();