Files
ardupilot/libraries/AP_Relay
Henry WurzburgandClaude Sonnet 5 9895756d87 AP_Relay: add hwdef-level RELAYn_DEFAULT compiled default for boot state
RELAYn_PIN_DEFAULT already lets a board's hwdef.dat set the relay pin
at compile time, but the relay's ON/OFF boot state had no equivalent -
it was hardcoded to DefaultState::OFF, with the only override being a
RELAYn_DEFAULT parm line in defaults.parm. Several board hwdefs (and
open board-support PRs) assumed a hwdef-level default already existed
and either documented a boot state defaults.parm never delivered, or
carried an already-written but silently dead RELAYn_DEFAULT hwdef
define.

Add optional RELAY1_DEFAULT..RELAY6_DEFAULT macros, following the same
pattern as the existing pin defaults, applied in set_defaults() before
init() configures the GPIO. Verified in SITL with --define=RELAY2_DEFAULT=1
that the compiled default reaches the live parameter (RELAY2_DEFAULT
reads back as 1 with a fresh eeprom, RELAY1_DEFAULT remains the
hardcoded 0 fallback when unspecified).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-03 16:59:03 +01:00
..