Faster fill

This commit is contained in:
2025-12-02 23:08:29 +01:00
parent 9925499eff
commit 56f9c423e7
8 changed files with 547 additions and 77 deletions

View File

@ -5,26 +5,19 @@ use core::ops::Sub;
use aht20_driver::AHT20;
use alloc::rc::Rc;
use alloc::vec::Vec;
use core::default::Default;
use embedded_hal_bus::i2c::RcDevice;
//use ens160_aq::Ens160;
use ens160::Ens160;
use esp_hal::Blocking;
use esp_hal::DriverMode;
use esp_hal::delay::Delay;
use esp_hal::gpio::interconnect::PeripheralOutput;
use esp_hal::i2c;
use esp_hal::i2c::master::I2c;
use esp_hal::i2c::master::Instance;
use esp_hal::peripherals;
use esp_hal::peripherals::Peripherals;
use esp_hal::time::Duration;
use esp_hal::time::Instant;
use heapless::Deque;
use heapless::HistoryBuf;
use crate::sampler;
pub struct Sampler<'a> {
ens160: Ens160<RcDevice<I2c<'a, Blocking>>>,
aht20: aht20_driver::AHT20Initialized<RcDevice<I2c<'a, Blocking>>>,
@ -133,6 +126,7 @@ impl<'a> Sampler<'a> {
pub fn sample(&mut self, timer: &mut Delay) -> Sample {
let aht20_measurement = self.aht20.measure(timer).unwrap();
Sample {
temperature: aht20_measurement.temperature,
humidity: aht20_measurement.humidity,