AP_Relay: Check for pin conflicts between relays
This commit is contained in:
parent
15cea77e98
commit
2bc5078c7a
@ -472,6 +472,18 @@ bool AP_Relay::arming_checks(size_t buflen, char *buffer) const
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Each pin can only be used by a single relay
|
||||||
|
for (uint8_t j=i+1; j<ARRAY_SIZE(_params); j++) {
|
||||||
|
if (!function_valid((AP_Relay_Params::FUNCTION)_params[j].function.get())) {
|
||||||
|
// Relay disabled
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (pin == _params[j].pin.get()) {
|
||||||
|
hal.util->snprintf(buffer, buflen, "pin conflict RELAY%u_PIN = RELAY%u_PIN", int(i+1), int(j+1));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user