mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat(core,radxa): extract cross-platform fpv-core workspace crate and add usb0 DHCP setup for Android
This commit is contained in:
1 parent
9a8ae95b3f
commit
16d05785fb
18 files changed
+2119
-1298
No files matched your search
@@ -0,0 +1,58 @@
|
||||
/// Source de conduite active sur la passerelle RP2350 (`G29` ou `EXT` pour manette externe / Steam Controller).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
#[repr(u8)]
|
||||
pub enum ControlSource {
|
||||
#[default]
|
||||
G29 = 0,
|
||||
SteamController = 1,
|
||||
}
|
||||
|
||||
impl ControlSource {
|
||||
#[allow(clippy::should_implement_trait)]
|
||||
pub fn from_str(s: &str) -> Self {
|
||||
let lower = s.trim().to_ascii_lowercase();
|
||||
if lower == "steam"
|
||||
|| lower == "steam_controller"
|
||||
|| lower == "steam-controller"
|
||||
|| lower == "controller"
|
||||
|| lower == "gamepad"
|
||||
|| lower == "ext"
|
||||
{
|
||||
Self::SteamController
|
||||
} else {
|
||||
Self::G29
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_u8(v: u8) -> Self {
|
||||
match v {
|
||||
1 => Self::SteamController,
|
||||
_ => Self::G29,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_u8(self) -> u8 {
|
||||
self as u8
|
||||
}
|
||||
|
||||
pub fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
Self::G29 => "g29",
|
||||
Self::SteamController => "steam",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wire_tag(self) -> &'static str {
|
||||
match self {
|
||||
Self::G29 => "G29",
|
||||
Self::SteamController => "EXT",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::G29 => "Volant G29",
|
||||
Self::SteamController => "Steam Controller",
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user