f1_game_packet_parser/packets/
car_setups.rs1use binrw::BinRead;
2use serde::{Deserialize, Serialize};
3
4#[non_exhaustive]
5#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
6#[br(little, import(packet_format: u16))]
7pub struct CarSetupData {
8 pub front_wing: u8,
10 pub rear_wing: u8,
12 #[br(
14 assert(
15 on_throttle <= 100,
16 "Car setup entry has an invalid on-throttle percentage value: {}",
17 on_throttle
18 )
19 )]
20 pub on_throttle: u8,
21 #[br(
23 assert(
24 off_throttle <= 100,
25 "Car setup entry has an invalid off-throttle percentage value: {}",
26 off_throttle
27 )
28 )]
29 pub off_throttle: u8,
30 pub front_camber: f32,
32 pub rear_camber: f32,
34 pub front_toe: f32,
36 pub rear_toe: f32,
38 pub front_suspension: u8,
40 pub rear_suspension: u8,
42 pub front_anti_roll_bar: u8,
44 pub rear_anti_roll_bar: u8,
46 pub front_suspension_height: u8,
48 pub rear_suspension_height: u8,
50 #[br(
52 assert(
53 brake_pressure <= 100,
54 "Car setup entry has an invalid brake pressure percentage value: {}",
55 brake_pressure
56 )
57 )]
58 pub brake_pressure: u8,
59 #[br(
61 assert(
62 brake_bias <= 100,
63 "Car setup entry has an invalid brake bias percentage value: {}",
64 brake_pressure
65 )
66 )]
67 pub brake_bias: u8,
68 #[br(
71 if(packet_format >= 2024),
72 assert(
73 engine_braking <= 100,
74 "Car setup entry has an engine braking percentage value: {}",
75 brake_pressure
76 )
77 )]
78 pub engine_braking: u8,
79 pub rear_left_tyre_pressure: f32,
81 pub rear_right_tyre_pressure: f32,
83 pub front_left_tyre_pressure: f32,
85 pub front_right_tyre_pressure: f32,
87 pub ballast: u8,
89 pub fuel_load: f32,
91}