Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95c2376caf | ||
|
|
b079b509ae | ||
|
|
a1ee228d72 |
4 changed files with 71 additions and 41 deletions
12
src/ble.rs
12
src/ble.rs
|
|
@ -120,17 +120,7 @@ pub async fn run(
|
|||
..
|
||||
} = stack.build();
|
||||
|
||||
let mut features = alloc::vec![];
|
||||
if cfg!(feature = "cam") {
|
||||
features.push("cam");
|
||||
}
|
||||
if cfg!(feature = "denm") {
|
||||
features.push("denm");
|
||||
}
|
||||
if cfg!(feature = "spat") {
|
||||
features.push("mapem");
|
||||
features.push("spatem");
|
||||
}
|
||||
let mut features = crate::util::get_rx_feature_list();
|
||||
info!(
|
||||
"Starting advertising and GATT service for {}",
|
||||
features.join(",")
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ mod io;
|
|||
mod screen;
|
||||
#[cfg(feature = "gnss_ubx")]
|
||||
mod ubx;
|
||||
mod util;
|
||||
|
||||
const WIFI_CHANNEL: radio::Channel = 180;
|
||||
const WIFI_TXPOWER: i8 = 10; // dBm, 2..20
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ where
|
|||
self.clear()?;
|
||||
|
||||
text::Text::with_alignment(
|
||||
"Searching...",
|
||||
"Searching\nupcoming\nintersection...",
|
||||
geometry::Point::new(i32::from(self.size.width) / 2, 130 + self.size.offset_top),
|
||||
Self::DEFAULT_TEXT_STYLE,
|
||||
text::Alignment::Center,
|
||||
|
|
@ -614,41 +614,48 @@ where
|
|||
|
||||
self.clear_all()?;
|
||||
|
||||
let sig_width = i32::from(self.size.width) / 3;
|
||||
let circle_dia = 50;
|
||||
let circle_margin = (sig_width - circle_dia) / 2;
|
||||
|
||||
for (idx, style) in [Self::RD_STYLE, Self::YE_STYLE, Self::GN_STYLE]
|
||||
.iter()
|
||||
.enumerate()
|
||||
#[cfg(feature = "spat")]
|
||||
{
|
||||
#[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap)]
|
||||
let offset = (idx as i32) * sig_width;
|
||||
let sig_width = i32::from(self.size.width) / 3;
|
||||
let circle_dia = 50;
|
||||
let circle_margin = (sig_width - circle_dia) / 2;
|
||||
|
||||
primitives::Circle::new(
|
||||
geometry::Point::new(offset + circle_margin, 15 + self.size.offset_top),
|
||||
circle_dia.cast_unsigned(),
|
||||
for (idx, style) in [Self::RD_STYLE, Self::YE_STYLE, Self::GN_STYLE]
|
||||
.iter()
|
||||
.enumerate()
|
||||
{
|
||||
#[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap)]
|
||||
let offset = (idx as i32) * sig_width;
|
||||
|
||||
primitives::Circle::new(
|
||||
geometry::Point::new(offset + circle_margin, 15 + self.size.offset_top),
|
||||
circle_dia.cast_unsigned(),
|
||||
)
|
||||
.into_styled(*style)
|
||||
.draw(&mut self.target)?;
|
||||
}
|
||||
|
||||
// draw welcome text
|
||||
let centerline = i32::from(self.size.width) / 2;
|
||||
|
||||
embedded_graphics::image::Image::new(
|
||||
&self.bike_image,
|
||||
geometry::Point::new(centerline - (45 / 2) + 1, 75 + self.size.offset_top),
|
||||
)
|
||||
.draw(&mut self.target)?;
|
||||
|
||||
text::Text::with_alignment(
|
||||
"C-ITS Signal Phase\nWaiting for GNSS...",
|
||||
geometry::Point::new(centerline, 130 + self.size.offset_top),
|
||||
text_style,
|
||||
text::Alignment::Center,
|
||||
)
|
||||
.into_styled(*style)
|
||||
.draw(&mut self.target)?;
|
||||
}
|
||||
|
||||
// draw welcome text
|
||||
let centerline = i32::from(self.size.width) / 2;
|
||||
|
||||
embedded_graphics::image::Image::new(
|
||||
&self.bike_image,
|
||||
geometry::Point::new(centerline - (45 / 2) + 1, 75 + self.size.offset_top),
|
||||
)
|
||||
.draw(&mut self.target)?;
|
||||
|
||||
text::Text::with_alignment(
|
||||
"C-ITS Signal Phase\nWaiting for GNSS...",
|
||||
geometry::Point::new(centerline, 130 + self.size.offset_top),
|
||||
text_style,
|
||||
text::Alignment::Center,
|
||||
)
|
||||
.draw(&mut self.target)?;
|
||||
// show features
|
||||
let enabled_features = crate::util::get_rx_feature_list();
|
||||
let enabled_tx_features = crate::util::get_tx_feature_list();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
32
src/util.rs
Normal file
32
src/util.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//! Some stuff used at several places
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn get_rx_feature_list() -> Vec<&'static str> {
|
||||
let mut features = alloc::vec![];
|
||||
if cfg!(feature = "cam") {
|
||||
features.push("cam");
|
||||
}
|
||||
if cfg!(feature = "denm") {
|
||||
features.push("denm");
|
||||
}
|
||||
if cfg!(feature = "spat") {
|
||||
features.push("mapem");
|
||||
features.push("spatem");
|
||||
}
|
||||
|
||||
features
|
||||
}
|
||||
|
||||
pub(crate) fn get_tx_feature_list() -> Vec<&'static str> {
|
||||
let mut features = alloc::vec![];
|
||||
if cfg!(feature = "cam_tx") {
|
||||
features.push("cam-tx");
|
||||
}
|
||||
if cfg!(feature = "uart") {
|
||||
features.push("uart-tx");
|
||||
}
|
||||
|
||||
features
|
||||
}
|
||||
Loading…
Reference in a new issue