Skip to content

Commit c6dc626

Browse files
committed
feat: add slip alert to alert panel. This resolves #1.
1 parent 856bc4f commit c6dc626

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

assets/slip-grey.png

3.44 KB
Loading

assets/slip-red.png

3.45 KB
Loading

src/live/alerts_view.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use egui::{Align, CornerRadius, Frame, Id, Image, ImageButton, Layout, Sense, ViewportCommand};
22

33
use crate::telemetry::{
4-
short_shifting_analyzer::SHORT_SHIFT_ANNOTATION,
4+
short_shifting_analyzer::SHORT_SHIFT_ANNOTATION, slip_analyzer::SLIP_ANNOTATION,
55
trailbrake_steering_analyzer::TRAILBRAKE_EXCESSIVE_STEERING_ANNOTATION, TelemetryAnnotation,
66
};
77

@@ -88,6 +88,7 @@ impl LiveTelemetryApp {
8888
let mut shift_image = egui::include_image!("../../assets/shift-grey.png");
8989
let mut wheelspin_image = egui::include_image!("../../assets/wheelspin-green.png");
9090
let mut trailbrake_steering_image = egui::include_image!("../../assets/steering-grey.png");
91+
let mut slip_image = egui::include_image!("../../assets/slip-grey.png");
9192
if let Some(back) = self.telemetry_points.back() {
9293
// brake ABS alert
9394
if back.brake > 0.4 && !back.abs_active {
@@ -127,6 +128,11 @@ impl LiveTelemetryApp {
127128
{
128129
trailbrake_steering_image = egui::include_image!("../../assets/steering-red.png");
129130
}
131+
132+
// slip alert
133+
if let Some(TelemetryAnnotation::Bool(true)) = back.annotations.get(SLIP_ANNOTATION) {
134+
slip_image = egui::include_image!("../../assets/slip-red.png");
135+
}
130136
}
131137
let button_align = match self.app_config.alerts_layout {
132138
AlertsLayout::Vertical => Align::Center,
@@ -151,5 +157,10 @@ impl LiveTelemetryApp {
151157
ui.label("Trailbraking");
152158
ui.add(Image::new(trailbrake_steering_image));
153159
});
160+
ui.separator();
161+
ui.with_layout(Layout::top_down(button_align), |ui| {
162+
ui.label("Slip");
163+
ui.add(Image::new(slip_image));
164+
});
154165
}
155166
}

src/live/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) enum AlertsLayout {
1616
impl AlertsLayout {
1717
pub(crate) fn window_size(&self) -> Vec2 {
1818
match self {
19-
Self::Vertical => Vec2::new(100., 600.),
19+
Self::Vertical => Vec2::new(80., 600.),
2020
Self::Horizontal => Vec2::new(600., 100.),
2121
}
2222
}

src/telemetry/collector.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ use crate::telemetry::TelemetryPoint;
1010
use crate::OcypodeError;
1111

1212
use super::{
13-
producer::{TelemetryProducer, CONN_RETRY_MAX_WAIT_S}, short_shifting_analyzer::ShortShiftingAnalyzer, slip_analyzer::SlipAnalyzer, trailbrake_steering_analyzer::{
13+
producer::{TelemetryProducer, CONN_RETRY_MAX_WAIT_S},
14+
short_shifting_analyzer::ShortShiftingAnalyzer,
15+
slip_analyzer::SlipAnalyzer,
16+
trailbrake_steering_analyzer::{
1417
TrailbrakeSteeringAnalyzer, MAX_TRAILBRAKING_STEERING_ANGLE, MIN_TRAILBRAKING_PCT,
15-
}, wheelspin_analyzer::WheelspinAnalyzer, TelemetryAnalyzer, TelemetryAnnotation
18+
},
19+
wheelspin_analyzer::WheelspinAnalyzer,
20+
TelemetryAnalyzer, TelemetryAnnotation,
1621
};
1722

1823
const REFRESH_RATE_MS: u64 = 100;

0 commit comments

Comments
 (0)