mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat(unified): add 100% wired Radxa/G29 hub (HT, cockpit OSD, CRSF telemetry) & update README
This commit is contained in:
1 parent
f01bf1aeb3
commit
51a5d0c7ad
10 files changed
+1012
-26
No files matched your search
+26
-1
@@ -19,11 +19,18 @@ pub enum NomadProtocol {
|
||||
Crsf,
|
||||
/// MAVLink v1 RC_CHANNELS_OVERRIDE (msgid 70) — compatible UDP Backpack /mavlink (port 14555)
|
||||
Mavlink,
|
||||
/// Pont unifié G29 / Radxa Zero 3W ($HT,<pan>,<tilt>,<roll>) — 100% filaire via usb0:14552
|
||||
G29Bridge,
|
||||
}
|
||||
|
||||
impl NomadProtocol {
|
||||
pub fn from_str(s: &str) -> Self {
|
||||
if s.eq_ignore_ascii_case("crsf") {
|
||||
if s.eq_ignore_ascii_case("g29")
|
||||
|| s.eq_ignore_ascii_case("g29_bridge")
|
||||
|| s.eq_ignore_ascii_case("radxa")
|
||||
{
|
||||
Self::G29Bridge
|
||||
} else if s.eq_ignore_ascii_case("crsf") {
|
||||
Self::Crsf
|
||||
} else if s.eq_ignore_ascii_case("mavlink") || s.eq_ignore_ascii_case("mav") {
|
||||
Self::Mavlink
|
||||
@@ -37,6 +44,7 @@ impl NomadProtocol {
|
||||
Self::Msp => "MSPv2 0x0383",
|
||||
Self::Crsf => "CRSF 0x16",
|
||||
Self::Mavlink => "MAVLink v1 (RC Override)",
|
||||
Self::G29Bridge => "G29 Hub ($HT)",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,6 +216,10 @@ impl NomadHeadTracker {
|
||||
self.mav_seq = self.mav_seq.wrapping_add(1);
|
||||
self.socket.send_to(&packet, self.target)
|
||||
}
|
||||
NomadProtocol::G29Bridge => {
|
||||
let msg = Self::encode_g29_ht(pan_crsf, tilt_crsf, roll_crsf);
|
||||
self.socket.send_to(msg.as_bytes(), self.target)
|
||||
}
|
||||
};
|
||||
|
||||
let last_send_ok = match send_res {
|
||||
@@ -260,6 +272,10 @@ impl NomadHeadTracker {
|
||||
(crsf_val.round() as u16).clamp(CRSF_CHANNEL_MIN, CRSF_CHANNEL_MAX)
|
||||
}
|
||||
|
||||
pub fn encode_g29_ht(pan: u16, tilt: u16, roll: u16) -> String {
|
||||
format!("$HT,{},{},{}\n", pan, tilt, roll)
|
||||
}
|
||||
|
||||
pub fn encode_mspv2_ptr(pan: u16, tilt: u16, roll: u16) -> [u8; 15] {
|
||||
let mut buf = [0u8; 15];
|
||||
buf[0] = b'$';
|
||||
@@ -474,4 +490,13 @@ mod tests {
|
||||
let ht = NomadHeadTracker::new("10.0.0.1", 14550, 90.0, 60.0, 45.0, NomadProtocol::Msp);
|
||||
assert!(ht.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_g29_bridge_ht_format() {
|
||||
assert_eq!(NomadProtocol::from_str("g29"), NomadProtocol::G29Bridge);
|
||||
assert_eq!(
|
||||
NomadHeadTracker::encode_g29_ht(992, 1200, 800),
|
||||
"$HT,992,1200,800\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user