Fix and improve pedals

This commit is contained in:
hodasemi 2023-01-17 16:05:31 +01:00
parent cab4701289
commit be7a746931
2 changed files with 4 additions and 4 deletions

View file

@ -60,9 +60,9 @@ impl DataReceiver for Pedals {
if let Some(telemetry) = telemetries.iter().find(|telemetry| telemetry.id == id) { if let Some(telemetry) = telemetries.iter().find(|telemetry| telemetry.id == id) {
self.brake self.brake
.set_progress(telemetry.unfiltered_throttle as f32)?; .set_progress(1.0 - telemetry.unfiltered_brake as f32)?;
self.throttle self.throttle
.set_progress(telemetry.unfiltered_throttle as f32)?; .set_progress(1.0 - telemetry.unfiltered_throttle as f32)?;
self.gear.set_text(telemetry.gear)?; self.gear.set_text(telemetry.gear)?;
let fuel = telemetry.fuel; let fuel = telemetry.fuel;
self.fuel.set_text(format!("{:.2}", fuel))?; self.fuel.set_text(format!("{:.2}", fuel))?;

View file

@ -2,10 +2,10 @@
<root reference_width="2560" reference_height="1440"> <root reference_width="2560" reference_height="1440">
<grid x_dim="7" y_dim="2" x_offset="-750" y_offset="-250" width="150" height="200" <grid x_dim="7" y_dim="2" x_offset="-750" y_offset="-250" width="150" height="200"
vert_align="bottom" hori_align="right" margin="3" padding="3" background="#686868"> vert_align="bottom" hori_align="right" margin="3" padding="3" background="#686868">
<progressbar id="brake" x_slot="0" y_slot="0" y_size="2" background="#f44444" <progressbar id="brake" x_slot="0" y_slot="0" y_size="2" background="#494949"
direction="bottom_to_top" foreground="#e30000"></progressbar> direction="bottom_to_top" foreground="#e30000"></progressbar>
<progressbar id="throttle" <progressbar id="throttle"
x_slot="1" y_slot="0" y_size="2" background="#51fd51" direction="bottom_to_top" x_slot="1" y_slot="0" y_size="2" background="#494949" direction="bottom_to_top"
foreground="#00b900"></progressbar> foreground="#00b900"></progressbar>
<label id="fuel" x_slot="2" <label id="fuel" x_slot="2"
x_size="5" y_slot="0" x_size="5" y_slot="0"