mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-26 18:48:30 -04:00
AP_Button: added arming check
This commit is contained in:
parent
45cf726a4b
commit
ef93165f28
@ -368,6 +368,21 @@ void AP_Button::setup_pins(void)
|
||||
}
|
||||
}
|
||||
|
||||
// check settings are valid
|
||||
bool AP_Button::arming_checks(size_t buflen, char *buffer) const
|
||||
{
|
||||
if (!enable) {
|
||||
return true;
|
||||
}
|
||||
for (uint8_t i=0; i<AP_BUTTON_NUM_PINS; i++) {
|
||||
if (pin[i] != -1 && !hal.gpio->valid_pin(pin[i])) {
|
||||
hal.util->snprintf(buffer, buflen, "BTN_PIN%u invalid", i + 1, pin[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace AP {
|
||||
|
||||
AP_Button &button()
|
||||
|
@ -45,6 +45,9 @@ public:
|
||||
// used by scripting
|
||||
bool get_button_state(uint8_t number);
|
||||
|
||||
// check settings are valid
|
||||
bool arming_checks(size_t buflen, char *buffer) const;
|
||||
|
||||
private:
|
||||
|
||||
static AP_Button *_singleton;
|
||||
|
Loading…
Reference in New Issue
Block a user