This commit is contained in:
2025-08-29 17:14:15 +02:00
parent a38d704498
commit a8e17cda3b
29 changed files with 568 additions and 15 deletions

View File

@@ -22,6 +22,7 @@ use bq34z100::Bq34z100g1Driver;
use ds323x::{DateTimeAccess, Ds323x};
use eeprom24x::{Eeprom24x, SlaveAddr, Storage};
use embedded_hal_bus::i2c::MutexDevice;
use esp_idf_hal::pcnt::PCNT1;
use esp_idf_hal::{
adc::ADC1,
delay::Delay,
@@ -47,7 +48,6 @@ use once_cell::sync::Lazy;
use std::result::Result::Ok as OkStd;
use std::sync::Mutex;
use std::time::Duration;
use esp_idf_hal::pcnt::PCNT1;
//Only support for 8 right now!
pub const PLANT_COUNT: usize = 8;

View File

@@ -132,7 +132,7 @@ pub(crate) fn create_v3(
peripherals.gpio5,
tank_power_pin,
flow_sensor_pin,
peripherals.pcnt1
peripherals.pcnt1,
)?;
let mut signal_counter = PcntDriver::new(

View File

@@ -160,7 +160,7 @@ pub(crate) fn create_v4(
peripherals.gpio5,
tank_power_pin,
flow_sensor_pin,
peripherals.pcnt1
peripherals.pcnt1,
)?;
let mut signal_counter = PcntDriver::new(

View File

@@ -6,7 +6,9 @@ use esp_idf_hal::adc::oneshot::{AdcChannelDriver, AdcDriver};
use esp_idf_hal::adc::{attenuation, Resolution, ADC1};
use esp_idf_hal::delay::Delay;
use esp_idf_hal::gpio::{AnyIOPin, AnyInputPin, Gpio5, InputOutput, PinDriver, Pull};
use esp_idf_hal::pcnt::{PcntChannel, PcntChannelConfig, PcntControlMode, PcntCountMode, PcntDriver, PinIndex, PCNT1};
use esp_idf_hal::pcnt::{
PcntChannel, PcntChannelConfig, PcntControlMode, PcntCountMode, PcntDriver, PinIndex, PCNT1,
};
use esp_idf_sys::EspError;
use one_wire_bus::OneWire;
@@ -25,7 +27,7 @@ impl<'a> TankSensor<'a> {
gpio5: Gpio5,
tank_power_pin: AnyIOPin,
flow_sensor_pin: AnyIOPin,
pcnt1: PCNT1
pcnt1: PCNT1,
) -> anyhow::Result<TankSensor<'a>> {
let mut one_wire_pin =
PinDriver::input_output_od(one_wire_pin).expect("Failed to configure pin");
@@ -73,7 +75,6 @@ impl<'a> TankSensor<'a> {
},
)?;
Ok(TankSensor {
one_wire_bus,
tank_channel,