Skip to content

Commit

Permalink
Show sender-side times
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed Jul 6, 2024
1 parent 3ff0e83 commit 773191d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/sensors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ impl Component for Sensors {
.map(|(id, frame)| (id, frame.expect("value exists")))
.enumerate()
.map(|(no, (id, frame))| {
// TODO: IF time is supported. :)
let time = frame.system_secs as f32 + frame.system_millis as f32 / 1000.0;

let avg_duration = self
.receiver
.get_average_duration_by_sensor(&id)
Expand All @@ -73,6 +76,8 @@ impl Component for Sensors {
let mut lines = vec![
Span::styled(format!("{no}"), Style::default()),
": ".into(),
Span::styled(format!("t={:3.3}", time), Style::default().dim()),
" ".into(),
name,
Span::styled(format!(" {}", id.tag()), Style::default().yellow()),
":".into(),
Expand Down
5 changes: 5 additions & 0 deletions src/components/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ impl Component for StreamingLog {
.iter()
.rev()
.map(|frame| {
// TODO: IF time is supported. :)
let time = frame.system_secs as f32 + frame.system_millis as f32 / 1000.0;

let mut line = vec![
Span::styled(format!("t={:3.3}", time), Style::default().dim()),
" ".into(),
Span::styled(frame.global_sequence.to_string(), Style::default().dim()),
", ".into(),
Span::styled(frame.sensor_tag.to_string(), Style::default().yellow()),
Expand Down

0 comments on commit 773191d

Please sign in to comment.