From 60a13f4eebff7698c7b7f63792e62c5dd7653e78 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 29 Dec 2019 19:09:27 +1100 Subject: [PATCH] AP_BoardConfig: added BRD_ALT_CONFIG parameter allow for alternative hw configs to be selected --- libraries/AP_BoardConfig/AP_BoardConfig.cpp | 9 +++++++++ libraries/AP_BoardConfig/AP_BoardConfig.h | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.cpp b/libraries/AP_BoardConfig/AP_BoardConfig.cpp index c5917a16bf..45febe518a 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.cpp +++ b/libraries/AP_BoardConfig/AP_BoardConfig.cpp @@ -279,6 +279,15 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = { // @User: Advanced AP_SUBGROUPINFO(heater.pi_controller, "IMUHEAT_", 21, AP_BoardConfig, AC_PI), #endif + + // @Param: ALT_CONFIG + // @DisplayName: Alternative HW config + // @Description: Select an alternative hardware configuration. A value of zero selects the default configuration for this board. Other values are board specific. Please see the documentation for your board for details on any alternative configuration values that may be available. + // @Range: 0 10 + // @Increment: 1 + // @User: Advanced + // @RebootRequired: True + AP_GROUPINFO("ALT_CONFIG", 22, AP_BoardConfig, _alt_config, 0), AP_GROUPEND }; diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.h b/libraries/AP_BoardConfig/AP_BoardConfig.h index ad2ea348bb..9a99007aa4 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.h +++ b/libraries/AP_BoardConfig/AP_BoardConfig.h @@ -116,6 +116,11 @@ public: return _singleton?_singleton->pwm_count.get():8; } + // get alternative config selection + uint8_t get_alt_config(void) { + return uint8_t(_alt_config.get()); + } + enum board_safety_button_option { BOARD_SAFETY_OPTION_BUTTON_ACTIVE_SAFETY_OFF= (1 << 0), BOARD_SAFETY_OPTION_BUTTON_ACTIVE_SAFETY_ON= (1 << 1), @@ -251,6 +256,8 @@ private: AP_Int16 _boot_delay_ms; AP_Int32 _options; + + AP_Int8 _alt_config; }; namespace AP {