BetaFlight统一硬件配置文件研读之feature命令

BetaFlight统一硬件配置文件研读之feature命令

  • 1. 源由
  • 2. 代码分析
  • 3. 实例分析
  • 4. 配置情况
    • 4.1 feature
    • 4.2 feature list
    • 4.3 feature feature_name
    • 4.4 feature -feature_name
  • 5. 参考资料

统一硬件配置文件的设计是一种非常好的设计模式,可以将硬件和软件的工作进行解耦。

1. 源由

cli命令中feature是对BetaFlight飞控软件功能使能开关。至于功能的含义,这里就不展开,随着对系统的深入理解,慢慢就会一点点了解起来的。

比如:TELEMETRY表示电传功能

2. 代码分析

cliFeature
 ├──> "feature" [print all enabled features]
 ├──> "feature list" [print all available features]
 └──> "feature "
     └──> [Find feature]
         ├──>  featureConfigClear(feature)
         └──>  featureConfigSet(feature)

以下是目前BetaFlight飞控系统所支持的features:

// sync this with features_e
static const char * const featureNames[] = {
    "RX_PPM", "", "INFLIGHT_ACC_CAL", "RX_SERIAL", "MOTOR_STOP",
    "SERVO_TILT", "SOFTSERIAL", "GPS", "",
    "RANGEFINDER", "TELEMETRY", "", "3D", "RX_PARALLEL_PWM",
    "RX_MSP", "RSSI_ADC", "LED_STRIP", "DISPLAY", "OSD",
    "", "CHANNEL_FORWARDING", "TRANSPONDER", "AIRMODE",
    "", "", "RX_SPI", "", "ESC_SENSOR", "ANTI_GRAVITY", "", NULL
};

3. 实例分析

# feature
feature RX_SERIAL
feature TELEMETRY
feature OSD

4. 配置情况

# help feature
feature - configure features
	list
	<->[name]

4.1 feature

# feature
Enabled: RX_SERIAL TELEMETRY LED_STRIP OSD AIRMODE ANTI_GRAVITY 

4.2 feature list

# feature list
Available: RX_PPM INFLIGHT_ACC_CAL RX_SERIAL MOTOR_STOP SERVO_TILT SOFTSERIAL GPS RANGEFINDER TELEMETRY 3D RX_PARALLEL_PWM RX_MSP RSSI_ADC LED_STRIP DISPLAY OSD CHANNEL_FORWARDING TRANSPONDER AIRMODE RX_SPI ESC_SENSOR ANTI_GRAVITY

4.3 feature feature_name

# feature OSD
Enabled OSD

4.4 feature -feature_name

# feature -OSD
Disabled OSD

5. 参考资料

【1】BetaFlight开源代码框架简介
【2】BetaFlight统一硬件资源简单配置修改
【3】BetaFlight统一硬件配置文件研读

你可能感兴趣的:(xFlight,BetaFlight,STM32,嵌入式)