1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2#[allow(unused_qualifications)]
6pub struct FlightModeSet {
7 firmware: crate::headers::InternalFirmware,
8 raw: ::bitvec::array::BitArray<u32, ::bitvec::order::Lsb0>,
9}
10#[allow(unused_qualifications, clippy::cast_possible_truncation)]
11impl FlightModeSet {
12 pub(crate) fn new(raw: u32, firmware: crate::headers::InternalFirmware) -> Self {
13 Self {
14 firmware,
15 raw: ::bitvec::array::BitArray::new(raw),
16 }
17 }
18
19 fn iter(&self) -> impl Iterator<Item = <Self as crate::units::FlagSet>::Flag> + '_ {
20 self.raw
21 .iter_ones()
22 .filter_map(|bit| <FlightMode>::from_bit(bit as u32, self.firmware))
23 }
24}
25#[allow(unused_qualifications, clippy::cast_possible_truncation)]
26impl crate::units::FlagSet for FlightModeSet {
27 type Flag = FlightMode;
28
29 fn is_set(&self, flag: Self::Flag) -> bool {
30 flag.to_bit(self.firmware)
31 .map_or(false, |bit| self.raw[bit as usize])
32 }
33
34 fn as_names(&self) -> ::alloc::vec::Vec<&'static str> {
35 self.iter()
36 .map(|flag| <FlightMode as crate::units::Flag>::as_name(&flag))
37 .collect()
38 }
39}
40#[allow(unused_qualifications)]
41impl ::core::fmt::Display for FlightModeSet {
42 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
43 let names = <Self as crate::units::FlagSet>::as_names(self);
44 f.write_str(&names.join("|"))
45 }
46}
47#[cfg(feature = "_serde")]
48#[allow(clippy::cast_possible_truncation)]
49impl ::serde::Serialize for FlightModeSet {
50 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51 where
52 S: serde::Serializer,
53 {
54 use serde::ser::SerializeSeq;
55 let mut seq = serializer.serialize_seq(None)?;
56 for flag in self.iter() {
57 seq.serialize_element(&flag)?;
58 }
59 seq.end()
60 }
61}
62#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
63#[cfg_attr(feature = "_serde", derive(serde::Serialize))]
64#[non_exhaustive]
68pub enum FlightMode {
69 AcroTrainer,
71 Airmode,
73 Angle,
75 AngleHold,
77 AntiGravity,
79 Arm,
81 AutoLevel,
83 AutoTrim,
85 AutoTune,
87 BeepGpsCount,
89 BeeperMute,
91 BeeperOn,
93 Beepermute,
95 Blackbox,
97 BlackboxErase,
99 Braking,
101 Calibration,
103 CamStab,
105 Camera1,
107 Camera2,
109 Camera3,
111 Failsafe,
113 Flaperon,
115 FpvAngleMix,
117 GcsNav,
119 Gimbalcenter,
121 Gimbalhtrk,
123 Gimbalrlock,
125 Gimbaltlock,
127 GpsRescue,
129 HeadAdjust,
131 HeadFree,
133 HeadingHold,
135 HomeReset,
137 Horizon,
139 Killswitch,
141 LapTimerReset,
143 LaunchControl,
145 LedLow,
147 Lights,
149 LoiterChange,
151 Mag,
153 Manual,
155 MissionChange,
157 Mixerprofile,
159 Mixertransition,
161 MspOverride,
163 MspRcOverride,
165 Multifunction,
167 NavAltitudeHold,
169 NavCourseHold,
171 NavCruise,
173 NavLaunch,
175 NavPositionHold,
177 NavRth,
179 NavWaypoint,
181 Osd,
183 OsdAlt1,
185 OsdAlt2,
187 OsdAlt3,
189 Paralyze,
191 Passthru,
193 PidAudio,
195 PlanWpMission,
197 Prearm,
199 Ready,
201 Servo1,
203 Servo2,
205 Servo3,
207 Soaring,
209 StickCommandDisable,
211 Surface,
213 Telemetry,
215 ThreeD,
217 TurnAssist,
219 Turtle,
221 User1,
223 User2,
225 User3,
227 User4,
229 VtxControlDisable,
231 VtxPitMode,
233}
234#[allow(unused_qualifications)]
235impl crate::units::Flag for FlightMode {
236 fn as_name(&self) -> &'static str {
237 match self {
238 Self::AcroTrainer => "ACRO TRAINER",
239 Self::Airmode => "AIRMODE",
240 Self::Angle => "ANGLE",
241 Self::AngleHold => "ANGLEHOLD",
242 Self::AntiGravity => "ANTI GRAVITY",
243 Self::Arm => "ARM",
244 Self::AutoLevel => "AUTOLEVEL",
245 Self::AutoTrim => "AUTOTRIM",
246 Self::AutoTune => "AUTOTUNE",
247 Self::BeepGpsCount => "BEEP GPS COUNT",
248 Self::BeeperMute => "BEEPER MUTE",
249 Self::BeeperOn => "BEEPERON",
250 Self::Beepermute => "BEEPERMUTE",
251 Self::Blackbox => "BLACKBOX",
252 Self::BlackboxErase => "BLACKBOX ERASE",
253 Self::Braking => "BRAKING",
254 Self::Calibration => "CALIB",
255 Self::CamStab => "CAMSTAB",
256 Self::Camera1 => "CAMERA1",
257 Self::Camera2 => "CAMERA2",
258 Self::Camera3 => "CAMERA3",
259 Self::Failsafe => "FAILSAFE",
260 Self::Flaperon => "FLAPERON",
261 Self::FpvAngleMix => "FPV ANGLE MIX",
262 Self::GcsNav => "GCSNAV",
263 Self::Gimbalcenter => "GIMBALCENTER",
264 Self::Gimbalhtrk => "GIMBALHTRK",
265 Self::Gimbalrlock => "GIMBALRLOCK",
266 Self::Gimbaltlock => "GIMBALTLOCK",
267 Self::GpsRescue => "GPS RESCUE",
268 Self::HeadAdjust => "HEADADJ",
269 Self::HeadFree => "HEADFREE",
270 Self::HeadingHold => "HEADINGHOLD",
271 Self::HomeReset => "HOMERESET",
272 Self::Horizon => "HORIZON",
273 Self::Killswitch => "KILLSWITCH",
274 Self::LapTimerReset => "LAP TIMER RESET",
275 Self::LaunchControl => "LAUNCH CONTROL",
276 Self::LedLow => "LEDLOW",
277 Self::Lights => "LIGHTS",
278 Self::LoiterChange => "LOITERDIRCHN",
279 Self::Mag => "MAG",
280 Self::Manual => "MANUAL",
281 Self::MissionChange => "CHANGEMISSION",
282 Self::Mixerprofile => "MIXERPROFILE",
283 Self::Mixertransition => "MIXERTRANSITION",
284 Self::MspOverride => "MSPOVERRIDE",
285 Self::MspRcOverride => "MSPRCOVERRIDE",
286 Self::Multifunction => "MULTIFUNCTION",
287 Self::NavAltitudeHold => "NAV ALTHOLD",
288 Self::NavCourseHold => "NAVCOURSEHOLD",
289 Self::NavCruise => "NAV CRUISE",
290 Self::NavLaunch => "NAV LAUNCH",
291 Self::NavPositionHold => "NAV POSHOLD",
292 Self::NavRth => "NAV RTH",
293 Self::NavWaypoint => "NAV WP",
294 Self::Osd => "OSD",
295 Self::OsdAlt1 => "OSDALT1",
296 Self::OsdAlt2 => "OSDALT2",
297 Self::OsdAlt3 => "OSDALT3",
298 Self::Paralyze => "PARALYZE",
299 Self::Passthru => "PASSTHRU",
300 Self::PidAudio => "PID AUDIO",
301 Self::PlanWpMission => "PLANWPMISSION",
302 Self::Prearm => "PREARM",
303 Self::Ready => "READY",
304 Self::Servo1 => "SERVO1",
305 Self::Servo2 => "SERVO2",
306 Self::Servo3 => "SERVO3",
307 Self::Soaring => "SOARING",
308 Self::StickCommandDisable => "STICK COMMAND DISABLE",
309 Self::Surface => "SURFACE",
310 Self::Telemetry => "TELEMETRY",
311 Self::ThreeD => "3D",
312 Self::TurnAssist => "TURNASSIST",
313 Self::Turtle => "TURTLE",
314 Self::User1 => "USER1",
315 Self::User2 => "USER2",
316 Self::User3 => "USER3",
317 Self::User4 => "USER4",
318 Self::VtxControlDisable => "VTX CONTROL DISABLE",
319 Self::VtxPitMode => "VTX PIT MODE",
320 }
321 }
322}
323#[allow(unused_qualifications)]
324impl ::core::fmt::Display for FlightMode {
325 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
326 let s = <Self as crate::units::Flag>::as_name(self);
327 f.write_str(s)
328 }
329}
330#[allow(
331 unused_qualifications,
332 clippy::enum_glob_use,
333 clippy::match_same_arms,
334 clippy::unseparated_literal_suffix
335)]
336impl FlightMode {
337 const fn from_bit(bit: u32, fw: crate::headers::InternalFirmware) -> Option<Self> {
338 use crate::headers::InternalFirmware::*;
339 match (bit, fw) {
340 (
341 0u32,
342 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
343 | Inav7 | Inav8,
344 ) => Some(Self::Arm),
345 (
346 1u32,
347 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
348 | Inav7 | Inav8,
349 ) => Some(Self::Angle),
350 (
351 2u32,
352 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
353 | Inav7 | Inav8,
354 ) => Some(Self::Horizon),
355 (3u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
356 Some(Self::Mag)
357 }
358 (3u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::NavAltitudeHold),
359 (4u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
360 Some(Self::HeadFree)
361 }
362 (4u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::HeadingHold),
363 (5u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
364 Some(Self::Passthru)
365 }
366 (5u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::HeadFree),
367 (6u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
368 Some(Self::Failsafe)
369 }
370 (6u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::HeadAdjust),
371 (7u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
372 Some(Self::GpsRescue)
373 }
374 (7u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::CamStab),
375 (8u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
376 Some(Self::AntiGravity)
377 }
378 (8u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::NavRth),
379 (9u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
380 Some(Self::HeadAdjust)
381 }
382 (9u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::NavPositionHold),
383 (10u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
384 Some(Self::CamStab)
385 }
386 (10u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Manual),
387 (
388 11u32,
389 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
390 | Inav7 | Inav8,
391 ) => Some(Self::BeeperOn),
392 (
393 12u32,
394 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
395 | Inav7 | Inav8,
396 ) => Some(Self::LedLow),
397 (13u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
398 Some(Self::Calibration)
399 }
400 (13u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Lights),
401 (14u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
402 Some(Self::Osd)
403 }
404 (14u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::NavLaunch),
405 (15u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
406 Some(Self::Telemetry)
407 }
408 (15u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Osd),
409 (16u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
410 Some(Self::Servo1)
411 }
412 (16u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Telemetry),
413 (17u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
414 Some(Self::Servo2)
415 }
416 (17u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Blackbox),
417 (18u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
418 Some(Self::Servo3)
419 }
420 (18u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Failsafe),
421 (19u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
422 Some(Self::Blackbox)
423 }
424 (19u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::NavWaypoint),
425 (
426 20u32,
427 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
428 | Inav7 | Inav8,
429 ) => Some(Self::Airmode),
430 (21u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
431 Some(Self::ThreeD)
432 }
433 (21u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::HomeReset),
434 (22u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
435 Some(Self::FpvAngleMix)
436 }
437 (22u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::GcsNav),
438 (23u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
439 Some(Self::BlackboxErase)
440 }
441 (23u32, Inav5 | Inav6 | Inav7) => Some(Self::Killswitch),
442 (24u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
443 Some(Self::Camera1)
444 }
445 (24u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Surface),
446 (25u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
447 Some(Self::Camera2)
448 }
449 (25u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Flaperon),
450 (26u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
451 Some(Self::Camera3)
452 }
453 (26u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::TurnAssist),
454 (27u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
455 Some(Self::Turtle)
456 }
457 (27u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::AutoTrim),
458 (28u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
459 Some(Self::Prearm)
460 }
461 (28u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::AutoTune),
462 (29u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
463 Some(Self::BeepGpsCount)
464 }
465 (29u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Camera1),
466 (30u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
467 Some(Self::VtxPitMode)
468 }
469 (30u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Camera2),
470 (31u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
471 Some(Self::Paralyze)
472 }
473 (31u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Camera3),
474 (32u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
475 Some(Self::User1)
476 }
477 (32u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::OsdAlt1),
478 (33u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
479 Some(Self::User2)
480 }
481 (33u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::OsdAlt2),
482 (34u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
483 Some(Self::User3)
484 }
485 (34u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::OsdAlt3),
486 (35u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
487 Some(Self::User4)
488 }
489 (35u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::NavCourseHold),
490 (36u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
491 Some(Self::PidAudio)
492 }
493 (36u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Braking),
494 (37u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
495 Some(Self::AcroTrainer)
496 }
497 (37u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::User1),
498 (38u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
499 Some(Self::VtxControlDisable)
500 }
501 (38u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::User2),
502 (39u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
503 Some(Self::LaunchControl)
504 }
505 (39u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::FpvAngleMix),
506 (40u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
507 Some(Self::MspOverride)
508 }
509 (40u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::LoiterChange),
510 (41u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
511 Some(Self::StickCommandDisable)
512 }
513 (41u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::MspRcOverride),
514 (42u32, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
515 Some(Self::BeeperMute)
516 }
517 (42u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Prearm),
518 (43u32, Betaflight4_5) => Some(Self::Ready),
519 (43u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Turtle),
520 (44u32, Betaflight4_5) => Some(Self::LapTimerReset),
521 (44u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::NavCruise),
522 (45u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::AutoLevel),
523 (46u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::PlanWpMission),
524 (47u32, Inav5 | Inav6 | Inav7 | Inav8) => Some(Self::Soaring),
525 (48u32, Inav6 | Inav7 | Inav8) => Some(Self::User3),
526 (49u32, Inav6 | Inav7 | Inav8) => Some(Self::User4),
527 (50u32, Inav6 | Inav7 | Inav8) => Some(Self::MissionChange),
528 (51u32, Inav7 | Inav8) => Some(Self::Beepermute),
529 (52u32, Inav7 | Inav8) => Some(Self::Multifunction),
530 (53u32, Inav7 | Inav8) => Some(Self::Mixerprofile),
531 (54u32, Inav7 | Inav8) => Some(Self::Mixertransition),
532 (55u32, Inav7 | Inav8) => Some(Self::AngleHold),
533 (56u32, Inav8) => Some(Self::Gimbaltlock),
534 (57u32, Inav8) => Some(Self::Gimbalrlock),
535 (58u32, Inav8) => Some(Self::Gimbalcenter),
536 (59u32, Inav8) => Some(Self::Gimbalhtrk),
537 _ => None,
538 }
539 }
540
541 const fn to_bit(self, fw: crate::headers::InternalFirmware) -> Option<u32> {
542 use crate::headers::InternalFirmware::*;
543 match (self, fw) {
544 (
545 Self::Arm,
546 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
547 | Inav7 | Inav8,
548 ) => Some(0u32),
549 (
550 Self::Angle,
551 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
552 | Inav7 | Inav8,
553 ) => Some(1u32),
554 (
555 Self::Horizon,
556 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
557 | Inav7 | Inav8,
558 ) => Some(2u32),
559 (Self::Mag, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
560 Some(3u32)
561 }
562 (Self::NavAltitudeHold, Inav5 | Inav6 | Inav7 | Inav8) => Some(3u32),
563 (Self::HeadFree, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
564 Some(4u32)
565 }
566 (Self::HeadingHold, Inav5 | Inav6 | Inav7 | Inav8) => Some(4u32),
567 (Self::Passthru, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
568 Some(5u32)
569 }
570 (Self::HeadFree, Inav5 | Inav6 | Inav7 | Inav8) => Some(5u32),
571 (Self::Failsafe, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
572 Some(6u32)
573 }
574 (Self::HeadAdjust, Inav5 | Inav6 | Inav7 | Inav8) => Some(6u32),
575 (Self::GpsRescue, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
576 Some(7u32)
577 }
578 (Self::CamStab, Inav5 | Inav6 | Inav7 | Inav8) => Some(7u32),
579 (Self::AntiGravity, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
580 Some(8u32)
581 }
582 (Self::NavRth, Inav5 | Inav6 | Inav7 | Inav8) => Some(8u32),
583 (Self::HeadAdjust, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
584 Some(9u32)
585 }
586 (Self::NavPositionHold, Inav5 | Inav6 | Inav7 | Inav8) => Some(9u32),
587 (Self::CamStab, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
588 Some(10u32)
589 }
590 (Self::Manual, Inav5 | Inav6 | Inav7 | Inav8) => Some(10u32),
591 (
592 Self::BeeperOn,
593 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
594 | Inav7 | Inav8,
595 ) => Some(11u32),
596 (
597 Self::LedLow,
598 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
599 | Inav7 | Inav8,
600 ) => Some(12u32),
601 (Self::Calibration, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
602 Some(13u32)
603 }
604 (Self::Lights, Inav5 | Inav6 | Inav7 | Inav8) => Some(13u32),
605 (Self::Osd, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
606 Some(14u32)
607 }
608 (Self::NavLaunch, Inav5 | Inav6 | Inav7 | Inav8) => Some(14u32),
609 (Self::Telemetry, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
610 Some(15u32)
611 }
612 (Self::Osd, Inav5 | Inav6 | Inav7 | Inav8) => Some(15u32),
613 (Self::Servo1, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
614 Some(16u32)
615 }
616 (Self::Telemetry, Inav5 | Inav6 | Inav7 | Inav8) => Some(16u32),
617 (Self::Servo2, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
618 Some(17u32)
619 }
620 (Self::Blackbox, Inav5 | Inav6 | Inav7 | Inav8) => Some(17u32),
621 (Self::Servo3, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
622 Some(18u32)
623 }
624 (Self::Failsafe, Inav5 | Inav6 | Inav7 | Inav8) => Some(18u32),
625 (Self::Blackbox, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
626 Some(19u32)
627 }
628 (Self::NavWaypoint, Inav5 | Inav6 | Inav7 | Inav8) => Some(19u32),
629 (
630 Self::Airmode,
631 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5 | Inav5 | Inav6
632 | Inav7 | Inav8,
633 ) => Some(20u32),
634 (Self::ThreeD, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
635 Some(21u32)
636 }
637 (Self::HomeReset, Inav5 | Inav6 | Inav7 | Inav8) => Some(21u32),
638 (Self::FpvAngleMix, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
639 Some(22u32)
640 }
641 (Self::GcsNav, Inav5 | Inav6 | Inav7 | Inav8) => Some(22u32),
642 (
643 Self::BlackboxErase,
644 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5,
645 ) => Some(23u32),
646 (Self::Killswitch, Inav5 | Inav6 | Inav7) => Some(23u32),
647 (Self::Camera1, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
648 Some(24u32)
649 }
650 (Self::Surface, Inav5 | Inav6 | Inav7 | Inav8) => Some(24u32),
651 (Self::Camera2, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
652 Some(25u32)
653 }
654 (Self::Flaperon, Inav5 | Inav6 | Inav7 | Inav8) => Some(25u32),
655 (Self::Camera3, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
656 Some(26u32)
657 }
658 (Self::TurnAssist, Inav5 | Inav6 | Inav7 | Inav8) => Some(26u32),
659 (Self::Turtle, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
660 Some(27u32)
661 }
662 (Self::AutoTrim, Inav5 | Inav6 | Inav7 | Inav8) => Some(27u32),
663 (Self::Prearm, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
664 Some(28u32)
665 }
666 (Self::AutoTune, Inav5 | Inav6 | Inav7 | Inav8) => Some(28u32),
667 (Self::BeepGpsCount, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
668 Some(29u32)
669 }
670 (Self::Camera1, Inav5 | Inav6 | Inav7 | Inav8) => Some(29u32),
671 (Self::VtxPitMode, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
672 Some(30u32)
673 }
674 (Self::Camera2, Inav5 | Inav6 | Inav7 | Inav8) => Some(30u32),
675 (Self::Paralyze, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
676 Some(31u32)
677 }
678 (Self::Camera3, Inav5 | Inav6 | Inav7 | Inav8) => Some(31u32),
679 (Self::User1, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
680 Some(32u32)
681 }
682 (Self::OsdAlt1, Inav5 | Inav6 | Inav7 | Inav8) => Some(32u32),
683 (Self::User2, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
684 Some(33u32)
685 }
686 (Self::OsdAlt2, Inav5 | Inav6 | Inav7 | Inav8) => Some(33u32),
687 (Self::User3, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
688 Some(34u32)
689 }
690 (Self::OsdAlt3, Inav5 | Inav6 | Inav7 | Inav8) => Some(34u32),
691 (Self::User4, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
692 Some(35u32)
693 }
694 (Self::NavCourseHold, Inav5 | Inav6 | Inav7 | Inav8) => Some(35u32),
695 (Self::PidAudio, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
696 Some(36u32)
697 }
698 (Self::Braking, Inav5 | Inav6 | Inav7 | Inav8) => Some(36u32),
699 (Self::AcroTrainer, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
700 Some(37u32)
701 }
702 (Self::User1, Inav5 | Inav6 | Inav7 | Inav8) => Some(37u32),
703 (
704 Self::VtxControlDisable,
705 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5,
706 ) => Some(38u32),
707 (Self::User2, Inav5 | Inav6 | Inav7 | Inav8) => Some(38u32),
708 (
709 Self::LaunchControl,
710 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5,
711 ) => Some(39u32),
712 (Self::FpvAngleMix, Inav5 | Inav6 | Inav7 | Inav8) => Some(39u32),
713 (Self::MspOverride, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
714 Some(40u32)
715 }
716 (Self::LoiterChange, Inav5 | Inav6 | Inav7 | Inav8) => Some(40u32),
717 (
718 Self::StickCommandDisable,
719 Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5,
720 ) => Some(41u32),
721 (Self::MspRcOverride, Inav5 | Inav6 | Inav7 | Inav8) => Some(41u32),
722 (Self::BeeperMute, Betaflight4_2 | Betaflight4_3 | Betaflight4_4 | Betaflight4_5) => {
723 Some(42u32)
724 }
725 (Self::Prearm, Inav5 | Inav6 | Inav7 | Inav8) => Some(42u32),
726 (Self::Ready, Betaflight4_5) => Some(43u32),
727 (Self::Turtle, Inav5 | Inav6 | Inav7 | Inav8) => Some(43u32),
728 (Self::LapTimerReset, Betaflight4_5) => Some(44u32),
729 (Self::NavCruise, Inav5 | Inav6 | Inav7 | Inav8) => Some(44u32),
730 (Self::AutoLevel, Inav5 | Inav6 | Inav7 | Inav8) => Some(45u32),
731 (Self::PlanWpMission, Inav5 | Inav6 | Inav7 | Inav8) => Some(46u32),
732 (Self::Soaring, Inav5 | Inav6 | Inav7 | Inav8) => Some(47u32),
733 (Self::User3, Inav6 | Inav7 | Inav8) => Some(48u32),
734 (Self::User4, Inav6 | Inav7 | Inav8) => Some(49u32),
735 (Self::MissionChange, Inav6 | Inav7 | Inav8) => Some(50u32),
736 (Self::Beepermute, Inav7 | Inav8) => Some(51u32),
737 (Self::Multifunction, Inav7 | Inav8) => Some(52u32),
738 (Self::Mixerprofile, Inav7 | Inav8) => Some(53u32),
739 (Self::Mixertransition, Inav7 | Inav8) => Some(54u32),
740 (Self::AngleHold, Inav7 | Inav8) => Some(55u32),
741 (Self::Gimbaltlock, Inav8) => Some(56u32),
742 (Self::Gimbalrlock, Inav8) => Some(57u32),
743 (Self::Gimbalcenter, Inav8) => Some(58u32),
744 (Self::Gimbalhtrk, Inav8) => Some(59u32),
745 _ => None,
746 }
747 }
748}