Skip to content

Commit a779a37

Browse files
author
Jason Mobarak
authored
bug roll-up [CPP-732][CPP-741][CPP-735][CPP-734][CPP-731][CPP-466] (#597)
Fixes: Don't abbreviate "WARN", use "WARNING" instead Fix-up description for "NTRIP enable" settings Advanced system monitor: add units to stack column, format CPU usage with at least one decimal always Change plot axis to not use bold fonts Format network tx/rx bytes as float so that fractional information is maintained
1 parent d8fdc8c commit a779a37

File tree

10 files changed

+46
-23
lines changed

10 files changed

+46
-23
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,22 @@ command = "cargo"
906906
cwd = "console_backend"
907907
args = ["test", "--features", "tests", "${@}", "--", "--nocapture"]
908908

909+
[tasks.rust-tests-filter]
910+
dependencies = ["store-version", "copy-capnp"]
911+
command = "cargo"
912+
cwd = "console_backend"
913+
args = [
914+
'test',
915+
'--package',
916+
'console-backend',
917+
'--lib',
918+
'--all-features',
919+
'--',
920+
'${RUST_TEST_FILTER}',
921+
'--exact',
922+
'--nocapture',
923+
]
924+
909925
[tasks.rust-type-check]
910926
dependencies = ["store-version", "copy-capnp"]
911927
command = "cargo"

console_backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ parking_lot = "0.12.1"
4141
regex = { version = "1.5.6" }
4242
rust-ini = "0.18.0"
4343
sbp = { version = "4.3.3", features = ["json", "link", "swiftnav"] }
44-
sbp-settings = "0.6.9"
44+
sbp-settings = "0.6.10"
4545
env_logger = { version = "0.9", optional = true }
4646
mimalloc = { version = "0.1", default-features = false }
4747
indicatif = { version = "0.16", optional = true }

console_backend/src/advanced_networking_tab.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ mod tests {
258258
let entry = tab.network_info.get(interface_name_pre).unwrap();
259259
assert_eq!(entry.ipv4_address, "127.0.0.1");
260260
assert!(entry.running);
261-
assert_eq!(entry.tx_usage, format!(" {}B", tx_bytes));
262-
assert_eq!(entry.rx_usage, format!(" {}B", rx_bytes));
261+
assert_eq!(entry.tx_usage, format!("{:.1}B", tx_bytes as f64));
262+
assert_eq!(entry.rx_usage, format!("{:.1}B", rx_bytes as f64));
263263
let bad_flags = 0b0100000;
264264
let msg = MsgNetworkStateResp {
265265
sender_id,

console_backend/src/log_panel.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn handle_log_msg(msg: MsgLog) {
3939
| SbpMsgLevel::Alert
4040
| SbpMsgLevel::Critical
4141
| SbpMsgLevel::Error => error!(target: DEVICE, "{}", text),
42-
SbpMsgLevel::Warn | SbpMsgLevel::Notice => warn!(target: DEVICE, "{}", text),
42+
SbpMsgLevel::Warning | SbpMsgLevel::Notice => warn!(target: DEVICE, "{}", text),
4343
SbpMsgLevel::Info => info!(target: DEVICE, "{}", text),
4444
_ => debug!(target: DEVICE, "{}", text),
4545
}
@@ -122,7 +122,7 @@ enum SbpMsgLevel {
122122
Alert = 1,
123123
Critical = 2,
124124
Error = 3,
125-
Warn = 4,
125+
Warning = 4,
126126
Notice = 5,
127127
Info = 6,
128128
Debug = 7,
@@ -136,7 +136,7 @@ impl From<u8> for SbpMsgLevel {
136136
1 => SbpMsgLevel::Alert,
137137
2 => SbpMsgLevel::Critical,
138138
3 => SbpMsgLevel::Error,
139-
4 => SbpMsgLevel::Warn,
139+
4 => SbpMsgLevel::Warning,
140140
5 => SbpMsgLevel::Notice,
141141
6 => SbpMsgLevel::Info,
142142
7 => SbpMsgLevel::Debug,
@@ -181,7 +181,12 @@ fn splitable_log_formatter(record: &Record) -> String {
181181
let level = if record.target() != DEVICE {
182182
CONSOLE
183183
} else {
184-
record.level().as_str()
184+
let level = record.level().as_str();
185+
if level == "WARN" {
186+
"WARNING"
187+
} else {
188+
level
189+
}
185190
};
186191
let timestamp = Local::now().format("%b %d %Y %H:%M:%S").to_string();
187192
let mut msg = record.args().to_string();

console_backend/src/utils.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,12 @@ pub fn meters_per_deg(lat_deg: f64) -> (f64, f64) {
353353
///
354354
/// - The number of bytes converted to a human readable string.
355355
pub fn bytes_to_human_readable(bytes: u128) -> String {
356-
let mut bytes = bytes;
356+
let mut bytes = bytes as f64;
357357
for unit in ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"].iter() {
358-
if bytes < 1024 {
359-
return format!("{:3.1}{}", bytes, unit);
358+
if bytes < 1024.0 {
359+
return format!("{:3.1}{}", bytes as f64, unit);
360360
} else {
361-
bytes /= 1024;
361+
bytes /= 1024.0;
362362
}
363363
}
364364
format!("{:.1}YB", bytes)
@@ -543,17 +543,18 @@ mod tests {
543543
.for_each(|(idx, &unit)| {
544544
assert_eq!(
545545
bytes_to_human_readable(u128::pow(1024, idx as u32)),
546-
format!("{:3.1}{}", 1, unit)
546+
format!("{:3.1}{}", 1.0, unit)
547547
);
548548
});
549549
assert_eq!(
550550
bytes_to_human_readable(u128::pow(1024, 8)),
551-
format!("{:.1}YB", 1)
551+
format!("{:.1}YB", 1.0)
552552
);
553553
assert_eq!(
554554
bytes_to_human_readable(u128::pow(1024, 9)),
555-
format!("{:.1}YB", 1024)
555+
format!("{:.1}YB", 1024.0)
556556
);
557+
assert_eq!(bytes_to_human_readable(230123123), "219.5MB");
557558
}
558559

559560
#[test]

resources/Constants/Constants.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ QtObject {
178178
}
179179

180180
systemMonitor: QtObject {
181-
readonly property var columnHeaders: ["Thread Name", "CPU %", "Stack Free"]
181+
readonly property var columnHeaders: ["Thread Name", "CPU %", "Stack Free (B)"]
182182
readonly property var metricColumnHeaders: ["Metric", "Value"]
183183
readonly property string currLabel: "Curr"
184184
readonly property string maxLabel: "Max"
@@ -214,7 +214,7 @@ QtObject {
214214
readonly property var defaultThreadsList: {
215215
"Thread Name": "",
216216
"CPU %": "",
217-
"Stack Free": ""
217+
"Stack Free (B)": ""
218218
}
219219
readonly property var defaultMetricsList: {
220220
"Metric": "",
@@ -579,7 +579,7 @@ QtObject {
579579
readonly property font axisLabelsFont: Qt.font({
580580
"family": fontFamily,
581581
"pixelSize": smallPixelSize,
582-
"bold": true
582+
"bold": false
583583
})
584584
readonly property int tickPixelSize: 10
585585
readonly property int buttonHeight: 40

resources/SettingsTabComponents/SettingsTable.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ Rectangle {
4141

4242
function row(entry) {
4343
return {
44-
[Constants.settingsTable.tableLeftColumnHeader]: entry.name,
44+
[Constants.settingsTable.tableLeftColumnHeader]: entry.name.replace(/_/g, " "),
4545
[Constants.settingsTable.tableRightColumnHeader]: entry.valueOnDevice || "---"
4646
};
4747
}
4848

4949
function headerRow(entry) {
5050
return {
51-
[Constants.settingsTable.tableLeftColumnHeader]: entry.group,
51+
[Constants.settingsTable.tableLeftColumnHeader]: entry.group.replace(/_/g, " "),
5252
[Constants.settingsTable.tableRightColumnHeader]: ""
5353
};
5454
}

src/main/resources/base/console_backend.capnp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct LogLevelFront {
2929

3030
enum LogLevel {
3131
error @0;
32-
warn @1;
32+
warning @1;
3333
info @2;
3434
debug @3;
3535
trace @4;

swiftnav_console/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ def _process_message_buffer(self, buffer):
403403
data[Keys.OBS_LATENCY][:] = [[entry.key, entry.val] for entry in m.advancedSystemMonitorStatus.obsLatency]
404404
data[Keys.OBS_PERIOD][:] = [[entry.key, entry.val] for entry in m.advancedSystemMonitorStatus.obsPeriod]
405405
data[Keys.THREADS_TABLE][:] = [
406-
[entry.name, entry.cpu, entry.stackFree] for entry in m.advancedSystemMonitorStatus.threadsTable
406+
[entry.name, "%.1f" % entry.cpu, entry.stackFree]
407+
for entry in m.advancedSystemMonitorStatus.threadsTable
407408
]
408409
data[Keys.CSAC_TELEM_LIST][:] = [
409410
[entry.key, entry.val] for entry in m.advancedSystemMonitorStatus.csacTelemList

0 commit comments

Comments
 (0)