fix: resolve 7 code review issues from v0.4.x

- Fix KSUDP clutch field reading fuel at offset 59 (KSUDP has no clutch input)
- Replace Notify with watch::channel for reliable shutdown (no missed wakeups)
- Deduplicate read_u16 from parser_pcars into shared binary_utils
- Remove dead Display impl for FeedSource
- Remove unused read_i8 helper from binary_utils
- Change Vec<Instant> to [Instant; 50] in FeedState (eliminate heap alloc)
- Cache rarely-changing strings by driver_id in Telemetry Tool parser
This commit is contained in:
Jan-Peter von Hunnius 2026-06-04 11:12:55 +02:00
parent 8f50302a78
commit 56d3169033
7 changed files with 98 additions and 45 deletions

View file

@ -43,7 +43,7 @@ pub struct FeedState {
pub last_packet_ago_secs: Option<f64>,
pub start_time: Option<Instant>,
pub last_packet_time: Option<Instant>,
pub packet_timestamps: Vec<Instant>,
pub packet_timestamps: [Instant; RING_CAPACITY],
pub ring_index: usize,
pub ring_count: usize,
pub last_frame: Option<TelemetryFrame>,
@ -62,7 +62,7 @@ impl FeedState {
last_packet_ago_secs: None,
start_time: None,
last_packet_time: None,
packet_timestamps: vec![Instant::now(); RING_CAPACITY],
packet_timestamps: [Instant::now(); RING_CAPACITY],
ring_index: 0,
ring_count: 0,
last_frame: None,
@ -85,9 +85,7 @@ impl FeedState {
self.last_packet_ago_secs = Some(0.0);
if self.ring_count < RING_CAPACITY {
if self.ring_count < self.packet_timestamps.len() {
self.packet_timestamps[self.ring_count] = now;
}
self.packet_timestamps[self.ring_count] = now;
self.ring_count += 1;
self.ring_index = self.ring_count % RING_CAPACITY;
} else {