applogic: Move to generic position state interface
This commit is contained in:
parent
055b03850b
commit
f32887df61
2 changed files with 61 additions and 36 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -40,8 +40,7 @@ const WIFI_CHANNEL: radio::Channel = 180;
|
|||
esp_bootloader_esp_idf::esp_app_desc!();
|
||||
|
||||
#[cfg(feature = "gnss")]
|
||||
static GNSS_UPDATE: Mutex<RefCell<Option<embassy_gps::types::GpsFix>>> =
|
||||
Mutex::new(RefCell::new(None));
|
||||
static GNSS_UPDATE: Mutex<RefCell<Option<applogic::GnssFix>>> = Mutex::new(RefCell::new(None));
|
||||
static WIFI_RX_QUEUE: Mutex<RefCell<Option<ArrayQueue<Vec<u8>>>>> = Mutex::new(RefCell::new(None));
|
||||
|
||||
#[allow(
|
||||
|
|
@ -341,9 +340,17 @@ async fn gnss_task(
|
|||
fix_drop_message = !fix_drop_message;
|
||||
if fix_drop_message {
|
||||
// send to main thread
|
||||
let pos_state = applogic::GnssFix {
|
||||
time: fix.get_timestamp(),
|
||||
latitude_deg: fix.latitude_deg,
|
||||
longitude_deg: fix.longitude_deg,
|
||||
heading_deg: fix.true_course_deg,
|
||||
speed_mps: fix.speed_over_ground,
|
||||
};
|
||||
|
||||
critical_section::with(|cs| {
|
||||
let gnss_update_ref = GNSS_UPDATE.borrow(cs);
|
||||
gnss_update_ref.replace(Some(fix));
|
||||
gnss_update_ref.replace(Some(pos_state));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue