Skip to content

Commit

Permalink
Fix VersaTest FW Flash Abort (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
esarver authored Sep 20, 2024
1 parent 84f50b8 commit 6d4191c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
Security -- in case of vulnerabilities.
-->

## [0.18.1]

### Fixed
- Fix issue where versatest instrument fw flash would be aborted by drop

## [0.18.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tsp-toolkit-kic-lib"
description = "A library specifically enabling communication to the Keithley product-line of instruments"
version = "0.18.0"
version = "0.18.1"
authors = ["Keithley Instruments, LLC"]
edition = "2021"
repository = "https://github.com/tektronix/tsp-toolkit-kic-lib"
Expand Down
8 changes: 8 additions & 0 deletions src/model/versatest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub struct Instrument {
info: Option<InstrumentInfo>,
protocol: Protocol,
auth: Box<dyn Authentication>,
fw_flash_in_progress: bool,
}

impl Instrument {
Expand All @@ -36,6 +37,7 @@ impl Instrument {
info: None,
protocol,
auth,
fw_flash_in_progress: false,
}
}

Expand Down Expand Up @@ -144,6 +146,7 @@ impl Flash for Instrument {
image: &[u8],
firmware_info: Option<u16>,
) -> crate::error::Result<()> {
self.fw_flash_in_progress = true;
let mut is_module = false;
let slot_number: u16 = firmware_info.unwrap_or(0);
if slot_number > 0 {
Expand Down Expand Up @@ -207,6 +210,10 @@ impl Drop for Instrument {
#[tracing::instrument(skip(self))]
fn drop(&mut self) {
trace!("calling versatest drop...");
if self.fw_flash_in_progress {
trace!("FW flash in progress. Skipping instrument reset.");
return;
}
let _ = self.reset();
}
}
Expand All @@ -221,6 +228,7 @@ impl Reset for Instrument {
Ok(())
}
}

#[cfg(test)]
mod unit {
use crate::protocol;
Expand Down

0 comments on commit 6d4191c

Please sign in to comment.