From 8e62385d8d906b6c6d5c926ad9245014d43d9d9c Mon Sep 17 00:00:00 2001 From: Peter Hall Date: Wed, 4 Aug 2021 20:47:25 +0100 Subject: [PATCH] RC_Channel: add lua helper --- libraries/RC_Channel/RC_Channel.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/RC_Channel/RC_Channel.h b/libraries/RC_Channel/RC_Channel.h index c3f3e31a2f..a9fe8c0b57 100644 --- a/libraries/RC_Channel/RC_Channel.h +++ b/libraries/RC_Channel/RC_Channel.h @@ -399,6 +399,11 @@ public: // this function is implemented in the child class in the vehicle // code virtual RC_Channel *channel(uint8_t chan) = 0; + // helper used by scripting to convert the above function from 0 to 1 indexeing + // range is checked correctly by the underlying channel function + RC_Channel *lua_rc_channel(const uint8_t chan) { + return channel(chan -1); + } uint8_t get_radio_in(uint16_t *chans, const uint8_t num_channels); // reads a block of chanel radio_in values starting from channel 0 // returns the number of valid channels