GCS_MAVLink: implement BRD_OPTIONS bit for setting of internal parameters

This commit is contained in:
Andrew Tridgell 2020-12-03 19:13:08 +11:00
parent 12acc0724e
commit 5e3bf0a703

View File

@ -18,6 +18,7 @@
#include "GCS.h"
#include <AP_Logger/AP_Logger.h>
#include <AP_BoardConfig/AP_BoardConfig.h>
extern const AP_HAL::HAL& hal;
@ -276,6 +277,14 @@ void GCS_MAVLINK::handle_param_set(const mavlink_message_t &msg)
float old_value = vp->cast_to_float(var_type);
if (parameter_flags & AP_PARAM_FLAG_INTERNAL_USE_ONLY) {
// the user can set BRD_OPTIONS to enable set of internal
// parameters, for developer testing or unusual use cases
if (AP_BoardConfig::allow_set_internal_parameters()) {
parameter_flags &= ~AP_PARAM_FLAG_INTERNAL_USE_ONLY;
}
}
if ((parameter_flags & AP_PARAM_FLAG_INTERNAL_USE_ONLY) || vp->is_read_only()) {
gcs().send_text(MAV_SEVERITY_WARNING, "Param write denied (%s)", key);
// send the readonly value