From bfb19321fd98e89794c48f5e2c8cf0de5f106cf2 Mon Sep 17 00:00:00 2001 From: Empire Date: Sat, 27 Apr 2024 19:58:56 +0200 Subject: [PATCH] stuff --- board/PlantCtrlESP32.kicad_pro | 5 ++++- board/PlantCtrlESP32.kicad_sch | 10 ++++++++++ rust/Cargo.toml | 7 ++++--- rust/src/plant_hal.rs | 7 +++++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/board/PlantCtrlESP32.kicad_pro b/board/PlantCtrlESP32.kicad_pro index 6197e50..3b5323d 100644 --- a/board/PlantCtrlESP32.kicad_pro +++ b/board/PlantCtrlESP32.kicad_pro @@ -574,7 +574,10 @@ "version": 3 }, "net_colors": null, - "netclass_assignments": null, + "netclass_assignments": { + "Net-(battery1-Pin_1)": "BAT-", + "VBAT": "BAT+" + }, "netclass_patterns": [ { "netclass": "3V", diff --git a/board/PlantCtrlESP32.kicad_sch b/board/PlantCtrlESP32.kicad_sch index e28f9e9..e20b1dc 100644 --- a/board/PlantCtrlESP32.kicad_sch +++ b/board/PlantCtrlESP32.kicad_sch @@ -18918,6 +18918,16 @@ ) (uuid "491f884a-ca01-4332-91f5-1fdea04f1b4a") ) + (text "Q is low due to reset being on ground -> in the same pot this prevents the charge cycle of another oscilator" + (exclude_from_sim no) + (at 467.106 32.766 0) + (effects + (font + (size 1.27 1.27) + ) + ) + (uuid "535edc01-7355-4883-adfe-aeb4f4fbc903") + ) (text "Low Power supply" (exclude_from_sim no) (at 60.96 703.58 0) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 59e55cb..46d1685 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -69,12 +69,13 @@ strum = { version = "0.26.1", features = ["derive"] } once_cell = "1.19.0" measurements = "0.11.0" bq34z100 = "0.2.1" +bitbang-hal = "0.3.2" [patch.crates-io] esp-idf-hal = { git = "https://github.com/esp-rs/esp-idf-hal.git" } -esp-idf-sys = { git = "https://github.com/empirephoenix/esp-idf-sys.git" } -# esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys.git" } -esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc.git" } +#esp-idf-sys = { git = "https://github.com/empirephoenix/esp-idf-sys.git" } +#esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys.git" } +#esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc.git" } [build-dependencies] embuild = "0.31.3" diff --git a/rust/src/plant_hal.rs b/rust/src/plant_hal.rs index a6686f3..1c7fde7 100644 --- a/rust/src/plant_hal.rs +++ b/rust/src/plant_hal.rs @@ -45,6 +45,8 @@ use esp_idf_svc::systime::EspSystemTime; use esp_idf_sys::{esp, gpio_hold_dis, gpio_hold_en, vTaskDelay, EspError}; use one_wire_bus::OneWire; +use bitbang_hal; + use crate::config::{self, Config, WifiConfig}; use crate::STAY_ALIVE; @@ -953,12 +955,13 @@ impl CreatePlantHal<'_> for PlantHal { fn create() -> Result>> { let peripherals = Peripherals::take()?; + let i2c = peripherals.i2c0; let config = I2cConfig::new() .scl_enable_pullup(false) .sda_enable_pullup(false) - .baudrate(10_u32.kHz().into()) - .timeout(Duration::from_millis(10).into); + .baudrate(1_u32.kHz().into()) + .timeout(Duration::from_millis(10).into()); let scl = peripherals.pins.gpio19; let sda = peripherals.pins.gpio20;