Add back is_temp_running
This commit is contained in:
parent
c1757ce169
commit
7a601ebc6e
2 changed files with 23 additions and 1 deletions
|
@ -330,6 +330,27 @@ impl Device{
|
|||
_ = self.usb_tty.read_from_device(None);
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn is_temp_running(&mut self) -> bool{
|
||||
self.go_to_lifecycle_menu();
|
||||
self.usb_tty.write_to_device(Command::ReadTemp);
|
||||
for _ in 0..10 {
|
||||
match self.usb_tty.read_from_device(None){
|
||||
Response::TempCount(count) => return count == self.init_temps ,
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
self.usb_tty.write_to_device(Command::ReadTemp);
|
||||
for _ in 0..10{
|
||||
match self.usb_tty.read_from_device(None){
|
||||
Response::TempCount(count) => return count == self.init_temps ,
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
log::error!("Temp read failed!!!");
|
||||
return false
|
||||
}
|
||||
|
||||
pub fn update_temp_count(&mut self) -> u64 {
|
||||
self.go_to_lifecycle_menu();
|
||||
self.usb_tty.write_to_device(Command::ReadTemp);
|
||||
|
@ -367,7 +388,6 @@ impl Device{
|
|||
}
|
||||
}
|
||||
log::error!("Temp read failed!!!");
|
||||
//return 0;
|
||||
}
|
||||
|
||||
pub fn is_bp_running(&mut self) -> bool {
|
||||
|
|
|
@ -145,6 +145,7 @@ fn main(){
|
|||
let mut iteration_threads = Vec::new();
|
||||
while let Some(mut device) = devices.pop(){
|
||||
iteration_threads.push(thread::spawn(move||{
|
||||
device.init_temp_count();
|
||||
for i in 1..=iteration_count{
|
||||
log::info!("Starting iteration {} of {} for device {}...",
|
||||
i,iteration_count,device.get_serial());
|
||||
|
@ -167,6 +168,7 @@ fn main(){
|
|||
}
|
||||
|
||||
fn find_gpio(device:&mut Device,gpio:&mut GpioPins) -> bool{
|
||||
device.init_temp_count();
|
||||
for &address in gpio.get_unassigned_addresses(){
|
||||
device.set_pin_address(address).start_temp();
|
||||
if device.is_temp_running(){
|
||||
|
|
Loading…
Add table
Reference in a new issue