add delay param

This commit is contained in:
Denis-Cosmin Nutiu 2024-11-21 00:42:54 +02:00
parent 02f80c2439
commit 1dfea3fa47
3 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View file

@ -89,7 +89,7 @@ dependencies = [
[[package]]
name = "bme680-json"
version = "1.0.2"
version = "1.0.3"
dependencies = [
"anyhow",
"bme680",

View file

@ -1,6 +1,6 @@
[package]
name = "bme680-json"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
[dependencies]

View file

@ -25,7 +25,7 @@ struct Args {
/// Delay reading by the specified amount in milliseconds.
#[arg(long, default_value_t = 1000)]
delay_before_read: u32
delay: u32
}
fn main() -> Result<(), anyhow::Error> {
@ -47,7 +47,7 @@ fn main() -> Result<(), anyhow::Error> {
dev.set_sensor_settings(&mut delay, &settings)?;
dev.set_sensor_mode(&mut delay, PowerMode::ForcedMode)?;
Delay {}.delay_ms(args.delay_before_read);
Delay {}.delay_ms(args.delay);
let (data, _) = dev.get_measurement(&mut delay)?;
let serialized = serde_json::to_string(&JsonData{
temperature: data.temperature_celsius(),