diff --git a/libraries/AP_Relay/AP_Relay.cpp b/libraries/AP_Relay/AP_Relay.cpp index d83dd6121f..fb0a1db612 100644 --- a/libraries/AP_Relay/AP_Relay.cpp +++ b/libraries/AP_Relay/AP_Relay.cpp @@ -152,6 +152,18 @@ void AP_Relay::toggle(uint8_t instance) } } +// check settings are valid +bool AP_Relay::arming_checks(size_t buflen, char *buffer) const +{ + for (uint8_t i=0; ivalid_pin(_pin[i])) { + hal.util->snprintf(buffer, buflen, "Relay[%u] pin %d invalid", i + 1, _pin[i]); + return false; + } + } + return true; +} + namespace AP { AP_Relay *relay() diff --git a/libraries/AP_Relay/AP_Relay.h b/libraries/AP_Relay/AP_Relay.h index c8c5295ef7..a13748d9d5 100644 --- a/libraries/AP_Relay/AP_Relay.h +++ b/libraries/AP_Relay/AP_Relay.h @@ -38,6 +38,9 @@ public: // toggle the relay status void toggle(uint8_t instance); + // check settings are valid + bool arming_checks(size_t buflen, char *buffer) const; + static AP_Relay *get_singleton(void) {return singleton; } static const struct AP_Param::GroupInfo var_info[];