From e79ad57def00dd1a1b2053d5871d1d51cfe61685 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 10 Oct 2022 10:47:42 +1100 Subject: [PATCH] AP_Relay: added get() method for scripting --- libraries/AP_Relay/AP_Relay.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/AP_Relay/AP_Relay.h b/libraries/AP_Relay/AP_Relay.h index 9a7dcdf389..18aad6e93b 100644 --- a/libraries/AP_Relay/AP_Relay.h +++ b/libraries/AP_Relay/AP_Relay.h @@ -32,6 +32,11 @@ public: // de-activate the relay void off(uint8_t instance) { set(instance, false); } + // get state of relay + uint8_t get(uint8_t instance) const { + return instance < AP_RELAY_NUM_RELAYS ? _pin_states & (1U<