Skip to content

Commit

Permalink
Add pinswap option to serial ports
Browse files Browse the repository at this point in the history
This commit adds CLI options:
  - serialrx_pinswap
  - tlm_pinswap
  - vtx_pinswap
  - esc_sensor_pinswap

Setting the pinswap to TRUE swaps the Tx and Rx pins around,
vs. the selected pins in the resources.

If the resource pins are already swapped, then pinswap will
swap them again, effectively to unswapped.
  • Loading branch information
pmattila committed Jul 25, 2024
1 parent 6732db4 commit 240a40e
Show file tree
Hide file tree
Showing 30 changed files with 192 additions and 73 deletions.
14 changes: 13 additions & 1 deletion src/main/cli/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,10 @@ const clivalue_t valueTable[] = {
#ifdef USE_SERIAL_RX
{ PARAM_NAME_SERIAL_RX_PROVIDER, VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_SERIAL_RX }, PG_RX_CONFIG, offsetof(rxConfig_t, serialrx_provider) },
{ "serialrx_inverted", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, serialrx_inverted) },
{ "serialrx_halfduplex", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, halfDuplex) },
#ifdef USE_SERIAL_PINSWAP
{ "serialrx_pinswap", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, pinSwap) },
#endif
#endif
#ifdef USE_SPEKTRUM_BIND
{ "spektrum_sat_bind", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { SPEKTRUM_SAT_BIND_DISABLED, SPEKTRUM_SAT_BIND_MAX}, PG_RX_CONFIG, offsetof(rxConfig_t, spektrum_sat_bind) },
Expand All @@ -734,7 +738,6 @@ const clivalue_t valueTable[] = {
{ "crsf_use_negotiated_baud", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, crsf_use_negotiated_baud) },
#endif
#endif
{ "serialrx_halfduplex", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, halfDuplex) },
#ifdef USE_RX_SPI
{ "rx_spi_protocol", VAR_UINT8 | HARDWARE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_RX_SPI }, PG_RX_SPI_CONFIG, offsetof(rxSpiConfig_t, rx_spi_protocol) },
{ "rx_spi_bus", VAR_UINT8 | HARDWARE_VALUE, .config.minmaxUnsigned = { 0, SPIDEV_COUNT }, PG_RX_SPI_CONFIG, offsetof(rxSpiConfig_t, spibus) },
Expand Down Expand Up @@ -1173,6 +1176,9 @@ const clivalue_t valueTable[] = {
#ifdef USE_TELEMETRY
{ "tlm_inverted", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, telemetry_inverted) },
{ "tlm_halfduplex", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, halfDuplex) },
#ifdef USE_SERIAL_PINSWAP
{ "tlm_pinswap", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, pinSwap) },
#endif
#if defined(USE_TELEMETRY_FRSKY_HUB)
#if defined(USE_GPS)
{ "frsky_default_lat", VAR_INT16 | MASTER_VALUE, .config.minmax = { -9000, 9000 }, PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, gpsNoFixLatitude) },
Expand Down Expand Up @@ -1485,6 +1491,9 @@ const clivalue_t valueTable[] = {
// PG_VTX_CONFIG
#if defined(USE_VTX_CONTROL) && defined(USE_VTX_COMMON)
{ "vtx_halfduplex", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_VTX_CONFIG, offsetof(vtxConfig_t, halfDuplex) },
#ifdef USE_SERIAL_PINSWAP
{ "vtx_pinswap", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_VTX_CONFIG, offsetof(vtxConfig_t, pinSwap) },
#endif
#endif

// PG_VTX_IO
Expand Down Expand Up @@ -1529,6 +1538,9 @@ const clivalue_t valueTable[] = {
#ifdef USE_ESC_SENSOR
{ "esc_sensor_protocol", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_ESC_SENSOR_PROTO }, PG_ESC_SENSOR_CONFIG, offsetof(escSensorConfig_t, protocol) },
{ "esc_sensor_halfduplex", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_ESC_SENSOR_CONFIG, offsetof(escSensorConfig_t, halfDuplex) },
#ifdef USE_SERIAL_PINSWAP
{ "esc_sensor_pinswap", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_ESC_SENSOR_CONFIG, offsetof(escSensorConfig_t, pinSwap) },
#endif
{ "esc_sensor_update_hz", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 10, 500 }, PG_ESC_SENSOR_CONFIG, offsetof(escSensorConfig_t, update_hz) },
{ "esc_sensor_current_offset", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 16000 }, PG_ESC_SENSOR_CONFIG, offsetof(escSensorConfig_t, current_offset) },
{ "esc_sensor_hw4_current_offset", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 1000 }, PG_ESC_SENSOR_CONFIG, offsetof(escSensorConfig_t, hw4_current_offset) },
Expand Down
46 changes: 29 additions & 17 deletions src/main/drivers/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,49 @@
#include "pg/serial_pinconfig.h"

