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 30a407a084
2 changed files with 13 additions and 5 deletions

View file

@ -167,6 +167,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();
@ -192,10 +193,10 @@ pub async fn run(
"Starting advertising and GATT service for {}", "Starting advertising and GATT service for {}",
features.join(",") features.join(",")
); );
let server = Server::new_with_config(GapConfig::Peripheral(PeripheralConfig { let server = Server::new_with_config(PeripheralConfig {
name: "ESP32 C-ITS", name: &name,
appearance: &appearance::UNKNOWN, appearance: &appearance::UNKNOWN, // maybe appearance::outdoor_sports_activity::LOCATION_AND_NAVIGATION_DISPLAY ?
})) })
.unwrap(); .unwrap();
let _ = embassy_futures::join::join(ble_task(runner), async { let _ = embassy_futures::join::join(ble_task(runner), async {

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: