Skip to content

Commit f32799b

Browse files
StatusBar Position/RTK bug fixes[CPP-691] (#481)
1 parent 32699a8 commit f32799b

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

console_backend/src/shared_state.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,15 @@ impl ConnectionState {
913913
ConnectionState::Connected { conn, .. } => conn.name(),
914914
}
915915
}
916+
917+
pub fn is_file(&self) -> bool {
918+
match self {
919+
ConnectionState::Closed => false,
920+
ConnectionState::Disconnected => false,
921+
ConnectionState::Connecting => false,
922+
ConnectionState::Connected { conn, .. } => conn.is_file(),
923+
}
924+
}
916925
}
917926

918927
impl std::fmt::Display for ConnectionState {

console_backend/src/status_bar.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl StatusBar {
104104
heartbeat_data.reset();
105105
heartbeat_data.set_port(shared_state.connection().name());
106106
heartbeat_data.set_version(shared_state.console_version());
107+
heartbeat_data.set_conn_is_file(shared_state.connection().is_file());
107108
StatusBar { heartbeat_data }
108109
}
109110

@@ -291,6 +292,7 @@ pub struct HeartbeatInner {
291292
ant_status: String,
292293
baseline_display_mode: String,
293294
baseline_solution_mode: u8,
295+
conn_is_file: bool,
294296
current_time: Instant,
295297
data_rate: f64,
296298
dgnss_enabled: bool,
@@ -323,6 +325,7 @@ impl HeartbeatInner {
323325
ant_status: String::from(EMPTY_STR),
324326
baseline_display_mode: String::from(EMPTY_STR),
325327
baseline_solution_mode: 0,
328+
conn_is_file: false,
326329
current_time: Instant::now(),
327330
data_rate: 0.0,
328331
dgnss_enabled: false,
@@ -374,13 +377,13 @@ impl HeartbeatInner {
374377
}
375378

376379
pub fn pos_llh_update(&mut self) {
380+
self.llh_display_mode = String::from(EMPTY_STR);
377381
if let Some(last_stime_update) = self.last_stime_update {
378382
if (self.current_time - last_stime_update).as_secs_f64() < UPDATE_TOLERANCE_SECONDS {
379-
let llh_display_mode = GnssModes::from(self.llh_solution_mode);
380-
self.llh_display_mode = llh_display_mode.pos_mode();
383+
self.llh_display_mode = GnssModes::from(self.llh_solution_mode).pos_mode();
381384
self.llh_is_rtk = RTK_MODES.contains(&(self.llh_solution_mode as i32));
382385
if self.ins_used && (self.llh_solution_mode as i32) != DR_MODE {
383-
self.llh_display_mode = format!("{}{}", llh_display_mode, INS_POSTFIX);
386+
self.llh_display_mode = format!("{}{}", self.llh_display_mode, INS_POSTFIX);
384387
}
385388
}
386389
}
@@ -389,7 +392,7 @@ impl HeartbeatInner {
389392
pub fn baseline_ned_update(&mut self) {
390393
self.baseline_display_mode = String::from(EMPTY_STR);
391394
if let Some(last_btime_update) = self.last_btime_update {
392-
if self.dgnss_enabled
395+
if (self.dgnss_enabled || self.conn_is_file)
393396
&& (self.current_time - last_btime_update).as_secs_f64() < UPDATE_TOLERANCE_SECONDS
394397
{
395398
if let Some(bsoln_mode) = rtk_mode_dict.get(&(self.baseline_solution_mode as i32)) {
@@ -527,6 +530,11 @@ impl Heartbeat {
527530
.expect(HEARTBEAT_LOCK_MUTEX_FAILURE)
528531
.dgnss_enabled = dgnss_enabled;
529532
}
533+
pub fn set_conn_is_file(&self, conn_is_file: bool) {
534+
self.lock()
535+
.expect(HEARTBEAT_LOCK_MUTEX_FAILURE)
536+
.conn_is_file = conn_is_file;
537+
}
530538
pub fn set_version(&self, version: String) {
531539
self.lock().expect(HEARTBEAT_LOCK_MUTEX_FAILURE).version = version;
532540
}

0 commit comments

Comments
 (0)