AP_Relay: check enabled relay mask for passing relay outputs to hardware

This commit is contained in:
James O'Shannessy 2023-09-05 00:48:19 +10:00 committed by Peter Barker
parent 8125ba1a41
commit 768e2409df

View File

@ -156,8 +156,10 @@ void AP_Relay::set(const uint8_t instance, const bool value)
_last_log_ms = now;
_last_logged_pin_states = _pin_states;
}
#if AP_SIM_ENABLED && (CONFIG_HAL_BOARD != HAL_BOARD_SITL)
return;
#if AP_SIM_ENABLED
if (!(AP::sitl()->on_hardware_relay_enable_mask & (1U << instance))) {
return;
}
#endif
hal.gpio->pinMode(_pin[instance], HAL_GPIO_OUTPUT);
hal.gpio->write(_pin[instance], value);