typedef enum {
MODE_RX = 1 << 0,
MODE_TX = 1 << 1,
MODE_RXTX = MODE_RX | MODE_TX
MODE_RX = BIT(0),
MODE_TX = BIT(1),
MODE_RXTX = MODE_RX | MODE_TX
} portMode_e;

typedef enum {
SERIAL_NOT_INVERTED = 0 << 0,
SERIAL_INVERTED = 1 << 0,
SERIAL_STOPBITS_1 = 0 << 1,
SERIAL_STOPBITS_2 = 1 << 1,
SERIAL_PARITY_NO = 0 << 2,
SERIAL_PARITY_EVEN = 1 << 2,
SERIAL_UNIDIR = 0 << 3,
SERIAL_BIDIR = 1 << 3,
SERIAL_PINSWAP_BIT = 0,
SERIAL_INVERTED_BIT = 1,
SERIAL_STOPBITS_BIT = 2,
SERIAL_PARITY_BIT = 3,
SERIAL_BIDIR_BIT = 4,
SERIAL_BIDIR_OD_BIT = 5,
SERIAL_BIDIR_NOPULL_BIT = 6,
SERIAL_BIDIR_PULLDOWN_BIT = 7,
} portOptionBits_e;

typedef enum {
SERIAL_NOSWAP = 0,
SERIAL_PINSWAP = BIT(SERIAL_PINSWAP_BIT),
SERIAL_NOT_INVERTED = 0,
SERIAL_INVERTED = BIT(SERIAL_INVERTED_BIT),
SERIAL_STOPBITS_1 = 0,
SERIAL_STOPBITS_2 = BIT(SERIAL_STOPBITS_BIT),
SERIAL_PARITY_NO = 0,
SERIAL_PARITY_EVEN = BIT( SERIAL_PARITY_BIT),
SERIAL_UNIDIR = 0,
SERIAL_BIDIR = BIT(SERIAL_BIDIR_BIT),
/*
* Note on SERIAL_BIDIR_PP
* With SERIAL_BIDIR_PP, the very first start bit of back-to-back bytes
* is lost and the first data byte will be lost by a framing error.
* To ensure the first start bit to be sent, prepend a zero byte (0x00)
* to actual data bytes.
*/
SERIAL_BIDIR_OD = 0 << 4,
SERIAL_BIDIR_PP = 1 << 4,
SERIAL_BIDIR_NOPULL = 1 << 5, // disable pulls in BIDIR RX mode
SERIAL_BIDIR_PP_PD = 1 << 6, // PP mode, normall inverted, but with PullDowns, to fix SA after bidir issue fixed (#10220)
SERIAL_BIDIR_OD = 0,
SERIAL_BIDIR_PP = BIT(SERIAL_BIDIR_OD_BIT),
SERIAL_BIDIR_NOPULL = BIT(SERIAL_BIDIR_NOPULL_BIT), // disable pulls in BIDIR RX mode
SERIAL_BIDIR_PP_PD = BIT(SERIAL_BIDIR_PULLDOWN_BIT), // PP mode, normall inverted, but with PullDowns, to fix SA after bidir issue fixed (#10220)
} portOptions_e;

// Define known line control states which may be passed up by underlying serial driver callback
#define CTRL_LINE_STATE_DTR (1 << 0)
#define CTRL_LINE_STATE_RTS (1 << 1)
#define CTRL_LINE_STATE_DTR BIT(0)
#define CTRL_LINE_STATE_RTS BIT(1)

typedef void (*serialReceiveCallbackPtr)(uint16_t data, void *rxCallbackData); // used by serial drivers to return frames to app
typedef void (*serialIdleCallbackPtr)();
Expand Down
15 changes: 13 additions & 2 deletions src/main/drivers/serial_softserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,19 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb

int pinCfgIndex = portIndex + RESOURCE_SOFT_OFFSET;

