feat(docs): Explain supported feature combinations, add test script
This commit is contained in:
parent
7668c9bb7b
commit
1d4e82335d
3 changed files with 82 additions and 8 deletions
|
|
@ -52,14 +52,19 @@ rustup component add --toolchain nightly rustfmt
|
||||||
|
|
||||||
### Build and Flash
|
### Build and Flash
|
||||||
In default configuration only signal phases (SPAT) data is displayed for the upcoming intersection.
|
In default configuration only signal phases (SPAT) data is displayed for the upcoming intersection.
|
||||||
Additional features are available though feature flags:
|
Additional features are available through feature flags:
|
||||||
|
|
||||||
- `esp`: Run on ESP (required as feature flag to enable unit tests on host)
|
- `esp`: Run on ESP (required as feature flag to enable unit tests on host)
|
||||||
- `std`: Run on system with `std` library
|
- `std`: Run on system with `std` library
|
||||||
- `spat`: Enable signal phase (and intersection map) data
|
- `spat`: Enable signal phase (and intersection map) data
|
||||||
|
- `spat_debug`: Enable additional debug information for the SPAT/ GLOSA use case
|
||||||
- `denm`: Enable DENMs
|
- `denm`: Enable DENMs
|
||||||
- `cam`: Enable CAMs
|
- `cam`: Enable CAMs
|
||||||
|
|
||||||
|
Officially supported feature combinations are:
|
||||||
|
- `esp,spat,gnss,screen` (default features)
|
||||||
|
- To be implemented: No GNSS and screen when BLE/ UART interface is implemented
|
||||||
|
|
||||||
Connect your ESP32-C5 and run:
|
Connect your ESP32-C5 and run:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
69
feat-permut.sh
Executable file
69
feat-permut.sh
Executable file
|
|
@ -0,0 +1,69 @@
|
||||||
|
#!/bin/bash
|
||||||
|
## Build/ Test/ Clippy all supported feature permutations
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
mode=${1:-help}
|
||||||
|
wasm_target="--chrome --headless"
|
||||||
|
extended=${2:-false}
|
||||||
|
|
||||||
|
|
||||||
|
features_base=(
|
||||||
|
#cam,denm,uart
|
||||||
|
spat,gnss,screen
|
||||||
|
)
|
||||||
|
features_more=(
|
||||||
|
spat,gnss,screen,cam,denm
|
||||||
|
)
|
||||||
|
features_test=(
|
||||||
|
spat
|
||||||
|
spat,cam,denm
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
runBuild () {
|
||||||
|
for feat in "${features[@]}"; do
|
||||||
|
echo "cargo build for $feat ..."
|
||||||
|
cargo build --release --no-default-features -F esp,$feat
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
runTest () {
|
||||||
|
for feat in "${features_test[@]}"; do
|
||||||
|
echo "cargo test for $feat ..."
|
||||||
|
cargo test --target host-tuple --bin test --no-default-features -F std,$feat
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
runClippy () {
|
||||||
|
for feat in "${features[@]}"; do
|
||||||
|
echo "clippy for $feat ..."
|
||||||
|
cargo clippy --no-default-features -F esp,$feat -- -Wclippy::pedantic
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $extended == "--more" ]; then
|
||||||
|
echo "running with extended feature list"
|
||||||
|
features=( "${features_base[@]}" "${features_more[@]}" )
|
||||||
|
else
|
||||||
|
echo "running standard feature list"
|
||||||
|
features=( "${features_base[@]}" )
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $mode in
|
||||||
|
build)
|
||||||
|
runBuild
|
||||||
|
;;
|
||||||
|
clippy)
|
||||||
|
runClippy
|
||||||
|
;;
|
||||||
|
test)
|
||||||
|
runTest
|
||||||
|
;;
|
||||||
|
all)
|
||||||
|
runBuild
|
||||||
|
runClippy
|
||||||
|
runTest
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 [build | clippy | test | all] [--more]"
|
||||||
|
esac
|
||||||
|
|
@ -6,7 +6,7 @@ use alloc::rc::Rc;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
use log::info;
|
use log::info;
|
||||||
#[cfg(any(feature = "gnss", feature = "spat"))]
|
#[cfg(feature = "spat")]
|
||||||
use log::warn;
|
use log::warn;
|
||||||
#[cfg(feature = "spat")]
|
#[cfg(feature = "spat")]
|
||||||
use log::{debug, error};
|
use log::{debug, error};
|
||||||
|
|
@ -688,13 +688,13 @@ mod tests {
|
||||||
let own_pos_passed = geo_types::Point::new(9.977217, 53.5560602);
|
let own_pos_passed = geo_types::Point::new(9.977217, 53.5560602);
|
||||||
let own_heading = 90.;
|
let own_heading = 90.;
|
||||||
|
|
||||||
state.heading_deg = Some(own_heading);
|
state.pos.heading_deg = Some(own_heading);
|
||||||
|
|
||||||
state.position = own_pos_infront;
|
state.pos.position = own_pos_infront;
|
||||||
state.run_glosa();
|
state.run_glosa();
|
||||||
assert!(matches!(state.glosa_state, GlosaState::Idle));
|
assert!(matches!(state.glosa_state, GlosaState::Idle));
|
||||||
|
|
||||||
state.position = own_pos_inside;
|
state.pos.position = own_pos_inside;
|
||||||
state.run_glosa();
|
state.run_glosa();
|
||||||
assert!(matches!(state.glosa_state, GlosaState::Locked(_)));
|
assert!(matches!(state.glosa_state, GlosaState::Locked(_)));
|
||||||
if let GlosaState::Locked(info) = &state.glosa_state {
|
if let GlosaState::Locked(info) = &state.glosa_state {
|
||||||
|
|
@ -702,7 +702,7 @@ mod tests {
|
||||||
assert!(info.lane_id == 1 || info.lane_id == 2);
|
assert!(info.lane_id == 1 || info.lane_id == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.position = own_pos_inside;
|
state.pos.position = own_pos_inside;
|
||||||
state.run_glosa();
|
state.run_glosa();
|
||||||
assert!(matches!(state.glosa_state, GlosaState::Locked(_)));
|
assert!(matches!(state.glosa_state, GlosaState::Locked(_)));
|
||||||
if let GlosaState::Locked(info) = &state.glosa_state {
|
if let GlosaState::Locked(info) = &state.glosa_state {
|
||||||
|
|
@ -710,7 +710,7 @@ mod tests {
|
||||||
assert!(info.lane_id == 1 || info.lane_id == 2);
|
assert!(info.lane_id == 1 || info.lane_id == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.position = own_pos_passed;
|
state.pos.position = own_pos_passed;
|
||||||
state.run_glosa();
|
state.run_glosa();
|
||||||
assert!(matches!(state.glosa_state, GlosaState::Idle));
|
assert!(matches!(state.glosa_state, GlosaState::Idle));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue