mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
fix(engine,video,gui): decouple gst supervisor, lock-free UI controls, clean OpenXR exit & Radxa u-boot persistence
This commit is contained in:
1 parent
7e6781de5f
commit
dc6d796300
4 files changed
+614
-320
No files matched your search
+23
-12
@@ -1,5 +1,5 @@
|
||||
use crate::config::AppConfig;
|
||||
use crate::engine::{FpvEngineController, RuntimeMonitor, SubsystemStatus};
|
||||
use crate::engine::{EngineControlHandle, FpvEngineController, RuntimeMonitor, SubsystemStatus};
|
||||
use crate::logger::{LogBuffer, LogEntry, LogFilter};
|
||||
use crate::nomad_elrs::{HeadPoseSample, NomadHeadTracker};
|
||||
use crate::telemetry_osd::TelemetryState;
|
||||
@@ -43,6 +43,7 @@ pub enum ActiveTab {
|
||||
pub struct SteamFrameGpuiApp {
|
||||
cfg: AppConfig,
|
||||
engine: Arc<Mutex<FpvEngineController>>,
|
||||
controls: EngineControlHandle,
|
||||
engine_monitor: Arc<Mutex<RuntimeMonitor>>,
|
||||
log_buffer: Arc<Mutex<LogBuffer>>,
|
||||
log_revision: Arc<AtomicU64>,
|
||||
@@ -73,12 +74,14 @@ impl SteamFrameGpuiApp {
|
||||
let mut engine =
|
||||
FpvEngineController::new(cfg.telemetry_enabled, cfg.head_tracking_enabled);
|
||||
engine.start(cfg.clone());
|
||||
let controls = engine.control_handle();
|
||||
let engine_monitor = Arc::clone(&engine.monitor);
|
||||
let engine = Arc::new(Mutex::new(engine));
|
||||
|
||||
Self {
|
||||
cfg,
|
||||
engine,
|
||||
controls,
|
||||
engine_monitor,
|
||||
log_buffer,
|
||||
log_revision,
|
||||
@@ -381,8 +384,7 @@ impl SteamFrameGpuiApp {
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(|this, _, _, cx| {
|
||||
this.cfg.head_tracking_enabled = !this.cfg.head_tracking_enabled;
|
||||
this.engine
|
||||
.lock()
|
||||
this.controls
|
||||
.set_head_tracking_enabled(this.cfg.head_tracking_enabled);
|
||||
cx.notify();
|
||||
}))
|
||||
@@ -398,8 +400,7 @@ impl SteamFrameGpuiApp {
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(|this, _, _, cx| {
|
||||
this.cfg.telemetry_enabled = !this.cfg.telemetry_enabled;
|
||||
this.engine
|
||||
.lock()
|
||||
this.controls
|
||||
.set_telemetry_enabled(this.cfg.telemetry_enabled);
|
||||
cx.notify();
|
||||
}))
|
||||
@@ -422,7 +423,7 @@ impl SteamFrameGpuiApp {
|
||||
.font_weight(gpui::FontWeight::SEMIBOLD)
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(|this, _, _, cx| {
|
||||
this.engine.lock().request_recenter();
|
||||
this.controls.request_recenter();
|
||||
cx.notify();
|
||||
}))
|
||||
.child("🎯 Tare"),
|
||||
@@ -754,12 +755,15 @@ impl SteamFrameGpuiApp {
|
||||
.font_weight(gpui::FontWeight::BOLD)
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(|this, _, _, cx| {
|
||||
log::info!("[Réglages] Application et redémarrage asynchrone du moteur FPV...");
|
||||
let engine_clone = Arc::clone(&this.engine);
|
||||
let cfg_clone = this.cfg.clone();
|
||||
std::thread::spawn(move || {
|
||||
let mut eng = engine_clone.lock();
|
||||
eng.start(cfg_clone);
|
||||
if let Some(mut eng) = engine_clone.try_lock() {
|
||||
log::info!("[Réglages] Application et redémarrage asynchrone du moteur FPV...");
|
||||
eng.start(cfg_clone);
|
||||
} else {
|
||||
log::warn!("[Réglages] Redémarrage déjà en cours, requête ignorée.");
|
||||
}
|
||||
});
|
||||
cx.notify();
|
||||
}))
|
||||
@@ -972,7 +976,7 @@ impl SteamFrameGpuiApp {
|
||||
.font_weight(gpui::FontWeight::SEMIBOLD)
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(|this, _, _, cx| {
|
||||
this.engine.lock().request_recenter();
|
||||
this.controls.request_recenter();
|
||||
cx.notify();
|
||||
}))
|
||||
.child("🎯 Réinitialiser Zéro (Tare)"),
|
||||
@@ -1060,7 +1064,7 @@ impl SteamFrameGpuiApp {
|
||||
self.cfg.telemetry_enabled,
|
||||
cx.listener(|this, _, _, cx| {
|
||||
this.cfg.telemetry_enabled = true;
|
||||
this.engine.lock().set_telemetry_enabled(true);
|
||||
this.controls.set_telemetry_enabled(true);
|
||||
cx.notify();
|
||||
}),
|
||||
))
|
||||
@@ -1070,7 +1074,7 @@ impl SteamFrameGpuiApp {
|
||||
!self.cfg.telemetry_enabled,
|
||||
cx.listener(|this, _, _, cx| {
|
||||
this.cfg.telemetry_enabled = false;
|
||||
this.engine.lock().set_telemetry_enabled(false);
|
||||
this.controls.set_telemetry_enabled(false);
|
||||
cx.notify();
|
||||
}),
|
||||
)),
|
||||
@@ -1702,6 +1706,13 @@ impl SteamFrameGpuiApp {
|
||||
|
||||
pub fn run_gpui_app(cfg: AppConfig, log_buffer: Arc<Mutex<LogBuffer>>) -> Result<()> {
|
||||
Application::new().run(move |cx: &mut App| {
|
||||
cx.on_window_closed(|cx| {
|
||||
if cx.windows().is_empty() {
|
||||
cx.quit();
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
let bounds = Bounds::centered(None, size(px(1240.0), px(820.0)), cx);
|
||||
|
||||
let window_res = cx.open_window(
|
||||
|
||||
Reference in new issue
Block a user