diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml index c75f782..f26d982 100644 --- a/rust/.cargo/config.toml +++ b/rust/.cargo/config.toml @@ -4,18 +4,11 @@ target = "riscv32imac-esp-espidf" [target.riscv32imac-esp-espidf] linker = "ldproxy" -#runner = "espflash flash --monitor --partition-table partitions.csv" # Select this runner for espflash v2.x.x +# runner = "espflash flash --monitor --partition-table partitions.csv -b no-reset" # Select this runner for espflash v2.x.x +runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv -b no-reset" # Select this runner for espflash v2.x.x # runner = espflash erase-parts otadata - runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv" # Select this runner for espflash v2.x.x -# runner = "cargo runner" -rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 -[target.xtensa-esp32-espidf] -linker = "ldproxy" -#runner = "espflash flash --monitor --partition-table partitions.csv" # Select this runner for espflash v2.x.x -# runner = espflash erase-parts otadata -runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv" # Select this runner for espflash v2.x.x -#runner = "cargo runner" +# runner = "cargo runner" rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 [unstable] diff --git a/rust/src/main.rs b/rust/src/main.rs index d70b9f5..ac325e4 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -386,7 +386,10 @@ fn safe_main() -> anyhow::Result<()> { &mut board, ); - if STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed) { + + let stay_alive = STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed); + println!("Check stay alive, current state is {}", stay_alive); + if stay_alive { drop(board); let reboot_now = Arc::new(AtomicBool::new(false)); let _webserver = httpd(reboot_now.clone()); diff --git a/rust/src/plant_hal.rs b/rust/src/plant_hal.rs index 75b0df8..03d9842 100644 --- a/rust/src/plant_hal.rs +++ b/rust/src/plant_hal.rs @@ -651,7 +651,6 @@ impl PlantCtrlBoardInteraction for PlantCtrlBoard<'_> { let mut client = EspMqttClient::new_cb(&config.mqtt_url, &mqtt_client_config, move |event| { let payload = event.payload(); - println!("received mqtt event {:?}", payload); match payload { embedded_svc::mqtt::client::EventPayload::Received { id: _, @@ -968,9 +967,6 @@ impl CreatePlantHal<'_> for PlantHal { esp!(unsafe { esp_idf_sys::i2c_get_timeout(i2c_port, &mut timeout)}).unwrap(); println!("init i2c timeout is {}", timeout); - loop { - unsafe { vTaskDelay(1) } - } //esp!(unsafe { esp_idf_sys::i2c_set_timeout(i2c_port, 22)}).unwrap(); let mut battery_driver: Bq34z100g1Driver = Bq34z100g1Driver {