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:
parent
8f50302a78
commit
56d3169033
7 changed files with 98 additions and 45 deletions
|
|
@ -366,15 +366,6 @@ fn parse_v2_car_physics(data: &[u8]) -> Result<TelemetryFrame, PcarsParseError>
|
|||
Ok(frame)
|
||||
}
|
||||
|
||||
/// Read a u16 at the given offset (little-endian).
|
||||
fn read_u16(data: &[u8], offset: usize) -> u16 {
|
||||
let buf: [u8; 2] = data
|
||||
.get(offset..offset + 2)
|
||||
.and_then(|s| s.try_into().ok())
|
||||
.unwrap_or([0u8; 2]);
|
||||
u16::from_le_bytes(buf)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue