AP_BoardConfig: added BRD_OPTIONS flag for setting of internal parameters

this allows us to make parameters read-only for normal use, but for
special developer requirements the user can unlock the parameters at
their own risk
This commit is contained in:
Andrew Tridgell 2020-12-03 19:12:14 +11:00
parent c731e77607
commit f543c483fc
2 changed files with 7 additions and 1 deletions

View File

@ -270,7 +270,7 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = {
// @Param: OPTIONS
// @DisplayName: Board options
// @Description: Board specific option flags
// @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp
// @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp, 2:Enable set of internal parameters
// @User: Advanced
AP_GROUPINFO("OPTIONS", 19, AP_BoardConfig, _options, HAL_BRD_OPTIONS_DEFAULT),

View File

@ -165,6 +165,7 @@ public:
enum board_options {
BOARD_OPTION_WATCHDOG = (1 << 0),
DISABLE_FTP = (1<<1),
ALLOW_SET_INTERNAL_PARM = (1<<2),
};
// return true if ftp is disabled
@ -177,6 +178,11 @@ public:
return _singleton?(_singleton->_options & BOARD_OPTION_WATCHDOG)!=0:HAL_WATCHDOG_ENABLED_DEFAULT;
}
// return true if we allow setting of internal parameters (for developers)
static bool allow_set_internal_parameters(void) {
return _singleton?(_singleton->_options & ALLOW_SET_INTERNAL_PARM)!=0:false;
}
// handle press of safety button. Return true if safety state
// should be toggled
bool safety_button_handle_pressed(uint8_t press_count);