Skip to content

Commit c3313e8

Browse files
authored
Merge pull request #9 from ProfFan/fan/pdoa
Fixed non-default features usage
2 parents 76846c4 + a6f0733 commit c3313e8

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

.github/workflows/rust.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ jobs:
2828
- uses: actions/checkout@v4
2929
- name: Run clippy
3030
run: cargo clippy --all -- -D warnings
31+
32+
# No Default Features
33+
no-default-features:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Run tests with no-default-features
38+
run: cargo test --no-default-features --verbose

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dw3000-ng"
33
description = "A modernized driver for DW3000 Ultra Wide Band module"
4-
version = "0.7.0"
4+
version = "0.7.1"
55
authors = [
66
"Fan Jiang <i@fanjiang.me>",
77
"Clement Pene <clement.pene@sii.fr>",
@@ -23,7 +23,7 @@ smoltcp = { version = "0.11", default-features = false, features = [
2323
] }
2424
nb = "1.0"
2525
fixed = "1.7"
26-
defmt = "0.3"
26+
defmt = { version = "0.3", optional = true }
2727
num-traits = { version = "0.2.18", default-features = false, features = ["libm"], optional = true }
2828

2929
[dev-dependencies]
@@ -42,5 +42,5 @@ default-features = false
4242
default = ["async", "defmt", "num-traits"]
4343
std = ["serde/std", "num_enum/std"]
4444
async = []
45-
defmt = []
45+
defmt = ["dep:defmt"]
4646
num-traits = ["dep:num-traits"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A modernized driver for the Decawave [DW3000] UWB transceiver, written in the [R
1313
Both RTT methods (single and double sided) are working and giving good positioning values.
1414
No implementation of PDoA or AoA.
1515

16-
Compared to the old `dw3000` crate we fixed the GPIOs and LEDs, also got rid of the old unmaintained ieee802154 crate and replaced it with smoltcp.
16+
Compared to the old `dw3000` crate we fixed the GPIOs and LEDs, also got rid of the old unmaintained ieee802154 crate and replaced it with `smoltcp`.
1717

1818
We mainly test on the ESP32 platform with `embassy` async framework.
1919

src/hl/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ mod test {
185185

186186
use embedded_hal_mock::eh1::spi::Mock as SpiMock;
187187

188+
#[cfg(feature = "defmt")]
188189
#[test]
189190
fn test_defmt() {
190191
let error = Error::<SpiMock<u8>>::BufferTooSmall { required_len: 42 };

src/hl/receiving.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ pub struct Message<'l> {
3838
}
3939

4040
/// A struct representing the quality of the received message.
41-
#[derive(Debug, Format, serde::Serialize, serde::Deserialize)]
41+
#[cfg_attr(feature = "defmt", derive(Format))]
42+
#[derive(Debug, serde::Serialize, serde::Deserialize)]
4243
pub struct RxQuality {
4344
/// The confidence that there was Line Of Sight between the sender and the
4445
/// receiver.
@@ -426,6 +427,11 @@ where
426427
- a)
427428
}
428429

430+
#[cfg(not(feature = "num-traits"))]
431+
fn get_first_path_signal_power(&mut self) -> Result<f32, Error<SPI>> {
432+
Ok(0.0)
433+
}
434+
429435
#[allow(clippy::type_complexity)]
430436
/// Finishes receiving and returns to the `Ready` state
431437
///

src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@
44
//! require a higher degree of flexibility, you can use the
55
//! [register-level interface] instead.
66
//!
7-
//! We used the crate [`dw1000`] developped for the DW1000 module and changed
8-
//! the registers access and spi functions, added fast command and implemented
9-
//! some high level functions.
10-
//!
11-
//! We tried a first positionning exemple using RTT methode.
12-
//! Lot of work still need to be added like the use of PDoA or AoA.
13-
//!
14-
//! These examples uses a NUCLEO STM32F103RB
15-
//!
167
//! This driver is built on top of [`embedded-hal`], which means it is portable
178
//! and can be used on any platform that implements the `embedded-hal` API.
189
//!
1910
//! [high-level interface]: hl/index.html
2011
//! [register-level interface]: ll/index.html
21-
//! [`dw1000`]: https://crates.io/crates/dw1000
2212
//! [`embedded-hal`]: https://crates.io/crates/embedded-hal
2313
#![cfg_attr(not(any(test, feature = "std")), no_main)]
2414
#![cfg_attr(not(any(test, feature = "std")), no_std)]

0 commit comments

Comments
 (0)