mirror of https://github.com/ArduPilot/ardupilot
AP_Relay: added arming_checks
This commit is contained in:
parent
d827b35e57
commit
09ad43dea3
|
@ -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; i<AP_RELAY_NUM_RELAYS; i++) {
|
||||
if (_pin[i] != -1 && !hal.gpio->valid_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()
|
||||
|
|
|
@ -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[];
|
||||
|
|
Loading…
Reference in New Issue