Skip to content

Commit

Permalink
Use timestamp-enabled serial protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed Jul 6, 2024
1 parent 4be1340 commit 3ff0e83
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ futures = "0.3.30"
log = "0.4.22"
ratatui = "0.27.0"
serde = { version = "1.0.203", features = ["derive"] }
serial-sensors-proto = { version = "0.3.0", features = ["std", "alloc", "unsafe", "quaternion", "micromath"] }
# serial-sensors-proto = { git = "https://github.com/sunsided/serial-sensors-proto", features = ["std", "alloc", "unsafe", "quaternion", "micromath"] }
serial-sensors-proto = { version = "0.4.0", features = ["std", "alloc", "unsafe", "quaternion", "micromath"] }
signal-hook = "0.3.17"
tokio = { version = "1.38.0", features = ["full"] }
tokio-serial = "5.4.4"
Expand All @@ -42,5 +41,8 @@ json5 = "0.4.1"
ttl-queue = "0.2.0"
num-traits = "0.2.19"

[patch.crates-io]
# serial-sensors-proto = { git = "https://github.com/sunsided/serial-sensors-proto", features = ["std", "alloc", "unsafe", "quaternion", "micromath"] }

[dev-dependencies]
pretty_assertions = "1.4.0"
17 changes: 17 additions & 0 deletions src/components/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@ pub fn frame_data_to_line_raw(frame: &Version1DataFrame, line: &mut Vec<Span>) {
")".into(),
]);
}
SensorData::GyroscopeI16(vec) => {
let (highlight_x, highlight_y, highlight_z) = highlight_axis_3(vec.x, vec.y, vec.z);

line.extend(vec![
Span::styled("gyro", Style::default().cyan()),
" = (".into(),
raw_to_span(vec.x, highlight_x),
", ".into(),
raw_to_span(vec.y, highlight_y),
", ".into(),
raw_to_span(vec.z, highlight_z),
")".into(),
]);
}
SensorData::TemperatureI16(value) => {
line.extend(vec![
Span::styled("temp", Style::default().cyan()),
Expand Down Expand Up @@ -283,6 +297,9 @@ pub fn frame_data_to_line(
SensorData::MagnetometerI16(vec) => {
line.extend(format_vec3(id, receiver, vec, "mag"));
}
SensorData::GyroscopeI16(vec) => {
line.extend(format_vec3(id, receiver, vec, "gyro"));
}
SensorData::TemperatureI16(value) => {
line.extend(format_scalar(id, receiver, value, "temp"));
line.push("°C".into());
Expand Down

0 comments on commit 3ff0e83

Please sign in to comment.