diff --git a/Readme.md b/Readme.md index 4e48650..2be427e 100644 --- a/Readme.md +++ b/Readme.md @@ -132,6 +132,7 @@ Additional hardware: The housing is a FreeCAD model at [hardware/housing/c_its-companion-housing.FCStd](./hardware/housing/c_its-companion-housing.FCStd), but the same folder also contains finished 3mf models that can be loaded into a 3D printer slicer. Exports are available for: +- 2mm: no battery (just display standoffs) - 7mm: EREMIT 654060 (6.5x40x60 mm) LiPo battery - 9mm: Some 9x40x60 mm LiPo battery, e.g. LP803860 (2000 mAh) diff --git a/hardware/housing/c_its-companion-housing-bottom-2mm.3mf b/hardware/housing/c_its-companion-housing-bottom-2mm.3mf new file mode 100644 index 0000000..2244f69 Binary files /dev/null and b/hardware/housing/c_its-companion-housing-bottom-2mm.3mf differ diff --git a/hardware/housing/c_its-companion-housing-bottom-7mm.3mf b/hardware/housing/c_its-companion-housing-bottom-7mm.3mf new file mode 100644 index 0000000..aa4c7f9 Binary files /dev/null and b/hardware/housing/c_its-companion-housing-bottom-7mm.3mf differ diff --git a/hardware/housing/c_its-companion-housing-bottom-9mm.3mf b/hardware/housing/c_its-companion-housing-bottom-9mm.3mf new file mode 100644 index 0000000..2ba2eee Binary files /dev/null and b/hardware/housing/c_its-companion-housing-bottom-9mm.3mf differ diff --git a/hardware/housing/c_its-companion-housing-bottom-v1.1-7mm.3mf b/hardware/housing/c_its-companion-housing-bottom-v1.1-7mm.3mf deleted file mode 100644 index 53686ab..0000000 Binary files a/hardware/housing/c_its-companion-housing-bottom-v1.1-7mm.3mf and /dev/null differ diff --git a/hardware/housing/c_its-companion-housing-bottom-v1.1-9mm.3mf b/hardware/housing/c_its-companion-housing-bottom-v1.1-9mm.3mf deleted file mode 100644 index cc7504d..0000000 Binary files a/hardware/housing/c_its-companion-housing-bottom-v1.1-9mm.3mf and /dev/null differ diff --git a/hardware/housing/c_its-companion-housing-lid-v1.1.3mf b/hardware/housing/c_its-companion-housing-lid-v1.1.3mf deleted file mode 100644 index 25b8bc6..0000000 Binary files a/hardware/housing/c_its-companion-housing-lid-v1.1.3mf and /dev/null differ diff --git a/hardware/housing/c_its-companion-housing-lid.3mf b/hardware/housing/c_its-companion-housing-lid.3mf new file mode 100644 index 0000000..2ec16e3 Binary files /dev/null and b/hardware/housing/c_its-companion-housing-lid.3mf differ diff --git a/hardware/housing/c_its-companion-housing.FCStd b/hardware/housing/c_its-companion-housing.FCStd index 9ea4657..64edf0c 100644 Binary files a/hardware/housing/c_its-companion-housing.FCStd and b/hardware/housing/c_its-companion-housing.FCStd differ diff --git a/src/ble.rs b/src/ble.rs index f72e972..a460d4e 100644 --- a/src/ble.rs +++ b/src/ble.rs @@ -110,7 +110,6 @@ pub async fn run( CONTROLLER_SLOTS, >, name: alloc::string::String, - short_name: alloc::string::String, ) { let mut resources: HostResources = HostResources::new(); @@ -121,7 +120,6 @@ pub async fn run( .. } = stack.build(); - info!("BLE name: {name} (short: {short_name})"); info!( "Starting advertising and GATT service for {}", crate::util::get_rx_feature_list().join(",") @@ -134,7 +132,7 @@ pub async fn run( let _ = embassy_futures::join::join(ble_task(runner), async { loop { - match advertise(&mut peripheral, &server, &short_name).await { + match advertise(&mut peripheral, &server).await { Ok(conn) => { info!("BLE: New client connected"); @@ -178,19 +176,16 @@ pub fn update(payload: BleSendable) { async fn advertise<'values, 'server, C: Controller>( peripheral: &mut Peripheral<'values, C, DefaultPacketPool>, server: &'server Server<'values>, - // name in advertisement, max. 8 characters - short_name: &'values str, ) -> Result, BleHostError> { - let mut advertiser_data = [0; 31]; // 37 bytes payload - 6 byte address + let mut advertiser_data = [0; 35]; let service_uuid = Uuid::from(0xc0b7_0000_d4f4_4000_ada8_f99a_02ee_315c_u128) .as_raw() .try_into() .unwrap(); let len = AdStructure::encode_slice( &[ - AdStructure::Flags(LE_GENERAL_DISCOVERABLE | BR_EDR_NOT_SUPPORTED), // 2+ 1 byte - AdStructure::ServiceUuids128(&[service_uuid]), // 2+16 byte = 21 - AdStructure::ShortenedLocalName(short_name.as_bytes()), // 2+ 8 byte = 31 + AdStructure::Flags(LE_GENERAL_DISCOVERABLE | BR_EDR_NOT_SUPPORTED), + AdStructure::ServiceUuids128(&[service_uuid]), ], &mut advertiser_data[..], )?; @@ -198,11 +193,7 @@ async fn advertise<'values, 'server, C: Controller>( let advertiser = peripheral .advertise( &trouble_host::advertise::AdvertisementParameters { - primary_phy: PhyKind::Le2M, - secondary_phy: PhyKind::Le2M, - timeout: Some(embassy_time::Duration::from_secs(3)), - interval_min: embassy_time::Duration::from_millis(150), - interval_max: embassy_time::Duration::from_secs(1), + timeout: Some(embassy_time::Duration::from_secs(2)), ..Default::default() }, Advertisement::ConnectableScannableUndirected { diff --git a/src/main.rs b/src/main.rs index 3b02775..e00e282 100644 --- a/src/main.rs +++ b/src/main.rs @@ -222,13 +222,12 @@ async fn main(spawner: Spawner) -> ! { let controller = ble::make_controller(peripherals.BT); let serial = &mac.as_bytes()[3..6]; let name = alloc::format!( - "C-ITS ESP {:02x}:{:02x}:{:02x}", + "ESP32 C-ITS {:02x}{:02x}{:02x}", serial[0], serial[1], serial[2] ); - let short_name = alloc::format!("V2X {:02x}{:02x}", serial[1], serial[2]); // max 8 chars! - spawner.spawn(ble::run(controller, name, short_name).expect("Failed to spawn BLE task")); + spawner.spawn(ble::run(controller, name).expect("Failed to spawn BLE task")); } // Setup GNSS: