Skip to content

Commit

Permalink
downgrade nimble to fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Kezii committed Mar 16, 2024
1 parent 233b12b commit 34de758
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion components_esp32.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions examples/idotmatrix/idotmatrixble.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -15,7 +15,7 @@ impl<'a> IDMBle<'a> {
pub async fn new(
ble_device: &'a BLEDevice,
client: &'a mut BLEClient,
) -> Result<Self, BLEError> {
) -> Result<Self, BLEReturnCode> {
let ble_scan = ble_device.get_scan();

info!("Scanning for BLE devices...");
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions examples/webserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
18 changes: 9 additions & 9 deletions src/ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()");

Expand Down

0 comments on commit 34de758

Please sign in to comment.