mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat(gui,firmware): configurable CRSF gear speed limits and responsive GPUI layout
This commit is contained in:
1 parent
febe4d5d5e
commit
426ab7c7d6
6 files changed
+578
-34
No files matched your search
+237
-6
@@ -1,5 +1,5 @@
|
||||
use crate::config::AppConfig;
|
||||
use crate::controller::{ControlSource, SteamControllerState};
|
||||
use crate::controller::{ControlSource, GearSpeedLimits, SteamControllerState};
|
||||
use crate::dome_projection::ProjectionMode;
|
||||
use crate::dvr::{DvrContainer, DvrMode};
|
||||
use crate::engine::{
|
||||
@@ -230,9 +230,10 @@ impl SteamFrameGpuiApp {
|
||||
}
|
||||
self.latest_pose = mon.latest_head_pose;
|
||||
self.latest_telem = mon.latest_telemetry.clone();
|
||||
if self.latest_g29.packets_received != mon.latest_g29.packets_received
|
||||
|| self.latest_g29.connected != mon.latest_g29.connected
|
||||
if self.latest_g29.connected != mon.latest_g29.connected
|
||||
|| self.latest_g29.last_button != mon.latest_g29.last_button
|
||||
|| (self.active_tab == ActiveTab::Settings
|
||||
&& self.latest_g29.packets_received != mon.latest_g29.packets_received)
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
@@ -632,6 +633,8 @@ impl Render for SteamFrameGpuiApp {
|
||||
.flex()
|
||||
.flex_col()
|
||||
.flex_1()
|
||||
.min_h_0()
|
||||
.min_w_0()
|
||||
.overflow_hidden()
|
||||
.child(match self.active_tab {
|
||||
ActiveTab::Cockpit => self.render_cockpit_view(cx).into_any_element(),
|
||||
@@ -651,6 +654,7 @@ impl SteamFrameGpuiApp {
|
||||
div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.flex_wrap()
|
||||
.justify_between()
|
||||
.items_center()
|
||||
.bg(rgb(COLOR_SURFACE_CARD))
|
||||
@@ -664,6 +668,7 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.items_center()
|
||||
.gap_2p5()
|
||||
.child(
|
||||
@@ -681,6 +686,7 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.items_center()
|
||||
.gap_1()
|
||||
.bg(rgb(COLOR_SURFACE_ELEVATED))
|
||||
@@ -705,6 +711,7 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.items_center()
|
||||
.gap_2()
|
||||
.child(
|
||||
@@ -907,6 +914,8 @@ impl SteamFrameGpuiApp {
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.min_h_0()
|
||||
.min_w_0()
|
||||
.relative()
|
||||
.bg(rgb(0x030508))
|
||||
.border_1()
|
||||
@@ -915,9 +924,20 @@ impl SteamFrameGpuiApp {
|
||||
.overflow_hidden()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
// 2.1 Flux Vidéo
|
||||
// 2.1 Flux Vidéo (cadrage proportionnel intégral sans rognage)
|
||||
.child(if let Some(ref img_src) = self.current_render_image {
|
||||
div().size_full().child(img(img_src.clone()).size_full())
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.size_full()
|
||||
.min_h_0()
|
||||
.min_w_0()
|
||||
.child(
|
||||
img(img_src.clone())
|
||||
.size_full()
|
||||
.object_fit(gpui::ObjectFit::Contain),
|
||||
)
|
||||
} else {
|
||||
div()
|
||||
.flex()
|
||||
@@ -940,6 +960,8 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.justify_center()
|
||||
.gap_2()
|
||||
.pt_2()
|
||||
.child(
|
||||
@@ -1132,6 +1154,8 @@ impl SteamFrameGpuiApp {
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.min_h_0()
|
||||
.min_w_0()
|
||||
.id("settings_view_scroll")
|
||||
.overflow_y_scroll()
|
||||
.bg(rgb(COLOR_SURFACE_CARD))
|
||||
@@ -1144,8 +1168,10 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.justify_between()
|
||||
.items_center()
|
||||
.gap_2()
|
||||
.border_b_1()
|
||||
.border_color(rgb(COLOR_BORDER_SUBTLE))
|
||||
.pb_3()
|
||||
@@ -1206,6 +1232,7 @@ impl SteamFrameGpuiApp {
|
||||
"Mode Acquisition Vidéo",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
"pill_mode_rndis",
|
||||
@@ -1231,6 +1258,7 @@ impl SteamFrameGpuiApp {
|
||||
"Canal 5.8 GHz (RTL8812EU)",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_1p5()
|
||||
.child(self.render_channel_button(149, 5745, cx))
|
||||
.child(self.render_channel_button(153, 5765, cx))
|
||||
@@ -1242,6 +1270,7 @@ impl SteamFrameGpuiApp {
|
||||
"Codec Décodage",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
"pill_codec_h264",
|
||||
@@ -1266,6 +1295,7 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.pt_2()
|
||||
.child(
|
||||
@@ -1373,6 +1403,7 @@ impl SteamFrameGpuiApp {
|
||||
"Cible Réseau (clic pour éditer)",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.items_center()
|
||||
.gap_1()
|
||||
.child(
|
||||
@@ -1536,6 +1567,7 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.pt_1()
|
||||
.child(
|
||||
@@ -1594,6 +1626,7 @@ impl SteamFrameGpuiApp {
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.pt_1()
|
||||
.child(
|
||||
@@ -1715,6 +1748,7 @@ impl SteamFrameGpuiApp {
|
||||
"Sens Direction Steam Controller",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.items_center()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
@@ -1868,6 +1902,91 @@ impl SteamFrameGpuiApp {
|
||||
.child("📳 Tester Vibrations"),
|
||||
),
|
||||
))
|
||||
.child(self.render_setting_row(
|
||||
"Réglage des Vitesses CRSF (G29 + Steam Controller)",
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_2()
|
||||
.p_2p5()
|
||||
.rounded_md()
|
||||
.bg(rgb(COLOR_BG_DARK))
|
||||
.border_1()
|
||||
.border_color(rgb(COLOR_BORDER_SUBTLE))
|
||||
.child(self.render_gear_stepper_row(
|
||||
"av_min",
|
||||
"Seuil Gaz Avant (Min)",
|
||||
self.cfg.gaz_avant_min,
|
||||
COLOR_TEXT_MAIN,
|
||||
|cfg, d| cfg.gaz_avant_min = cfg.gaz_avant_min.saturating_add_signed(d),
|
||||
cx,
|
||||
))
|
||||
.child(self.render_gear_stepper_row(
|
||||
"g1",
|
||||
"1ère Vitesse (Manœuvre)",
|
||||
self.cfg.gear_1_max,
|
||||
COLOR_CYAN,
|
||||
|cfg, d| cfg.gear_1_max = cfg.gear_1_max.saturating_add_signed(d),
|
||||
cx,
|
||||
))
|
||||
.child(self.render_gear_stepper_row(
|
||||
"g2",
|
||||
"2ème Vitesse (Normale)",
|
||||
self.cfg.gear_2_max,
|
||||
COLOR_GREEN,
|
||||
|cfg, d| cfg.gear_2_max = cfg.gear_2_max.saturating_add_signed(d),
|
||||
cx,
|
||||
))
|
||||
.child(self.render_gear_stepper_row(
|
||||
"g3",
|
||||
"3ème Vitesse (Rapide)",
|
||||
self.cfg.gear_3_max,
|
||||
COLOR_ORANGE,
|
||||
|cfg, d| cfg.gear_3_max = cfg.gear_3_max.saturating_add_signed(d),
|
||||
cx,
|
||||
))
|
||||
.child(self.render_gear_stepper_row(
|
||||
"ar_min",
|
||||
"Seuil Gaz Arrière (Min)",
|
||||
self.cfg.gaz_arriere_min,
|
||||
COLOR_TEXT_MAIN,
|
||||
|cfg, d| cfg.gaz_arriere_min = cfg.gaz_arriere_min.saturating_add_signed(d),
|
||||
cx,
|
||||
))
|
||||
.child(self.render_gear_stepper_row(
|
||||
"ar_max",
|
||||
"Plafond Marche Arrière (R)",
|
||||
self.cfg.gear_reverse_max,
|
||||
COLOR_RED,
|
||||
|cfg, d| cfg.gear_reverse_max = cfg.gear_reverse_max.saturating_add_signed(d),
|
||||
cx,
|
||||
))
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.justify_end()
|
||||
.pt_1()
|
||||
.child(
|
||||
div()
|
||||
.id("btn_gears_reset_default")
|
||||
.px_2p5()
|
||||
.py_1()
|
||||
.rounded_md()
|
||||
.bg(rgb(COLOR_SURFACE_ELEVATED))
|
||||
.border_1()
|
||||
.border_color(rgb(COLOR_BORDER_SUBTLE))
|
||||
.text_xs()
|
||||
.font_weight(gpui::FontWeight::SEMIBOLD)
|
||||
.text_color(rgb(COLOR_TEXT_MAIN))
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(|this, _, _, cx| {
|
||||
this.reset_gear_speed_limits();
|
||||
cx.notify();
|
||||
}))
|
||||
.child("↺ Valeurs par défaut (1065 / 1100-1150-1220 / 905-800)"),
|
||||
),
|
||||
),
|
||||
))
|
||||
.child(self.render_controller_monitor(cx))
|
||||
.child(
|
||||
div()
|
||||
@@ -1894,6 +2013,7 @@ impl SteamFrameGpuiApp {
|
||||
"Affichage Casque VR (OpenXR)",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
"pill_vr_on",
|
||||
@@ -1919,6 +2039,7 @@ impl SteamFrameGpuiApp {
|
||||
"Mode de Projection VR",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
"pill_proj_dome",
|
||||
@@ -2004,6 +2125,7 @@ impl SteamFrameGpuiApp {
|
||||
"État Télémétrie & OSD",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
"pill_telem_on",
|
||||
@@ -2047,6 +2169,7 @@ impl SteamFrameGpuiApp {
|
||||
"Format Conteneur",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
"pill_dvr_mkv",
|
||||
@@ -2082,6 +2205,7 @@ impl SteamFrameGpuiApp {
|
||||
"Mode Enregistrement",
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.gap_2()
|
||||
.child(self.render_selectable_pill(
|
||||
"pill_dvr_copy",
|
||||
@@ -2167,8 +2291,9 @@ impl SteamFrameGpuiApp {
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.min_w(px(380.0))
|
||||
.min_w(px(300.0))
|
||||
.flex_1()
|
||||
.overflow_hidden()
|
||||
.bg(rgb(COLOR_SURFACE_ELEVATED))
|
||||
.border_1()
|
||||
.border_color(rgb(COLOR_BORDER_SUBTLE))
|
||||
@@ -2242,6 +2367,7 @@ impl SteamFrameGpuiApp {
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.gap_2()
|
||||
@@ -2266,6 +2392,107 @@ impl SteamFrameGpuiApp {
|
||||
)
|
||||
}
|
||||
|
||||
fn apply_gear_speed_limits(&mut self) {
|
||||
let sanitized = GearSpeedLimits {
|
||||
forward_min: self.cfg.gaz_avant_min,
|
||||
forward_max: [
|
||||
self.cfg.gear_1_max,
|
||||
self.cfg.gear_2_max,
|
||||
self.cfg.gear_3_max,
|
||||
],
|
||||
reverse_min: self.cfg.gaz_arriere_min,
|
||||
reverse_max: self.cfg.gear_reverse_max,
|
||||
}
|
||||
.sanitized();
|
||||
self.cfg.gaz_avant_min = sanitized.forward_min;
|
||||
self.cfg.gear_1_max = sanitized.forward_max[0];
|
||||
self.cfg.gear_2_max = sanitized.forward_max[1];
|
||||
self.cfg.gear_3_max = sanitized.forward_max[2];
|
||||
self.cfg.gaz_arriere_min = sanitized.reverse_min;
|
||||
self.cfg.gear_reverse_max = sanitized.reverse_max;
|
||||
self.controls.set_gear_speed_limits(sanitized);
|
||||
}
|
||||
|
||||
fn reset_gear_speed_limits(&mut self) {
|
||||
let def = GearSpeedLimits::default();
|
||||
self.cfg.gaz_avant_min = def.forward_min;
|
||||
self.cfg.gear_1_max = def.forward_max[0];
|
||||
self.cfg.gear_2_max = def.forward_max[1];
|
||||
self.cfg.gear_3_max = def.forward_max[2];
|
||||
self.cfg.gaz_arriere_min = def.reverse_min;
|
||||
self.cfg.gear_reverse_max = def.reverse_max;
|
||||
self.controls.set_gear_speed_limits(def);
|
||||
}
|
||||
|
||||
fn render_gear_stepper_row(
|
||||
&self,
|
||||
id_prefix: &'static str,
|
||||
label: &'static str,
|
||||
value: u16,
|
||||
accent_color: u32,
|
||||
mutator: fn(&mut AppConfig, i16),
|
||||
cx: &mut Context<Self>,
|
||||
) -> impl IntoElement {
|
||||
let step_btn = |suffix: &'static str, txt: &'static str, delta: i16| {
|
||||
let btn_id = gpui::SharedString::from(format!("btn_gear_{}_{}", id_prefix, suffix));
|
||||
div()
|
||||
.id(btn_id)
|
||||
.px_2()
|
||||
.py_0p5()
|
||||
.rounded_md()
|
||||
.bg(rgb(COLOR_SURFACE_ELEVATED))
|
||||
.border_1()
|
||||
.border_color(rgb(COLOR_BORDER_SUBTLE))
|
||||
.text_xs()
|
||||
.font_weight(gpui::FontWeight::BOLD)
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(move |this, _, _, cx| {
|
||||
mutator(&mut this.cfg, delta);
|
||||
this.apply_gear_speed_limits();
|
||||
cx.notify();
|
||||
}))
|
||||
.child(txt)
|
||||
};
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.flex_wrap()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.text_color(rgb(COLOR_TEXT_MAIN))
|
||||
.child(label),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_1p5()
|
||||
.child(step_btn("m10", "−10", -10))
|
||||
.child(step_btn("m5", "−5", -5))
|
||||
.child(
|
||||
div()
|
||||
.w(px(56.0))
|
||||
.py_0p5()
|
||||
.rounded_md()
|
||||
.bg(rgb(COLOR_SURFACE_CARD))
|
||||
.border_1()
|
||||
.border_color(rgb(accent_color))
|
||||
.text_xs()
|
||||
.font_weight(gpui::FontWeight::BOLD)
|
||||
.text_color(rgb(accent_color))
|
||||
.flex()
|
||||
.justify_center()
|
||||
.child(format!("{}", value)),
|
||||
)
|
||||
.child(step_btn("p5", "+5", 5))
|
||||
.child(step_btn("p10", "+10", 10)),
|
||||
)
|
||||
}
|
||||
|
||||
fn render_setting_row(&self, label: &str, control: impl IntoElement) -> impl IntoElement {
|
||||
div()
|
||||
.flex()
|
||||
@@ -2373,6 +2600,8 @@ impl SteamFrameGpuiApp {
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.min_h_0()
|
||||
.min_w_0()
|
||||
.id("telemetry_view_scroll")
|
||||
.overflow_y_scroll()
|
||||
.bg(rgb(COLOR_SURFACE_CARD))
|
||||
@@ -2775,6 +3004,8 @@ impl SteamFrameGpuiApp {
|
||||
.flex()
|
||||
.flex_col()
|
||||
.flex_1()
|
||||
.min_h_0()
|
||||
.min_w_0()
|
||||
.id("logs_scroll_tab")
|
||||
.overflow_y_scroll()
|
||||
.px_2()
|
||||
|
||||
Reference in new issue
Block a user