From b89022019773050989ba83a9ef6b0b26a221b40c Mon Sep 17 00:00:00 2001 From: Steve Evans Date: Wed, 18 Dec 2024 22:37:18 +0000 Subject: [PATCH] Don't handle non-MSP characters on VTX MSP port (#14091) * Don't handle non-MSP characters on VTX MSP port * Remove check for CLI active on VTX MSP port as it can no longer be enabled * Only include check for MSP display port if USE_MSP_DISPLAYPORT is defined --- src/main/io/displayport_msp.c | 10 ++++------ src/main/io/displayport_msp.h | 1 + src/main/msp/msp_serial.c | 8 +++++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/io/displayport_msp.c b/src/main/io/displayport_msp.c index 52dff222f4..3e7ea38890 100644 --- a/src/main/io/displayport_msp.c +++ b/src/main/io/displayport_msp.c @@ -51,12 +51,6 @@ static int output(displayPort_t *displayPort, uint8_t cmd, uint8_t *buf, int len { UNUSED(displayPort); -#ifdef USE_CLI - // FIXME There should be no dependency on the CLI but mspSerialPush doesn't check for cli mode, and can't because it also shouldn't have a dependency on the CLI. - if (cliMode) { - return 0; - } -#endif return mspSerialPush(displayPortSerial, cmd, buf, len, MSP_DIRECTION_REPLY, MSP_V1); } @@ -229,4 +223,8 @@ displayPort_t *displayPortMspInit(void) void displayPortMspSetSerial(serialPortIdentifier_e serialPort) { displayPortSerial = serialPort; } + +serialPortIdentifier_e displayPortMspGetSerial(void) { + return displayPortSerial; +} #endif // USE_MSP_DISPLAYPORT diff --git a/src/main/io/displayport_msp.h b/src/main/io/displayport_msp.h index 2d89616ad8..25f624bb08 100644 --- a/src/main/io/displayport_msp.h +++ b/src/main/io/displayport_msp.h @@ -46,4 +46,5 @@ typedef enum { struct displayPort_s *displayPortMspInit(void); void displayPortMspSetSerial(serialPortIdentifier_e serialPort); +serialPortIdentifier_e displayPortMspGetSerial(void); diff --git a/src/main/msp/msp_serial.c b/src/main/msp/msp_serial.c index 31f5ba07c4..00601c56b9 100644 --- a/src/main/msp/msp_serial.c +++ b/src/main/msp/msp_serial.c @@ -459,6 +459,7 @@ static void mspProcessPendingRequest(mspPort_t * mspPort) case MSP_PENDING_CLI: mspPort->pendingRequest = MSP_PENDING_NONE; mspPort->portState = PORT_CLI_ACTIVE; + cliEnter(mspPort->port, true); break; #endif @@ -537,7 +538,12 @@ void mspSerialProcess(mspEvaluateNonMspData_e evaluateNonMspData, mspProcessComm if (c == '$') { mspPort->portState = PORT_MSP_PACKET; mspPort->packetState = MSP_HEADER_START; - } else if (evaluateNonMspData == MSP_EVALUATE_NON_MSP_DATA) { + } else if ((evaluateNonMspData == MSP_EVALUATE_NON_MSP_DATA) +#ifdef USE_MSP_DISPLAYPORT + // Don't evaluate non-MSP commands on VTX MSP port + && (mspPort->port->identifier != displayPortMspGetSerial()) +#endif + ) { // evaluate the non-MSP data if (c == serialConfig()->reboot_character) { mspPort->pendingRequest = MSP_PENDING_BOOTLOADER_ROM;