Skip to content

Commit

Permalink
Updates per review
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Jun 4, 2024
1 parent df542f5 commit 019575e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cmd/sensors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ struct SensorsArgs {

/// use the given backend to read sensor data
///
/// [default: `hiffy` if present, otherwise `readmem`]
/// By default, will try to use `hiffy`, and will fall back to `readmem` if
/// the `hiffy`-based backend fails (e.g. on network-connected targets
/// without the `udprpc` task)
#[clap(long, short, value_enum)]
backend: Option<Backend>,

Expand Down Expand Up @@ -355,12 +357,12 @@ impl RamSensorReader {
hubris: &HubrisArchive,
sensors: &[(usize, HubrisSensor)],
) -> Result<Self> {
let find_var = |v| {
let find_var = |name| {
hubris
.qualified_variables()
.find(|&(n, _v)| n == format!("task_sensor::main::{v}"))
.ok_or_else(|| anyhow!("could not find DATA_VALUE"))
.map(|(_name, v)| *v)
.find(|&(n, _)| n == format!("task_sensor::main::{name}"))
.ok_or_else(|| anyhow!("could not find {name}"))
.map(|(_, v)| *v)
};
let last_reading = find_var("LAST_READING")?;
let data_value = find_var("DATA_VALUE")?;
Expand Down Expand Up @@ -391,7 +393,7 @@ impl RamSensorReader {
0,
)?;
let Value::Struct(vs) = vs else {
bail!("expected a MaybeUnint struct, not {vs:?}");
bail!("expected a MaybeUninit struct, not {vs:?}");
};
let Value::Array(vs) =
vs.get("value").ok_or_else(|| anyhow!("missing `value` member"))?
Expand Down

0 comments on commit 019575e

Please sign in to comment.