From 34de7584259815013983eb28e4eb9af93fe32bd0 Mon Sep 17 00:00:00 2001 From: Kezi Date: Sat, 16 Mar 2024 21:51:01 +0100 Subject: [PATCH] downgrade nimble to fix build --- .cargo/config.toml | 2 +- Cargo.toml | 10 +++++----- components_esp32.lock | 2 +- examples/idotmatrix/idotmatrixble.rs | 8 ++++---- examples/webserver.rs | 4 ++-- src/ble.rs | 18 +++++++++--------- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index fbc68bc..cebd1c3 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -13,6 +13,6 @@ build-std = ["std", "panic_abort"] [env] MCU="esp32" # Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.2.1" +ESP_IDF_VERSION = "v5.1.1" CARGO_WORKSPACE_DIR = { value = "", relative = true } \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index d357492..426634c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,12 +26,12 @@ embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf- [dependencies] log = { version = "0.4", default-features = false } -esp-idf-svc = { version = "0.48", default-features = false } -embedded-svc = "0.27.1" +esp-idf-svc = { version = "0.47" , default-features = false } +embedded-svc = "0.26" anyhow = "1.0.79" bstr = { version = "1.8.0", default-features = false } -esp32-nimble = "0.6.0" +esp32-nimble = "0.5.1" tokio = { version = "*", features = ["rt", "time", "sync","macros"] } lazy_static = "1.4.0" uuid = { version = "1.2.2", default-features = false, features = ["macro-diagnostics"] } @@ -42,8 +42,8 @@ serde = { version = "1", features = ["derive"]} serde_json = { version = "1"} idotmatrix = {git = "https://github.com/Kezii/idotmatrix.git"} -esp-idf-hal = "0.43" -esp-idf-sys = "0.34" +esp-idf-hal = "0.42" +esp-idf-sys = "0.33" thiserror = "1.0.56" toml-cfg = "=0.1.3" diff --git a/components_esp32.lock b/components_esp32.lock index 6e08dbe..10763e6 100644 --- a/components_esp32.lock +++ b/components_esp32.lock @@ -3,7 +3,7 @@ dependencies: component_hash: null source: type: idf - version: 5.2.1 + version: 5.1.1 manifest_hash: 3e6980bc5fca475de2a39d94c3ea3944c0528040d862609e810d1d8f5ea7f661 target: esp32 version: 1.0.0 diff --git a/examples/idotmatrix/idotmatrixble.rs b/examples/idotmatrix/idotmatrixble.rs index 18f217c..304ccaa 100644 --- a/examples/idotmatrix/idotmatrixble.rs +++ b/examples/idotmatrix/idotmatrixble.rs @@ -1,7 +1,7 @@ use crate::Camera; use anyhow::Result; use bstr::ByteSlice; -use esp32_nimble::{uuid128, BLEClient, BLEDevice, BLEError}; +use esp32_nimble::{uuid128, BLEClient, BLEDevice, BLEReturnCode}; use esp_idf_sys::camera; use espcam::espcam::FrameBuffer; use image::{ImageBuffer, ImageFormat, Rgb}; @@ -15,7 +15,7 @@ impl<'a> IDMBle<'a> { pub async fn new( ble_device: &'a BLEDevice, client: &'a mut BLEClient, - ) -> Result { + ) -> Result { let ble_scan = ble_device.get_scan(); info!("Scanning for BLE devices..."); @@ -44,11 +44,11 @@ impl<'a> IDMBle<'a> { Ok(Self { characteristic }) } else { error!("No device found"); - Err(BLEError::fail().unwrap_err()) + Err(BLEReturnCode::fail().unwrap_err()) } } - pub async fn send_data(&mut self, bytes: &[u8]) -> Result<(), BLEError> { + pub async fn send_data(&mut self, bytes: &[u8]) -> Result<(), BLEReturnCode> { for (counter, chunk) in bytes.chunks(512).enumerate() { let succ = self.characteristic.write_value(chunk, true).await; info!("progress: {}%", (counter * chunk.len()) * 100 / bytes.len()); diff --git a/examples/webserver.rs b/examples/webserver.rs index eef4161..2ee102f 100644 --- a/examples/webserver.rs +++ b/examples/webserver.rs @@ -70,13 +70,13 @@ fn main() -> Result<()> { response.write_all("no framebuffer".as_bytes())?; } - Ok::<(), anyhow::Error>(()) + Ok(()) })?; server.fn_handler("/", Method::Get, |request| { let mut response = request.into_ok_response()?; response.write_all("ok".as_bytes())?; - Ok::<(), anyhow::Error>(()) + Ok(()) })?; loop { diff --git a/src/ble.rs b/src/ble.rs index 624ac8f..f4ed1ea 100644 --- a/src/ble.rs +++ b/src/ble.rs @@ -2,7 +2,7 @@ use std::time::Duration; use anyhow::bail; use esp32_nimble::utilities::BleUuid; -use esp32_nimble::{BLEAdvertisementData, BLEAdvertising, BLEScan, BLEServer, NimbleProperties}; +use esp32_nimble::{BLEAdvertising, BLEScan, BLEServer, NimbleProperties}; use lazy_static::lazy_static; use log::{info, warn}; use tokio::select; @@ -52,14 +52,14 @@ pub async fn ble_advertise_task( ); notifying_characteristic.lock().set_value(b"uptime: 0"); - // advertising.name(name).add_service_uuid(*UUID_BLE_SERVICE); - advertising - .set_data( - BLEAdvertisementData::new() - .name(name) - .add_service_uuid(*UUID_BLE_SERVICE), - ) - .unwrap(); + advertising.name(name).add_service_uuid(*UUID_BLE_SERVICE); + // advertising + // .set_data( + // BLEAdvertisementData::new() + // .name(name) + // .add_service_uuid(*UUID_BLE_SERVICE), + // ) + // .unwrap(); advertising.start().expect("ble_advertising.start()");