mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat(vr-ux,safety,perf): add VR quick menu, P0/P1 safety & perf fixes, unify on GPUI
This commit is contained in:
1 parent
c0bad51d3b
commit
0823a9e682
15 files changed
+1288
-3765
No files matched your search
+72
-1
@@ -399,7 +399,56 @@ impl G29BridgeReceiver {
|
||||
|
||||
log::info!("[G29 Bridge] Bouton volant reçu : {:?}", btn);
|
||||
|
||||
let menu_open = control.map(|c| c.is_vr_menu_open()).unwrap_or(false);
|
||||
let toast = match btn {
|
||||
G29ButtonEvent::Options | G29ButtonEvent::L3 => {
|
||||
if let Some(ctrl) = control {
|
||||
let open = ctrl.toggle_vr_menu();
|
||||
Some(if open {
|
||||
"MENU VR ON".to_string()
|
||||
} else {
|
||||
"MENU VR OFF".to_string()
|
||||
})
|
||||
} else {
|
||||
Some("MENU VR".to_string())
|
||||
}
|
||||
}
|
||||
G29ButtonEvent::Cross if menu_open => {
|
||||
if let Some(ctrl) = control {
|
||||
ctrl.vr_menu_activate();
|
||||
}
|
||||
None
|
||||
}
|
||||
G29ButtonEvent::Circle if menu_open => {
|
||||
if let Some(ctrl) = control {
|
||||
ctrl.close_vr_menu();
|
||||
}
|
||||
Some("MENU VR OFF".to_string())
|
||||
}
|
||||
G29ButtonEvent::DpadUp if menu_open => {
|
||||
if let Some(ctrl) = control {
|
||||
ctrl.vr_menu_move(-1);
|
||||
}
|
||||
None
|
||||
}
|
||||
G29ButtonEvent::DpadDown if menu_open => {
|
||||
if let Some(ctrl) = control {
|
||||
ctrl.vr_menu_move(1);
|
||||
}
|
||||
None
|
||||
}
|
||||
G29ButtonEvent::DpadLeft if menu_open => {
|
||||
if let Some(ctrl) = control {
|
||||
ctrl.vr_menu_adjust(-1);
|
||||
}
|
||||
None
|
||||
}
|
||||
G29ButtonEvent::DpadRight if menu_open => {
|
||||
if let Some(ctrl) = control {
|
||||
ctrl.vr_menu_adjust(1);
|
||||
}
|
||||
None
|
||||
}
|
||||
G29ButtonEvent::Cross | G29ButtonEvent::Ps | G29ButtonEvent::R3 => {
|
||||
if let Some(ctrl) = control {
|
||||
ctrl.request_recenter();
|
||||
@@ -462,7 +511,6 @@ impl G29BridgeReceiver {
|
||||
}
|
||||
Some("PAN +1".to_string())
|
||||
}
|
||||
G29ButtonEvent::Options | G29ButtonEvent::L3 => None,
|
||||
};
|
||||
|
||||
{
|
||||
@@ -595,4 +643,27 @@ mod tests {
|
||||
&[]
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vr_menu_g29_navigation() {
|
||||
let engine = crate::engine::FpvEngineController::new(true, true);
|
||||
let ctrl = engine.control_handle();
|
||||
let state = Arc::new(Mutex::new(G29State::default()));
|
||||
|
||||
assert!(!ctrl.is_vr_menu_open());
|
||||
G29BridgeReceiver::process_line("$G29_EVT,BTN=OPTIONS", &state, Some(&ctrl), None);
|
||||
assert!(ctrl.is_vr_menu_open());
|
||||
|
||||
// Descendre 4 fois (0 -> 4 : PROJECTION VR) puis flèche droite (DOME 140 -> CYL 140)
|
||||
for _ in 0..4 {
|
||||
G29BridgeReceiver::process_line("$G29_EVT,BTN=DPAD_DOWN", &state, Some(&ctrl), None);
|
||||
}
|
||||
G29BridgeReceiver::process_line("$G29_EVT,BTN=DPAD_RIGHT", &state, Some(&ctrl), None);
|
||||
let data = ctrl.vr_menu_render_data().unwrap();
|
||||
assert_eq!(data.selected_idx, 4);
|
||||
assert_eq!(data.projection_label, "CYL 140");
|
||||
|
||||
G29BridgeReceiver::process_line("$G29_EVT,BTN=CIRCLE", &state, Some(&ctrl), None);
|
||||
assert!(!ctrl.is_vr_menu_open());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user