From 63c090e7ed246a8b3437100114f5229edef7134d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:05:43 +0200 Subject: [PATCH] commence breakage --- src/main/drivers/pwm_mapping.h | 2 +- src/main/flight/servos.h | 14 +++++++++++++- src/main/rx/sbus.c | 8 ++++---- src/main/rx/sbus_channels.c | 8 +++++--- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 08123130f..161735a44 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -28,7 +28,7 @@ #define MAX_MOTORS 12 #endif -#define MAX_SERVOS 18 +#define MAX_SERVOS 36 #define PWM_TIMER_HZ 1000000 diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index 4f6e57779..5a161d6e4 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -20,7 +20,7 @@ #include "config/parameter_group.h" #include "programming/logic_condition.h" -#define MAX_SUPPORTED_SERVOS 18 +#define MAX_SUPPORTED_SERVOS 36 // These must be consecutive typedef enum { @@ -75,6 +75,18 @@ typedef enum { INPUT_RC_CH22 = 47, INPUT_RC_CH23 = 48, INPUT_RC_CH24 = 49, + INPUT_RC_CH25 = 50, + INPUT_RC_CH26 = 51, + INPUT_RC_CH27 = 52, + INPUT_RC_CH28 = 53, + INPUT_RC_CH29 = 54, + INPUT_RC_CH30 = 55, + INPUT_RC_CH31 = 56, + INPUT_RC_CH32 = 57, + INPUT_RC_CH33 = 58, + INPUT_RC_CH34 = 59, + INPUT_RC_CH35 = 60, + INPUT_RC_CH36 = 61, #endif INPUT_SOURCE_COUNT } inputSource_e; diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 9b24361a0..27fa927b9 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -88,11 +88,12 @@ static void sbusDataReceive(uint16_t c, void *data) switch (sbusFrameData->state) { case STATE_SBUS_SYNC: - if (c == SBUS_FRAME_BEGIN_BYTE) { + // Ignore non 26 channel packets + if (c == SBUS_FRAME_BEGIN_BYTE && !sbusFrameData->is26channels) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; - } else if (c == SBUS26_FRAME0_BEGIN_BYTE) { + } else if (c == SBUS26_FRAME0_BEGIN_BYTE && false) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS26_PAYLOAD_LOW; @@ -141,7 +142,6 @@ static void sbusDataReceive(uint16_t c, void *data) memcpy((void *)&sbusFrameData->frame, (void *)&sbusFrameData->buffer[0], SBUS_FRAME_SIZE); sbusFrameData->frameDone = true; - sbusFrameData->is26channels = false; } } break; @@ -221,7 +221,7 @@ static uint8_t sbusFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig) static bool sbusInitEx(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, uint32_t sbusBaudRate) { static uint16_t sbusChannelData[SBUS_MAX_CHANNEL]; - static sbusFrameData_t sbusFrameData; + static sbusFrameData_t sbusFrameData = { .is26channels = false}; rxRuntimeConfig->channelData = sbusChannelData; rxRuntimeConfig->frameData = &sbusFrameData; diff --git a/src/main/rx/sbus_channels.c b/src/main/rx/sbus_channels.c index 01c9aab5b..60f107379 100644 --- a/src/main/rx/sbus_channels.c +++ b/src/main/rx/sbus_channels.c @@ -68,18 +68,20 @@ uint8_t sbus26ChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChann sbusChannelData[33 + offset] = SBUS_DIGITAL_CHANNEL_MIN; } + uint8_t ret = 0; + if (channels->flags & SBUS_FLAG_FAILSAFE_ACTIVE) { // internal failsafe enabled and rx failsafe flag set // RX *should* still be sending valid channel data, so use it. - return RX_FRAME_COMPLETE | RX_FRAME_FAILSAFE; + ret = RX_FRAME_FAILSAFE; } if (channels->flags & SBUS_FLAG_SIGNAL_LOSS) { // The received data is a repeat of the last valid data so can be considered complete. - return RX_FRAME_COMPLETE | RX_FRAME_DROPPED; + ret = RX_FRAME_DROPPED; } - return RX_FRAME_COMPLETE; + return ret | (highChannels ? RX_FRAME_COMPLETE : RX_FRAME_PENDING); } uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels) -- 2.11.4.GIT