Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion console_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parking_lot = "0.12.1"
regex = { version = "1.5.6" }
rust-ini = "0.18.0"
sbp = { version = "4.4.0", features = ["json", "link", "swiftnav"] }
sbp-settings = "0.6.11"
sbp-settings = "0.6.12"
env_logger = { version = "0.9", optional = true }
mimalloc = { version = "0.1", default-features = false }
indicatif = { version = "0.16", optional = true }
Expand Down
24 changes: 17 additions & 7 deletions console_backend/src/main_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ pub fn logging_stats_thread(
start_time = Instant::now();
}
if let Some(ref path) = filepath {
let file_size = std::fs::metadata(path).unwrap().len();
refresh_loggingbar_recording(
&client_sender,
file_size,
start_time.elapsed().as_secs(),
Some(path.to_string_lossy().to_string()),
);
if let Ok(metadata) = std::fs::metadata(path) {
let file_size = metadata.len();
refresh_loggingbar_recording(
&client_sender,
file_size,
start_time.elapsed().as_secs(),
Some(path.to_string_lossy().to_string()),
);
}
} else {
refresh_loggingbar_recording(&client_sender, 0, 0, None);
}
Expand Down Expand Up @@ -114,6 +116,9 @@ impl MainTab {
pub fn init_csv_logging(&mut self) {
let local_t = Local::now();

if let Err(e) = create_directory(self.logging_directory.clone()) {
error!("Issue creating directory {}.", e);
}
let vel_log_file = local_t.format(VEL_TIME_STR_FILEPATH).to_string();
let vel_log_file = self.logging_directory.join(vel_log_file);
self.shared_state.start_vel_log(&vel_log_file);
Expand Down Expand Up @@ -143,6 +148,11 @@ impl MainTab {
/// - `logging`: The type of sbp logging to use; otherwise, None.
pub fn init_sbp_logging(&mut self, logging: SbpLogging) {
let filepath = self.sbp_logging_filepath(logging.clone());
if let Some(parent) = filepath.parent() {
if let Err(e) = create_directory(parent.to_path_buf()) {
error!("Issue creating directory {}.", e);
}
}
self.sbp_logger = match logging {
SbpLogging::SBP => match SbpLogger::new_sbp(&filepath) {
Ok(logger) => Some(logger),
Expand Down
19 changes: 18 additions & 1 deletion console_backend/src/settings_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use crate::types::{Error, MsgSender, Result};
use crate::utils::*;

const FIRMWARE_VERSION_SETTING_KEY: &str = "firmware_version";
const PRODUCT_ID_SETTING_KEY: &str = "product_id";
const ALLOWED_PRODUCT_ID_SUBSTRINGS: [&str; 2] = ["Piksi Multi", "Duro"];
const DGNSS_SOLUTION_MODE_SETTING_KEY: &str = "dgnss_solution_mode";

const ETHERNET_SETTING_GROUP: &str = "ethernet";
Expand Down Expand Up @@ -458,17 +460,32 @@ impl SettingsTab {
for e in errors {
warn!("{}", e);
}
let mut firmware_version = None;
let mut product_id = None;
for entry in settings {
if let Some(ref value) = entry.value {
if FIRMWARE_VERSION_SETTING_KEY == entry.setting.name {
self.shared_state.set_firmware_version(value.to_string());
firmware_version = Some(value.to_string());
}
if PRODUCT_ID_SETTING_KEY == entry.setting.name {
product_id = Some(value.to_string());
}
if DGNSS_SOLUTION_MODE_SETTING_KEY == entry.setting.name {
self.shared_state.set_dgnss_enabled(value.to_string());
}
}
self.settings.lock().insert(entry);
}
if let Some(product_id) = product_id {
for substring in ALLOWED_PRODUCT_ID_SUBSTRINGS {
if product_id.contains(substring) {
if let Some(firmware_version) = firmware_version {
self.shared_state.set_firmware_version(firmware_version);
}
break;
}
}
}
}

/// Package settings table data into a message buffer and send to frontend.
Expand Down
6 changes: 6 additions & 0 deletions console_backend/src/update_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,15 @@ fn wait_for_device_settings(
update_tab_context: UpdateTabContext,
shared_state: SharedState,
) -> Result<()> {
update_tab_context.fw_log_append(
"Warning: Settings received from Piksi do not contain firmware version information. \
Unable to determine software update status."
.to_string(),
);
while is_running.get() && !update_tab_context.debug() {
if let Some(firmware_version) = shared_state.firmware_version() {
update_tab_context.set_current_firmware_version(firmware_version);
update_tab_context.fw_log_clear();
check_console_outdated(update_tab_context.clone())?;
check_firmware_outdated(update_tab_context.clone())?;
check_above_v2(update_tab_context)?;
Expand Down
2 changes: 1 addition & 1 deletion resources/UpdateTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ MainTab {
fwLogTextArea.text = updateTabData.fw_text;

firmwareDownload.downloadButtonEnable = !updateTabData.downloading && !updateTabData.upgrading;
firmwareVersion.upgradeButtonEnable = !updateTabData.upgrading && !updateTabData.downloading;
firmwareVersion.upgradeButtonEnable = updateTabData.fw_version_current && !updateTabData.upgrading && !updateTabData.downloading;
if (!firmwareVersion.localFileTextEditing)
firmwareVersion.localFileText = updateTabData.fw_local_filename;

Expand Down