This commit is contained in:
Empire 2024-04-26 18:52:53 +02:00
parent d8044b8e34
commit 1fc04a58a0
4 changed files with 19 additions and 10 deletions

View File

@ -574,10 +574,7 @@
"version": 3 "version": 3
}, },
"net_colors": null, "net_colors": null,
"netclass_assignments": { "netclass_assignments": null,
"Net-(battery1-Pin_1)": "BAT-",
"VBAT": "BAT+"
},
"netclass_patterns": [ "netclass_patterns": [
{ {
"netclass": "3V", "netclass": "3V",

View File

@ -47,7 +47,6 @@ embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-
[dependencies] [dependencies]
log = { version = "0.4", default-features = false } log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.48.0", default-features = false }
serde = { version = "1.0.192", features = ["derive"] } serde = { version = "1.0.192", features = ["derive"] }
average = { version = "0.14.1" , features = ["std"] } average = { version = "0.14.1" , features = ["std"] }
#esp32 = "0.28.0" #esp32 = "0.28.0"
@ -56,6 +55,7 @@ ds18b20 = "0.1.1"
embedded-svc = { version = "0.27.0", features = ["experimental"] } embedded-svc = { version = "0.27.0", features = ["experimental"] }
esp-idf-hal = "0.43.0" esp-idf-hal = "0.43.0"
esp-idf-sys = { version = "0.34.0", features = ["binstart", "native"] } esp-idf-sys = { version = "0.34.0", features = ["binstart", "native"] }
esp-idf-svc = { version = "0.48.0", default-features = false }
esp_idf_build = "0.1.3" esp_idf_build = "0.1.3"
chrono = { version = "0.4.23", default-features = false , features = ["iana-time-zone" , "alloc"] } chrono = { version = "0.4.23", default-features = false , features = ["iana-time-zone" , "alloc"] }
chrono-tz = {version="0.8.0", default-features = false , features = [ "filter-by-regex" ]} chrono-tz = {version="0.8.0", default-features = false , features = [ "filter-by-regex" ]}
@ -70,6 +70,12 @@ once_cell = "1.19.0"
measurements = "0.11.0" measurements = "0.11.0"
bq34z100 = "0.2.1" bq34z100 = "0.2.1"
[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" }
[build-dependencies] [build-dependencies]
embuild = "0.31.3" embuild = "0.31.3"
vergen = { version = "8.2.6", features = ["build", "git", "gitcl"] } vergen = { version = "8.2.6", features = ["build", "git", "gitcl"] }

View File

@ -676,7 +676,7 @@ impl PlantCtrlBoardInteraction for PlantCtrlBoard<'_> {
} }
} }
} }
embedded_svc::mqtt::client::EventPayload::Connected{session_present: _} => { embedded_svc::mqtt::client::EventPayload::Connected(_) => {
mqtt_connected_event_received_copy mqtt_connected_event_received_copy
.store(true, std::sync::atomic::Ordering::Relaxed); .store(true, std::sync::atomic::Ordering::Relaxed);
mqtt_connected_event_ok_copy mqtt_connected_event_ok_copy
@ -894,6 +894,7 @@ impl PlantCtrlBoardInteraction for PlantCtrlBoard<'_> {
fn print_battery( fn print_battery(
battery_driver: &mut Bq34z100g1Driver<I2cDriver, Delay>, battery_driver: &mut Bq34z100g1Driver<I2cDriver, Delay>,
) -> Result<(), Bq34Z100Error<I2cError>> { ) -> Result<(), Bq34Z100Error<I2cError>> {
println!("Try communicating with battery");
let fwversion = battery_driver.fw_version().unwrap_or_else(|e| { let fwversion = battery_driver.fw_version().unwrap_or_else(|e| {
println!("Firmeware {:?}", e); println!("Firmeware {:?}", e);
0 0
@ -956,14 +957,19 @@ impl CreatePlantHal<'_> for PlantHal {
let config = I2cConfig::new() let config = I2cConfig::new()
.scl_enable_pullup(false) .scl_enable_pullup(false)
.sda_enable_pullup(false) .sda_enable_pullup(false)
.baudrate(10_u32.kHz().into()); .baudrate(10_u32.kHz().into())
.timeout(Duration::from_millis(10).into);
let scl = peripherals.pins.gpio19; let scl = peripherals.pins.gpio19;
let sda = peripherals.pins.gpio20; let sda = peripherals.pins.gpio20;
let driver = I2cDriver::new(i2c, sda, scl, &config).unwrap(); let driver = I2cDriver::new(i2c, sda, scl, &config).unwrap();
let i2c_port = driver.port(); let i2c_port = driver.port();
esp!(unsafe { esp_idf_sys::i2c_set_timeout(i2c_port, 2)}).unwrap(); let mut timeout:i32 = 0;
esp!(unsafe { esp_idf_sys::i2c_get_timeout(i2c_port, &mut timeout)}).unwrap();
println!("Default i2c timeout is {}", timeout);
//esp!(unsafe { esp_idf_sys::i2c_set_timeout(i2c_port, 1)}).unwrap();
let mut battery_driver: Bq34z100g1Driver<I2cDriver, Delay> = Bq34z100g1Driver { let mut battery_driver: Bq34z100g1Driver<I2cDriver, Delay> = Bq34z100g1Driver {
i2c: driver, i2c: driver,