Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PGM in tracking signals tab[DIP-64][v4.0.x] #1122

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion console_backend/src/process_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use sbp::{
piksi::{MsgDeviceMonitor, MsgNetworkStateResp, MsgThreadState},
system::{
MsgCsacTelemetry, MsgCsacTelemetryLabels, MsgHeartbeat, MsgInsStatus, MsgInsUpdates,
MsgStartup,
MsgStartup, MsgStatusReport

},
tracking::{MsgMeasurementState, MsgTrackingState},
},
Expand Down Expand Up @@ -235,6 +236,12 @@ fn register_events(link: sbp::link::Link<Tabs>) {
.unwrap()
.handle_specan(msg);
});
link.register(|tabs: &Tabs, msg: MsgStatusReport| {
tabs.tracking_signals
.lock()
.unwrap()
.handle_msg_status_report(msg);
});
link.register(|tabs: &Tabs, msg: MsgSvAzEl| {
tabs.tracking_sky_plot.lock().unwrap().handle_sv_az_el(msg);
});
Expand Down
28 changes: 26 additions & 2 deletions console_backend/src/tracking_signals_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use std::{
use capnp::message::Builder;
use log::warn;
use ordered_float::OrderedFloat;
use sbp::messages::tracking::{MeasurementState, TrackingChannelState};

use sbp::messages::{
system::{msg_status_report::System, MsgStatusReport},
tracking::{MeasurementState, TrackingChannelState},
};
use crate::client_sender::BoxedClientSender;
use crate::constants::{
CHART_XMIN_OFFSET_NO_TRACKING, CHART_XMIN_OFFSET_TRACKING, GLO_FCN_OFFSET, GLO_SLOT_SAT_MAX,
Expand Down Expand Up @@ -46,6 +48,8 @@ use crate::utils::{serialize_capnproto_builder, signal_key_color, signal_key_lab
#[derive(Debug)]
pub struct TrackingSignalsTab {
pub at_least_one_track_received: bool,
/// Whether to disable processing of MsgTrackingState and MsgMeasurementState messages.
pub disable_track: bool,
pub check_labels: [&'static str; 13],
pub client_sender: BoxedClientSender,
pub cn0_age: Cn0Age,
Expand All @@ -72,6 +76,7 @@ impl TrackingSignalsTab {
pub fn new(shared_state: SharedState, client_sender: BoxedClientSender) -> TrackingSignalsTab {
TrackingSignalsTab {
at_least_one_track_received: false,
disable_track: false,
check_labels: [
GPS_L1CA_STR,
GPS_L2CM_STR,
Expand Down Expand Up @@ -208,6 +213,9 @@ impl TrackingSignalsTab {
///
/// - `states`: All states contained within the measurementstate message.
pub fn handle_msg_measurement_state(&mut self, states: Vec<MeasurementState>) {
if self.disable_track {
return;
}
self.at_least_one_track_received = true;
let mut codes_that_came: Vec<(SignalCodes, i16)> = Vec::new();
let t = (Instant::now()).duration_since(self.t_init).as_secs_f64();
Expand Down Expand Up @@ -245,12 +253,28 @@ impl TrackingSignalsTab {
self.update_plot();
self.send_data();
}

/// Handle MsgStatusReport message states.
///
/// # Parameters:
///
/// - `msg`: The full SBP message cast as an MsgStatusReport variant.
pub fn handle_msg_status_report(&mut self, msg: MsgStatusReport) {
if let Ok(system) = msg.system() {
self.disable_track = system == System::PrecisionGnssModule;
self.at_least_one_track_received = false;
}
}

/// Handle MsgTrackingState message states.
///
/// # Parameters:
///
/// - `states`: All states contained within the trackingstate message.
pub fn handle_msg_tracking_state(&mut self, states: Vec<TrackingChannelState>) {
if self.disable_track {
return;
}
self.at_least_one_track_received = true;
let mut codes_that_came: Vec<(SignalCodes, i16)> = Vec::new();
let t = (Instant::now()).duration_since(self.t_init).as_secs_f64();
Expand Down