From ddbd11561a04164f318e8e9b4aa6f460772afc05 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Thu, 21 Nov 2024 00:13:28 +0200 Subject: [PATCH] add a delay before reading --- Cargo.toml | 2 +- src/main.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cc41cc6..ea9ec14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bme680-json" -version = "1.0.0" +version = "1.0.1" edition = "2021" [dependencies] diff --git a/src/main.rs b/src/main.rs index b280600..ca9ba69 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use bme680::i2c::Address; use bme680::{Bme680, IIRFilterSize, OversamplingSetting, PowerMode, SettingsBuilder}; use core::time::Duration; use clap::Parser; +use embedded_hal::delay::DelayNs; use linux_embedded_hal as hal; use linux_embedded_hal::Delay; @@ -42,6 +43,7 @@ fn main() -> Result<(), anyhow::Error> { dev.set_sensor_settings(&mut delay, &settings)?; dev.set_sensor_mode(&mut delay, PowerMode::ForcedMode)?; + Delay {}.delay_ms(5000u32); let (data, _) = dev.get_measurement(&mut delay)?; let serialized = serde_json::to_string(&JsonData{ temperature: data.temperature_celsius(),