diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 2c47db92dd..0d3a3df5d4 100755 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -2083,7 +2083,7 @@ static void printMap(uint8_t dumpMask, const rxConfig_t *rxConfig, const rxConfi char buf[16]; char bufDefault[16]; uint32_t i; - for (i = 0; i < MAX_MAPPABLE_RX_INPUTS; i++) { + for (i = 0; i < RX_MAPPABLE_CHANNEL_COUNT; i++) { buf[rxConfig->rcmap[i]] = rcChannelLetters[i]; if (defaultRxConfig) { bufDefault[defaultRxConfig->rcmap[i]] = rcChannelLetters[i]; diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index ff3e813f93..6e1af8e5dc 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1200,7 +1200,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn break; case MSP_RX_MAP: - sbufWriteData(dst, rxConfig()->rcmap, MAX_MAPPABLE_RX_INPUTS); + sbufWriteData(dst, rxConfig()->rcmap, RX_MAPPABLE_CHANNEL_COUNT); break; case MSP_BF_CONFIG: @@ -1955,7 +1955,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src) break; case MSP_SET_RX_MAP: - for (int i = 0; i < MAX_MAPPABLE_RX_INPUTS; i++) { + for (int i = 0; i < RX_MAPPABLE_CHANNEL_COUNT; i++) { rxConfigMutable()->rcmap[i] = sbufReadU8(src); } break; diff --git a/src/main/rx/rx.c b/src/main/rx/rx.c index 8ca6509621..aee1074a70 100644 --- a/src/main/rx/rx.c +++ b/src/main/rx/rx.c @@ -81,7 +81,7 @@ static uint32_t needRxSignalMaxDelayUs; static uint32_t suspendRxSignalUntil = 0; static uint8_t skipRxSamples = 0; -int16_t rcRaw[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000] +static int16_t rcRaw[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000] int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000] uint32_t rcInvalidPulsPeriod[MAX_SUPPORTED_RC_CHANNEL_COUNT]; @@ -516,7 +516,7 @@ static void readRxChannelsApplyRanges(void) const int channelCount = getRxChannelCount(); for (int channel = 0; channel < channelCount; channel++) { - const uint8_t rawChannel = calculateChannelRemapping(rxConfig()->rcmap, REMAPPABLE_CHANNEL_COUNT, channel); + const uint8_t rawChannel = calculateChannelRemapping(rxConfig()->rcmap, RX_MAPPABLE_CHANNEL_COUNT, channel); // sample the channel uint16_t sample = rxRuntimeConfig.rcReadRawFn(&rxRuntimeConfig, rawChannel); @@ -617,7 +617,7 @@ void parseRcChannels(const char *input, rxConfig_t *rxConfig) { for (const char *c = input; *c; c++) { const char *s = strchr(rcChannelLetters, *c); - if (s && (s < rcChannelLetters + MAX_MAPPABLE_RX_INPUTS)) { + if (s && (s < rcChannelLetters + RX_MAPPABLE_CHANNEL_COUNT)) { rxConfig->rcmap[s - rcChannelLetters] = c - input; } } diff --git a/src/main/rx/rx.h b/src/main/rx/rx.h index 48772e0d16..2c8e212481 100644 --- a/src/main/rx/rx.h +++ b/src/main/rx/rx.h @@ -78,7 +78,7 @@ extern const char rcChannelLetters[]; extern int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000] -#define MAX_MAPPABLE_RX_INPUTS 8 +#define RX_MAPPABLE_CHANNEL_COUNT 8 #define RSSI_SCALE_MIN 1 #define RSSI_SCALE_MAX 255 @@ -115,7 +115,7 @@ typedef struct rxChannelRangeConfig_s { PG_DECLARE_ARRAY(rxChannelRangeConfig_t, NON_AUX_CHANNEL_COUNT, rxChannelRangeConfigs); typedef struct rxConfig_s { - uint8_t rcmap[MAX_MAPPABLE_RX_INPUTS]; // mapping of radio channels to internal RPYTA+ order + uint8_t rcmap[RX_MAPPABLE_CHANNEL_COUNT]; // mapping of radio channels to internal RPYTA+ order uint8_t serialrx_provider; // type of UART-based receiver (0 = spek 10, 1 = spek 11, 2 = sbus). Must be enabled by FEATURE_RX_SERIAL first. uint8_t sbus_inversion; // default sbus (Futaba, FrSKY) is inverted. Support for uninverted OpenLRS (and modified FrSKY) receivers. uint8_t halfDuplex; // allow rx to operate in half duplex mode on F4, ignored for F1 and F3. @@ -145,8 +145,6 @@ typedef struct rxConfig_s { PG_DECLARE(rxConfig_t, rxConfig); -#define REMAPPABLE_CHANNEL_COUNT (sizeof(((rxConfig_t *)0)->rcmap) / sizeof(((rxConfig_t *)0)->rcmap[0])) - struct rxRuntimeConfig_s; typedef uint16_t (*rcReadRawDataFnPtr)(const struct rxRuntimeConfig_s *rxRuntimeConfig, uint8_t chan); // used by receiver driver to return channel data typedef uint8_t (*rcFrameStatusFnPtr)(void); diff --git a/src/main/target/COLIBRI_RACE/i2c_bst.c b/src/main/target/COLIBRI_RACE/i2c_bst.c index c7d2114a3b..845785a9f2 100644 --- a/src/main/target/COLIBRI_RACE/i2c_bst.c +++ b/src/main/target/COLIBRI_RACE/i2c_bst.c @@ -411,7 +411,7 @@ static bool bstSlaveProcessFeedbackCommand(uint8_t bstRequest) break; case BST_RX_MAP: - for (i = 0; i < MAX_MAPPABLE_RX_INPUTS; i++) + for (i = 0; i < RX_MAPPABLE_CHANNEL_COUNT; i++) bstWrite8(rxConfig()->rcmap[i]); break; @@ -563,7 +563,7 @@ static bool bstSlaveProcessWriteCommand(uint8_t bstWriteCommand) } break; case BST_SET_RX_MAP: - for (i = 0; i < MAX_MAPPABLE_RX_INPUTS; i++) { + for (i = 0; i < RX_MAPPABLE_CHANNEL_COUNT; i++) { rxConfigMutable()->rcmap[i] = bstRead8(); } break;