mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat(gui): add live G29 / Steam Controller input & CRSF monitor in Settings
This commit is contained in:
1 parent
23e24cab5d
commit
ebe0d9889f
5 files changed
+796
-30
No files matched your search
+167
@@ -26,6 +26,7 @@ pub struct SteamFrameGuiApp {
|
||||
video_texture: Option<TextureHandle>,
|
||||
last_displayed_frame_seq: u64,
|
||||
control_switch_error: String,
|
||||
monitor_source_override: Option<ControlSource>,
|
||||
}
|
||||
|
||||
impl SteamFrameGuiApp {
|
||||
@@ -54,6 +55,7 @@ impl SteamFrameGuiApp {
|
||||
video_texture: None,
|
||||
last_displayed_frame_seq: 0,
|
||||
control_switch_error: String::new(),
|
||||
monitor_source_override: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,6 +291,7 @@ impl eframe::App for SteamFrameGuiApp {
|
||||
g29_status,
|
||||
controller_status,
|
||||
active_ctrl_source,
|
||||
latest_g29,
|
||||
latest_ctrl,
|
||||
dvr_status,
|
||||
dvr_recording,
|
||||
@@ -328,6 +331,7 @@ impl eframe::App for SteamFrameGuiApp {
|
||||
mon.g29_status.clone(),
|
||||
mon.controller_status.clone(),
|
||||
mon.active_control_source,
|
||||
mon.latest_g29.clone(),
|
||||
mon.latest_controller.clone(),
|
||||
mon.dvr_status.clone(),
|
||||
mon.dvr_recording,
|
||||
@@ -1017,6 +1021,169 @@ impl eframe::App for SteamFrameGuiApp {
|
||||
ui.end_row();
|
||||
});
|
||||
|
||||
ui.add_space(6.0);
|
||||
egui::Frame::group(ui.style())
|
||||
.fill(Color32::from_rgb(16, 20, 28))
|
||||
.inner_margin(egui::Margin::same(8.0))
|
||||
.show(ui, |ui| {
|
||||
let viewed = self
|
||||
.monitor_source_override
|
||||
.unwrap_or(active_ctrl_source);
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
RichText::new(format!(
|
||||
"📊 Moniteur — {}",
|
||||
viewed.label()
|
||||
))
|
||||
.strong()
|
||||
.color(Color32::from_rgb(90, 220, 255)),
|
||||
);
|
||||
ui.selectable_value(
|
||||
&mut self.monitor_source_override,
|
||||
None,
|
||||
"Auto",
|
||||
);
|
||||
ui.selectable_value(
|
||||
&mut self.monitor_source_override,
|
||||
Some(ControlSource::G29),
|
||||
"G29",
|
||||
);
|
||||
ui.selectable_value(
|
||||
&mut self.monitor_source_override,
|
||||
Some(ControlSource::SteamController),
|
||||
"Steam",
|
||||
);
|
||||
});
|
||||
|
||||
let (
|
||||
online,
|
||||
failsafe,
|
||||
armed,
|
||||
gear_lbl,
|
||||
steer_pct,
|
||||
steer_crsf,
|
||||
throt_pct,
|
||||
throt_crsf,
|
||||
brake_pct,
|
||||
brake_crsf,
|
||||
clutch_pct,
|
||||
clutch_crsf,
|
||||
last_btn,
|
||||
detail,
|
||||
) = if viewed == ControlSource::SteamController {
|
||||
(
|
||||
latest_ctrl.connected,
|
||||
!latest_ctrl.connected,
|
||||
latest_ctrl.armed,
|
||||
latest_ctrl.gear_label(),
|
||||
latest_ctrl.steering_norm * 100.0,
|
||||
latest_ctrl.steer_crsf,
|
||||
latest_ctrl.throttle_pct,
|
||||
latest_ctrl.throttle_crsf,
|
||||
latest_ctrl.brake_pct,
|
||||
latest_ctrl.brake_crsf,
|
||||
latest_ctrl.clutch_pct,
|
||||
latest_ctrl.clutch_crsf,
|
||||
if latest_ctrl.last_button.is_empty() {
|
||||
"Aucun".to_string()
|
||||
} else {
|
||||
latest_ctrl.last_button.clone()
|
||||
},
|
||||
format!(
|
||||
"$RC envoyés : {} (Err : {})",
|
||||
latest_ctrl.packets_sent, latest_ctrl.send_errors
|
||||
),
|
||||
)
|
||||
} else {
|
||||
let live = latest_g29.is_live();
|
||||
(
|
||||
live,
|
||||
!live || latest_g29.failsafe,
|
||||
latest_g29.armed,
|
||||
latest_g29.gear_label(),
|
||||
latest_g29.steering_pct as f32,
|
||||
latest_g29.steer_crsf,
|
||||
latest_g29.throttle_pct,
|
||||
latest_g29.throttle_crsf,
|
||||
latest_g29.brake_pct,
|
||||
latest_g29.brake_crsf,
|
||||
latest_g29.clutch_pct,
|
||||
latest_g29.clutch_crsf,
|
||||
if latest_g29.last_button.is_empty() {
|
||||
"Aucun".to_string()
|
||||
} else {
|
||||
latest_g29.last_button.clone()
|
||||
},
|
||||
format!(
|
||||
"FFB {}% | Vib {}% | RX {} | RP2350: {}",
|
||||
latest_g29.ffb_pct,
|
||||
latest_g29.vib_pct,
|
||||
latest_g29.packets_received,
|
||||
latest_g29.remote_source.wire_tag()
|
||||
),
|
||||
)
|
||||
};
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.colored_label(
|
||||
if online {
|
||||
Color32::from_rgb(80, 235, 130)
|
||||
} else {
|
||||
Color32::GRAY
|
||||
},
|
||||
if online { "● CONNECTÉ" } else { "○ HORS LIGNE" },
|
||||
);
|
||||
ui.label(RichText::new(format!("BOÎTE [{}]", gear_lbl)).strong());
|
||||
ui.colored_label(
|
||||
if failsafe {
|
||||
Color32::from_rgb(255, 80, 80)
|
||||
} else if armed {
|
||||
Color32::from_rgb(80, 235, 130)
|
||||
} else {
|
||||
Color32::from_rgb(255, 185, 60)
|
||||
},
|
||||
if failsafe {
|
||||
"FAILSAFE (CH5: 172)"
|
||||
} else if armed {
|
||||
"ARMED (CH5: 1811)"
|
||||
} else {
|
||||
"SAFE (CH5: 172)"
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
let steer_frac = ((steer_pct + 100.0) / 200.0).clamp(0.0, 1.0);
|
||||
ui.add(
|
||||
egui::ProgressBar::new(steer_frac)
|
||||
.text(format!(
|
||||
"Direction CH1 : {:+.0}% (CRSF {})",
|
||||
steer_pct, steer_crsf
|
||||
)),
|
||||
);
|
||||
ui.add(
|
||||
egui::ProgressBar::new((throt_pct as f32 / 100.0).clamp(0.0, 1.0))
|
||||
.text(format!(
|
||||
"Accélérateur CH2 : {}% (CRSF {})",
|
||||
throt_pct, throt_crsf
|
||||
)),
|
||||
);
|
||||
ui.add(
|
||||
egui::ProgressBar::new((brake_pct as f32 / 100.0).clamp(0.0, 1.0))
|
||||
.text(format!(
|
||||
"Frein CH3 : {}% (CRSF {})",
|
||||
brake_pct, brake_crsf
|
||||
)),
|
||||
);
|
||||
ui.add(
|
||||
egui::ProgressBar::new((clutch_pct as f32 / 100.0).clamp(0.0, 1.0))
|
||||
.text(format!(
|
||||
"Embrayage CH4 : {}% (CRSF {})",
|
||||
clutch_pct, clutch_crsf
|
||||
)),
|
||||
);
|
||||
ui.small(format!("🔘 Dernier bouton : {} • {}", last_btn, detail));
|
||||
});
|
||||
|
||||
ui.small("Stick G: Dir | R2: Gaz | L2: Frein | RB/LB ou R4/L4: Boîte R/N/1/2/3 | Menu: Armer (au N)");
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user