Watch
0
0
Fork
You've already forked esp32-c_its-companion
0

BLE: Use unique name

This commit is contained in:
Jannik Beyerstedt 2026-08-19 14:37:49 +02:00
commit 9211c82d6f
2 changed files with 10 additions and 2 deletions

View file

@ -75,6 +75,7 @@ pub async fn run(
esp_radio::ble::controller::BleConnector<'static>, esp_radio::ble::controller::BleConnector<'static>,
CONTROLLER_SLOTS, CONTROLLER_SLOTS,
>, >,
name: alloc::string::String,
) { ) {
let mut resources: HostResources<DefaultPacketPool, CONNECTIONS_MAX, L2CAP_CHANNELS_MAX> = let mut resources: HostResources<DefaultPacketPool, CONNECTIONS_MAX, L2CAP_CHANNELS_MAX> =
HostResources::new(); HostResources::new();
@ -87,7 +88,7 @@ pub async fn run(
info!("Starting advertising and GATT service"); info!("Starting advertising and GATT service");
let server = Server::new_with_config(GapConfig::Peripheral(PeripheralConfig { let server = Server::new_with_config(GapConfig::Peripheral(PeripheralConfig {
name: "ESP32 C-ITS", name: &name,
appearance: &appearance::UNKNOWN, appearance: &appearance::UNKNOWN,
})) }))
.unwrap(); .unwrap();

View file

@ -219,7 +219,14 @@ async fn main(spawner: Spawner) -> ! {
#[cfg(feature = "ble")] #[cfg(feature = "ble")]
{ {
let controller = ble::make_controller(peripherals.BT); let controller = ble::make_controller(peripherals.BT);
spawner.spawn(ble::run(controller).expect("Failed to spawn BLE task")); let serial = &mac.as_bytes()[3..6];
let name = alloc::format!(
"ESP32 C-ITS {:02x}{:02x}{:02x}",
serial[0],
serial[1],
serial[2]
);
spawner.spawn(ble::run(controller, name).expect("Failed to spawn BLE task"));
} }
// Setup GNSS: // Setup GNSS: