mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat: integrate DVR, live optical tuning and ARM64 tooling into modern GPUI Control Center
- Modern GPUI (src/gui_gpui.rs): Added 1-click DVR quick action button in header with live recording time/size, DVR status badge, reactive snapshots, live optical parameter tuning in Settings, and dedicated DVR settings card (MKV/MP4, StreamCopy/Composited). - Engine & DVR (src/engine.rs, src/dvr.rs, src/video_usb.rs): Integrated DVR recorder lifecycle with GStreamer supervisor probe for zero-CPU stream copy and hardware/composited OSD recording, dynamic optical updates without pipeline restarts. - Classic GUI fallback (src/gui.rs): Added DVR quick toggle, live optical slider callbacks, and full DVR settings section in egui. - OSD & Math optimizations: Zero-alloc stack formatting in src/telemetry_osd.rs, compile-time CRC8 table in src/nomad_elrs.rs, buffered file logger in src/logger.rs. - Steam Frame ARM64 scripts: udev rule scripts/99-radxa-vrx-rndis.rules, build & deployment tools scripts/build_steamframe_arm64.sh, scripts/deploy_to_steamframe.sh.
This commit is contained in:
1 parent
d5cc72750e
commit
7bee072e21
16 files changed
+1397
-75
No files matched your search
+30
-17
@@ -2,8 +2,8 @@ use chrono::Local;
|
||||
use log::{Level, LevelFilter, Log, Metadata, Record};
|
||||
use parking_lot::Mutex;
|
||||
use std::collections::VecDeque;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{BufWriter, Write};
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -43,18 +43,26 @@ impl Default for LogBuffer {
|
||||
}
|
||||
|
||||
/// Logger centralisé capturant tous les événements et erreurs pour l'interface graphique
|
||||
/// et les enregistrant simultanément dans `steamframe_fpv.log`.
|
||||
/// et les enregistrant simultanément dans un fichier persistant sans réouverture synchrone.
|
||||
pub struct GuiLogger {
|
||||
buffer: Arc<Mutex<LogBuffer>>,
|
||||
log_file_path: String,
|
||||
file_writer: Mutex<Option<BufWriter<File>>>,
|
||||
}
|
||||
|
||||
impl GuiLogger {
|
||||
pub fn init(log_file_path: &str) -> Arc<Mutex<LogBuffer>> {
|
||||
let buffer = Arc::new(Mutex::new(LogBuffer::default()));
|
||||
|
||||
let file_writer = OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(log_file_path)
|
||||
.ok()
|
||||
.map(BufWriter::new);
|
||||
|
||||
let logger = Box::new(Self {
|
||||
buffer: Arc::clone(&buffer),
|
||||
log_file_path: log_file_path.to_string(),
|
||||
file_writer: Mutex::new(file_writer),
|
||||
});
|
||||
|
||||
if log::set_boxed_logger(logger).is_ok() {
|
||||
@@ -87,7 +95,7 @@ impl Log for GuiLogger {
|
||||
|
||||
let now = Local::now().format("%H:%M:%S%.3f").to_string();
|
||||
let entry = LogEntry {
|
||||
timestamp: now.clone(),
|
||||
timestamp: now,
|
||||
level: record.level(),
|
||||
target: record.target().to_string(),
|
||||
message: format!("{}", record.args()),
|
||||
@@ -99,17 +107,17 @@ impl Log for GuiLogger {
|
||||
entry.timestamp, entry.level, entry.target, entry.message
|
||||
);
|
||||
|
||||
// Écriture persistante sur disque pour diagnostic après crash éventuel
|
||||
if let Ok(mut file) = OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(&self.log_file_path)
|
||||
// Écriture persistante sur descripteur ouvert avec tampon BufWriter
|
||||
{
|
||||
let _ = writeln!(
|
||||
file,
|
||||
"[{}] [{:<5}] ({}) {}",
|
||||
entry.timestamp, entry.level, entry.target, entry.message
|
||||
);
|
||||
let mut writer_lock = self.file_writer.lock();
|
||||
if let Some(ref mut writer) = *writer_lock {
|
||||
let _ = writeln!(
|
||||
writer,
|
||||
"[{}] [{:<5}] ({}) {}",
|
||||
entry.timestamp, entry.level, entry.target, entry.message
|
||||
);
|
||||
let _ = writer.flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Ajout dans le tampon de l'interface graphique
|
||||
@@ -133,5 +141,10 @@ impl Log for GuiLogger {
|
||||
lock.revision.fetch_add(1, Ordering::Release);
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
fn flush(&self) {
|
||||
let mut writer_lock = self.file_writer.lock();
|
||||
if let Some(ref mut writer) = *writer_lock {
|
||||
let _ = writer.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user