From aaa2ba48838e0367b26d22c4c094ea2a3d2aa6d2 Mon Sep 17 00:00:00 2001 From: blckmn Date: Sat, 31 Dec 2016 20:27:44 +1100 Subject: [PATCH] Small bug fix and ioTag_t cast --- src/main/drivers/io_def.h | 2 +- src/main/fc/config.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/drivers/io_def.h b/src/main/drivers/io_def.h index 5360dfbc9..a200f4af4 100644 --- a/src/main/drivers/io_def.h +++ b/src/main/drivers/io_def.h @@ -40,7 +40,7 @@ #define DEFIO_REC_INDEXED(idx) (ioRecs + (idx)) // ioTag_t accessor macros -#define DEFIO_TAG_MAKE(gpioid, pin) ((((gpioid) + 1) << 4) | (pin)) +#define DEFIO_TAG_MAKE(gpioid, pin) ((ioTag_t)((((gpioid) + 1) << 4) | (pin))) #define DEFIO_TAG_ISEMPTY(tag) (!(tag)) #define DEFIO_TAG_GPIOID(tag) (((tag) >> 4) - 1) #define DEFIO_TAG_PIN(tag) ((tag) & 0x0f) diff --git a/src/main/fc/config.c b/src/main/fc/config.c index b4cad26f4..992e78d4e 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -1081,7 +1081,7 @@ void changeProfile(uint8_t profileIndex) void changeControlRateProfile(uint8_t profileIndex) { - if (profileIndex > MAX_RATEPROFILES) { + if (profileIndex >= MAX_RATEPROFILES) { profileIndex = MAX_RATEPROFILES - 1; } setControlRateProfile(profileIndex);