mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat: add Steam Controller support with hot-switchable G29/Steam selector
This commit is contained in:
1 parent
d5dc1de504
commit
95ad271232
11 files changed
+1979
-81
No files matched your search
+8
-1
@@ -1,3 +1,4 @@
|
||||
use crate::controller::ControlSource;
|
||||
use crate::engine::EngineControlHandle;
|
||||
use crate::telemetry_osd::{TelemetryReceiver, TelemetryState};
|
||||
use anyhow::Result;
|
||||
@@ -23,6 +24,7 @@ pub struct G29State {
|
||||
pub ffb_raw: u8,
|
||||
pub ffb_pct: u8,
|
||||
pub vib_pct: u8,
|
||||
pub remote_source: ControlSource,
|
||||
pub packets_received: u64,
|
||||
pub last_packet: Option<Instant>,
|
||||
pub toast_text: String,
|
||||
@@ -41,6 +43,7 @@ impl Default for G29State {
|
||||
ffb_raw: 140,
|
||||
ffb_pct: 55,
|
||||
vib_pct: 50,
|
||||
remote_source: ControlSource::G29,
|
||||
packets_received: 0,
|
||||
last_packet: None,
|
||||
toast_text: String::new(),
|
||||
@@ -292,6 +295,9 @@ impl G29BridgeReceiver {
|
||||
st.failsafe = val != 0;
|
||||
}
|
||||
}
|
||||
"SRC" => {
|
||||
st.remote_source = ControlSource::from_str(v);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -437,7 +443,7 @@ mod tests {
|
||||
}
|
||||
|
||||
G29BridgeReceiver::process_line(
|
||||
"$G29,ARM=1,GEAR=-1,THROT=0,BRAKE=80,FFB=200,VIB=50,FAIL=0",
|
||||
"$G29,ARM=1,GEAR=-1,THROT=0,BRAKE=80,FFB=200,VIB=50,FAIL=0,SRC=EXT",
|
||||
&state,
|
||||
None,
|
||||
None,
|
||||
@@ -446,6 +452,7 @@ mod tests {
|
||||
let st = state.lock();
|
||||
assert_eq!(st.gear_label(), "R");
|
||||
assert_eq!(st.brake_pct, 80);
|
||||
assert_eq!(st.remote_source, ControlSource::SteamController);
|
||||
assert_eq!(st.active_toast(), Some("FFB 78%"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user