refactor: use from_bits_truncate directly when reading bitmaps

This commit is contained in:
Maciej Pędzich 2025-02-19 10:46:17 +01:00
parent 839e1ab30b
commit 2ccfdae321
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D
2 changed files with 6 additions and 6 deletions

View File

@ -63,23 +63,23 @@ pub struct CarTelemetryData {
/// Rev lights indicator (percentage).
pub rev_lights_percent: u8,
/// Bitmap of active rev lights.
#[br(map(|bits: u16| RevLights::from_bits_truncate(bits)))]
#[br(map(RevLights::from_bits_truncate))]
pub rev_lights_bit_value: RevLights,
/// Brake temperatures in degrees Celsius.
/// Brakes' temperature values in degrees Celsius.
/// See [`wheel_index`](mod@crate::constants::wheel_index)
/// for wheel order.
pub brakes_temperature: [u16; 4],
/// Tyres' surface temperature in degrees Celsius.
/// Tyres' surface temperature values in degrees Celsius.
/// See [`wheel_index`](mod@crate::constants::wheel_index)
/// for wheel order.
pub tyres_surface_temperature: [u8; 4],
/// Tyres' inner temperature in degrees Celsius.
/// Tyres' inner temperature values in degrees Celsius.
/// See [`wheel_index`](mod@crate::constants::wheel_index)
/// for wheel order.
pub tyres_inner_temperature: [u8; 4],
/// Engine's temperature in degrees Celsius
pub engine_temperature: u16,
/// Tyres' pressue temperature in degrees Celsius.
/// Tyre pressure values in PSI.
/// See [`wheel_index`](mod@crate::constants::wheel_index)
/// for wheel order.
pub tyres_pressure: [f32; 4],

View File

@ -130,7 +130,7 @@ pub enum EventDataDetails {
#[br(magic = b"BUTN")]
Buttons {
/// Bit flags specifying which buttons are currently pressed.
#[br(map(|bits: u32| ButtonStatus::from_bits_truncate(bits)))]
#[br(map(ButtonStatus::from_bits_truncate))]
button_status: ButtonStatus,
},
}