ioTag_t tagRx = serialPinConfig()->ioTagRx[pinCfgIndex];
ioTag_t tagTx = serialPinConfig()->ioTagTx[pinCfgIndex];
ioTag_t tagRx, tagTx;
#ifdef USE_SERIAL_PINSWAP
if (options & SERIAL_PINSWAP)
{
tagTx = serialPinConfig()->ioTagRx[pinCfgIndex];
tagRx = serialPinConfig()->ioTagTx[pinCfgIndex];
}
else
#endif
{
tagRx = serialPinConfig()->ioTagRx[pinCfgIndex];
tagTx = serialPinConfig()->ioTagTx[pinCfgIndex];
}

const timerHardware_t *timerTx = timerAllocate(tagTx, OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
const timerHardware_t *timerRx = (tagTx == tagRx) ? timerTx : timerAllocate(tagRx, OWNER_SERIAL_RX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
Expand Down
2 changes: 2 additions & 0 deletions src/main/drivers/serial_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ LPUART_BUFFERS(1);

serialPort_t *uartOpen(UARTDevice_e device, serialReceiveCallbackPtr rxCallback, void *rxCallbackData, uint32_t baudRate, portMode_e mode, portOptions_e options)
{
uartSelectPins(device, options);

uartPort_t *uartPort = serialUART(device, baudRate, mode, options);

if (!uartPort)
Expand Down
42 changes: 32 additions & 10 deletions src/main/drivers/serial_uart_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void usartConfigurePinInversion(uartPort_t *uartPort) {
}
}

static uartDevice_t *uartFindDevice(uartPort_t *uartPort)
uartDevice_t *uartFindDevice(uartPort_t *uartPort)
{
for (uint32_t i = 0; i < UARTDEV_COUNT_MAX; i++) {
uartDevice_t *candidate = uartDevmap[i];
Expand All @@ -76,17 +76,39 @@ static uartDevice_t *uartFindDevice(uartPort_t *uartPort)
return NULL;
}

#if !(defined(STM32F4))
static void uartConfigurePinSwap(uartPort_t *uartPort)
void uartSelectPins(UARTDevice_e device, portOptions_e options)
{
uartDevice_t *uartDevice = uartFindDevice(uartPort);
if (!uartDevice) {
return;
UNUSED(options);

uartDevice_t *uartDevice = uartDevmap[device];

if (uartDevice) {
#ifdef USE_SERIAL_PINSWAP
bool swapOption = (options & SERIAL_PINSWAP);

if (uartDevice->pinSwap ^ swapOption) {
uartDevice->tx = uartDevice->rxPin;
uartDevice->rx = uartDevice->txPin;
}
else
#endif
{
uartDevice->rx = uartDevice->rxPin;
uartDevice->tx = uartDevice->txPin;
}
}
}

if (uartDevice->pinSwap) {
uartDevice->port.Handle.AdvancedInit.AdvFeatureInit |= UART_ADVFEATURE_SWAP_INIT;
uartDevice->port.Handle.AdvancedInit.Swap = UART_ADVFEATURE_SWAP_ENABLE;
#ifdef USE_SERIAL_PINSWAP
static void uartConfigurePinSwap(uartPort_t *uartPort)
{
uartDevice_t *uartDevice = uartFindDevice(uartPort);
if (uartDevice) {
bool swapOption = (uartPort->port.options & SERIAL_PINSWAP);
if (uartDevice->pinSwap ^ swapOption) {
uartDevice->port.Handle.AdvancedInit.AdvFeatureInit |= UART_ADVFEATURE_SWAP_INIT;
uartDevice->port.Handle.AdvancedInit.Swap = UART_ADVFEATURE_SWAP_ENABLE;
}
}
}
#endif
Expand Down Expand Up @@ -118,7 +140,7 @@ void uartReconfigure(uartPort_t *uartPort)


usartConfigurePinInversion(uartPort);
#if !(defined(STM32F1) || defined(STM32F4))
#ifdef USE_SERIAL_PINSWAP
uartConfigurePinSwap(uartPort);
#endif

Expand Down
6 changes: 5 additions & 1 deletion src/main/drivers/serial_uart_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ extern const uartHardware_t uartHardware[];
typedef struct uartDevice_s {
uartPort_t port;
const uartHardware_t *hardware;
uartPinDef_t rxPin;
uartPinDef_t txPin;
uartPinDef_t rx;
uartPinDef_t tx;
volatile uint8_t *rxBuffer;
volatile uint8_t *txBuffer;
#if !defined(STM32F4) // Don't support pin swap.
#if defined(USE_SERIAL_PINSWAP)
bool pinSwap;
#endif
} uartDevice_t;
Expand All @@ -219,6 +221,8 @@ uartPort_t *serialUART(UARTDevice_e device, uint32_t baudRate, portMode_e mode,

void uartIrqHandler(uartPort_t *s);

void uartSelectPins(UARTDevice_e device, portOptions_e options);

void uartReconfigure(uartPort_t *uartPort);

void uartConfigureDma(uartDevice_t *uartdev);
Expand Down
15 changes: 7 additions & 8 deletions src/main/drivers/serial_uart_pinconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,33 @@ void uartPinConfigure(const serialPinConfig_t *pSerialPinConfig)
const uartHardware_t *hardware = &uartHardware[hindex];
const UARTDevice_e device = hardware->device;

#if !defined(STM32F4) // Don't support pin swap.
#ifdef USE_SERIAL_PINSWAP
uartdev->pinSwap = false;
#endif
for (int pindex = 0 ; pindex < UARTHARDWARE_MAX_PINS ; pindex++) {
if (pSerialPinConfig->ioTagRx[device] && (pSerialPinConfig->ioTagRx[device] == hardware->rxPins[pindex].pin)) {
uartdev->rx = hardware->rxPins[pindex];
uartdev->rxPin = hardware->rxPins[pindex];
}

if (pSerialPinConfig->ioTagTx[device] && (pSerialPinConfig->ioTagTx[device] == hardware->txPins[pindex].pin)) {
uartdev->tx = hardware->txPins[pindex];
uartdev->txPin = hardware->txPins[pindex];
}


#if !defined(STM32F4)
#ifdef USE_SERIAL_PINSWAP
// Check for swapped pins
if (pSerialPinConfig->ioTagTx[device] && (pSerialPinConfig->ioTagTx[device] == hardware->rxPins[pindex].pin)) {
uartdev->tx = hardware->rxPins[pindex];
uartdev->rxPin = hardware->rxPins[pindex];
uartdev->pinSwap = true;
}

if (pSerialPinConfig->ioTagRx[device] && (pSerialPinConfig->ioTagRx[device] == hardware->txPins[pindex].pin)) {
uartdev->rx = hardware->txPins[pindex];
uartdev->txPin = hardware->txPins[pindex];
uartdev->pinSwap = true;
}
#endif
}

if (uartdev->rx.pin || uartdev->tx.pin) {
if (uartdev->rxPin.pin || uartdev->txPin.pin) {
uartdev->hardware = hardware;
uartDevmap[device] = uartdev++;
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/drivers/serial_uart_stdperiph.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ static void usartConfigurePinInversion(uartPort_t *uartPort) {
#endif
}

void uartSelectPins(UARTDevice_e device, portOptions_e options)
{
UNUSED(options);

uartDevice_t *uartDevice = uartDevmap[device];

if (uartDevice) {
uartDevice->rx = uartDevice->rxPin;
uartDevice->tx = uartDevice->txPin;
}
}

void uartReconfigure(uartPort_t *uartPort)
{
USART_InitTypeDef USART_InitStructure;
Expand Down
8 changes: 5 additions & 3 deletions src/main/io/vtx_smartaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,15 +700,17 @@ bool vtxSmartAudioInit(void)
dprintf(("smartAudioInit: OK\r\n"));
#endif

// Note, for SA, which uses bidirectional mode, would normally require pullups.
// Note, for SA, which uses bidirectional mode, would normally require pullups.
// the SA protocol instead requires pulldowns, and therefore uses SERIAL_BIDIR_PP_PD instead of SERIAL_BIDIR_PP
const serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_VTX_SMARTAUDIO);
if (portConfig) {
portOptions_e portOptions = SERIAL_STOPBITS_2 | SERIAL_BIDIR_NOPULL;
#if defined(USE_VTX_COMMON)
portOptions = portOptions | (vtxConfig()->halfDuplex ? SERIAL_BIDIR | SERIAL_BIDIR_PP_PD : SERIAL_UNIDIR);
portOptions |=
(vtxConfig()->halfDuplex ? SERIAL_BIDIR | SERIAL_BIDIR_PP_PD : SERIAL_UNIDIR) |
(vtxConfig()->pinSwap ? SERIAL_PINSWAP : SERIAL_NOSWAP);
#else
portOptions = SERIAL_BIDIR;
portOptions |= SERIAL_BIDIR;
#endif

smartAudioSerialPort = openSerialPort(portConfig->identifier, FUNCTION_VTX_SMARTAUDIO, NULL, NULL, 4800, MODE_RXTX, portOptions);
Expand Down
6 changes: 4 additions & 2 deletions src/main/io/vtx_tramp.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,11 @@ bool vtxTrampInit(void)
if (portConfig) {
portOptions_e portOptions = 0;
#if defined(USE_VTX_COMMON)
portOptions = portOptions | (vtxConfig()->halfDuplex ? SERIAL_BIDIR : SERIAL_UNIDIR);
portOptions |=
(vtxConfig()->halfDuplex ? SERIAL_BIDIR : SERIAL_UNIDIR) |
(vtxConfig()->pinSwap ? SERIAL_PINSWAP : SERIAL_NOSWAP);
#else
portOptions = SERIAL_BIDIR;
portOptions |= SERIAL_BIDIR;
#endif

trampSerialPort = openSerialPort(portConfig->identifier, FUNCTION_VTX_TRAMP, NULL, NULL, 9600, MODE_RXTX, portOptions);
Expand Down
17 changes: 17 additions & 0 deletions src/main/msp/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
sbufWriteU16(dst, escSensorConfig()->hw4_current_offset);
sbufWriteU8(dst, escSensorConfig()->hw4_current_gain);
sbufWriteU8(dst, escSensorConfig()->hw4_voltage_gain);
sbufWriteU8(dst, escSensorConfig()->pinSwap);
break;

case MSP_ESC_PARAMETERS:
Expand Down Expand Up @@ -1535,6 +1536,7 @@ static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst)
sbufWriteU32(dst, 0);
sbufWriteU8(dst, 0);
#endif
sbufWriteU8(dst, rxConfig()->pinSwap);
break;

case MSP_FAILSAFE_CONFIG:
Expand Down Expand Up @@ -1578,6 +1580,7 @@ static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst)
sbufWriteU8(dst, telemetryConfig()->telemetry_inverted);
sbufWriteU8(dst, telemetryConfig()->halfDuplex);
sbufWriteU32(dst, telemetryConfig()->enableSensors);
sbufWriteU8(dst, telemetryConfig()->pinSwap);
break;

case MSP_SERIAL_CONFIG:
Expand Down Expand Up @@ -2650,6 +2653,9 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
escSensorConfigMutable()->hw4_current_offset = sbufReadU16(src);
escSensorConfigMutable()->hw4_current_gain = sbufReadU8(src);
escSensorConfigMutable()->hw4_voltage_gain = sbufReadU8(src);
if (sbufBytesRemaining(src) >= 1) {
escSensorConfigMutable()->pinSwap = sbufReadU8(src);
}
break;

case MSP_SET_ESC_PARAMETERS:
Expand Down Expand Up @@ -3016,6 +3022,14 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
rxConfigMutable()->halfDuplex = sbufReadU8(src);
rxConfigMutable()->rx_pulse_min = sbufReadU16(src);
rxConfigMutable()->rx_pulse_max = sbufReadU16(src);
if (sbufBytesRemaining(src) >= 6) {
sbufReadU8(src);
sbufReadU32(src);
sbufReadU8(src);
}
if (sbufBytesRemaining(src) >= 1) {
rxConfigMutable()->pinSwap = sbufReadU8(src);
}
}
#ifdef USE_RX_SPI
if (sbufBytesRemaining(src) >= 6) {
Expand Down Expand Up @@ -3072,6 +3086,9 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
telemetryConfigMutable()->telemetry_inverted = sbufReadU8(src);
telemetryConfigMutable()->halfDuplex = sbufReadU8(src);
telemetryConfigMutable()->enableSensors = sbufReadU32(src);
if (sbufBytesRemaining(src) >= 1) {
telemetryConfigMutable()->pinSwap = sbufReadU8(src);
}
break;

case MSP_SET_SERIAL_CONFIG:
Expand Down
1 change: 1 addition & 0 deletions src/main/pg/esc_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ PG_REGISTER_WITH_RESET_TEMPLATE(escSensorConfig_t, escSensorConfig, PG_ESC_SENSO
PG_RESET_TEMPLATE(escSensorConfig_t, escSensorConfig,
.protocol = ESC_SENSOR_PROTO_NONE,
.halfDuplex = 0,
.pinSwap = 0,
.update_hz = ESC_SENSOR_TASK_FREQ_HZ,
.current_offset = 0,
.hw4_current_offset = 0,
Expand Down
Loading

0 comments on commit 240a40e

Please sign in to comment.