remove: eliminate file management and LittleFS-based filesystem, implement savegame management for JSON config slots with wear-leveling
This commit is contained in:
@@ -340,19 +340,12 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
|
||||
bail!("pump current sensor not available");
|
||||
}
|
||||
Some(pump_ina) => {
|
||||
let v = pump_ina
|
||||
.shunt_voltage()
|
||||
.map_err(|e| FatError::String {
|
||||
error: alloc::format!("{e:?}"),
|
||||
})
|
||||
.map(|v| {
|
||||
let shunt_voltage =
|
||||
Voltage::from_microvolts(v.shunt_voltage_uv().abs() as f64);
|
||||
let shut_value = Resistance::from_ohms(0.05_f64);
|
||||
let current = shunt_voltage.as_volts() / shut_value.as_ohms();
|
||||
Current::from_amperes(current)
|
||||
})?;
|
||||
Ok(v)
|
||||
let raw = pump_ina.shunt_voltage()?;
|
||||
let shunt_voltage =
|
||||
Voltage::from_microvolts(raw.shunt_voltage_uv().abs() as f64);
|
||||
let shut_value = Resistance::from_ohms(0.05_f64);
|
||||
let current = shunt_voltage.as_volts() / shut_value.as_ohms();
|
||||
Ok(Current::from_amperes(current))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -609,10 +602,8 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
|
||||
let info: Result<(BackupHeader, usize), bincode::error::DecodeError> =
|
||||
bincode::decode_from_slice(&header_page_buffer[..], CONFIG);
|
||||
info!("decoding header: {:?}", info);
|
||||
info.map(|(header, _)| header)
|
||||
.map_err(|e| FatError::String {
|
||||
error: "Could not read backup header: ".to_string() + &e.to_string(),
|
||||
})
|
||||
let (header, _) = info.context("Could not read backup header")?;
|
||||
Ok(header)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user