main: Add feature flag for GNSS module
This commit is contained in:
parent
7463adb038
commit
57a6b7983d
4 changed files with 19 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ use alloc::vec::Vec;
|
|||
use esp_println::println;
|
||||
#[cfg(feature = "spat")]
|
||||
use log::{debug, error};
|
||||
#[cfg(feature = "gnss")]
|
||||
use log::{info, warn};
|
||||
|
||||
#[cfg(feature = "spat")]
|
||||
|
|
@ -39,12 +40,16 @@ const GLOSA_LANE_LEFT_OFFSET_M: f64 = 20.;
|
|||
#[cfg(feature = "spat")]
|
||||
const GLOSA_STOP_LINE_PASSED_M: f64 = 10.;
|
||||
|
||||
#[allow(unused)]
|
||||
pub struct State {
|
||||
initialized: bool,
|
||||
time: chrono::NaiveDateTime,
|
||||
|
||||
#[allow(unused)]
|
||||
position: geo_types::Point,
|
||||
#[allow(unused)]
|
||||
heading_deg: Option<f32>,
|
||||
#[allow(unused)]
|
||||
speed_mps: Option<f32>,
|
||||
|
||||
#[cfg(feature = "spat")]
|
||||
|
|
@ -96,7 +101,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp")]
|
||||
#[cfg(all(feature = "esp", feature = "gnss"))]
|
||||
pub fn update_with_gpsfix(&mut self, fix: &embassy_gps::types::GpsFix) {
|
||||
self.position = geo_types::Point::new(fix.longitude_deg, fix.latitude_deg);
|
||||
|
||||
|
|
@ -122,6 +127,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gnss")]
|
||||
pub fn print_fix(&self) -> alloc::string::String {
|
||||
alloc::format!(
|
||||
"{:?}, {:.4} N, {:.4} E, {:.0}°, {:.2} m/s",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue