diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index 4c01e64a18..4a73815d35 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -63,7 +63,6 @@ #include "io/gimbal.h" #include "io/gps.h" #include "io/ledstrip.h" -#include "io/serial.h" #include "io/vtx.h" #include "io/vtx_control.h" #include "io/vtx_rtc6705.h" @@ -482,10 +481,6 @@ static const char* const lookupTableDshotBitbangedTimer[] = { "AUTO", "TIM1", "TIM8" }; -static const char * const lookupTableOsdDisplayPortDevice[] = { - "NONE", "AUTO", "MAX7456", "MSP", -}; - #define LOOKUP_TABLE_ENTRY(name) { name, ARRAYLEN(name) } @@ -604,7 +599,6 @@ const lookupTableEntry_t lookupTables[] = { LOOKUP_TABLE_ENTRY(lookupTableOffOnAuto), LOOKUP_TABLE_ENTRY(lookupTableInterpolatedSetpoint), LOOKUP_TABLE_ENTRY(lookupTableDshotBitbangedTimer), - LOOKUP_TABLE_ENTRY(lookupTableOsdDisplayPortDevice), }; #undef LOOKUP_TABLE_ENTRY @@ -1359,7 +1353,6 @@ const clivalue_t valueTable[] = { { "osd_profile_3_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, OSD_PROFILE_NAME_LENGTH, STRING_FLAGS_NONE }, PG_OSD_CONFIG, offsetof(osdConfig_t, profile[2]) }, #endif { "osd_gps_sats_show_hdop", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_OSD_CONFIG, offsetof(osdConfig_t, gps_sats_show_hdop) }, - { "osd_displayport_device", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OSD_DISPLAYPORT_DEVICE }, PG_OSD_CONFIG, offsetof(osdConfig_t, displayPortDevice) }, #endif // PG_SYSTEM_CONFIG @@ -1417,7 +1410,6 @@ const clivalue_t valueTable[] = { #ifdef USE_MSP_DISPLAYPORT { "displayport_msp_col_adjust", VAR_INT8 | MASTER_VALUE, .config.minmax = { -6, 0 }, PG_DISPLAY_PORT_MSP_CONFIG, offsetof(displayPortProfile_t, colAdjust) }, { "displayport_msp_row_adjust", VAR_INT8 | MASTER_VALUE, .config.minmax = { -3, 0 }, PG_DISPLAY_PORT_MSP_CONFIG, offsetof(displayPortProfile_t, rowAdjust) }, - { "displayport_msp_serial", VAR_INT8 | MASTER_VALUE, .config.minmax = { SERIAL_PORT_NONE, SERIAL_PORT_IDENTIFIER_MAX }, PG_DISPLAY_PORT_MSP_CONFIG, offsetof(displayPortProfile_t, displayPortSerial) }, #endif // PG_DISPLAY_PORT_MSP_CONFIG diff --git a/src/main/cli/settings.h b/src/main/cli/settings.h index 562828ec02..31e47d6266 100644 --- a/src/main/cli/settings.h +++ b/src/main/cli/settings.h @@ -138,7 +138,6 @@ typedef enum { TABLE_OFF_ON_AUTO, TABLE_INTERPOLATED_SP, TABLE_DSHOT_BITBANGED_TIMER, - TABLE_OSD_DISPLAYPORT_DEVICE, LOOKUP_TABLE_COUNT } lookupTableIndex_e; diff --git a/src/main/drivers/display.h b/src/main/drivers/display.h index 86812578a5..79d428fe3b 100644 --- a/src/main/drivers/display.h +++ b/src/main/drivers/display.h @@ -60,7 +60,6 @@ typedef struct displayPortProfile_s { bool invert; uint8_t blackBrightness; uint8_t whiteBrightness; - int8_t displayPortSerial; // serialPortIdentifier_e } displayPortProfile_t; // Note: displayPortProfile_t used as a parameter group for CMS over CRSF (io/displayport_crsf) diff --git a/src/main/fc/init.c b/src/main/fc/init.c index 49917c23c7..0b407282db 100644 --- a/src/main/fc/init.c +++ b/src/main/fc/init.c @@ -799,38 +799,16 @@ void init(void) //The OSD need to be initialised after GYRO to avoid GYRO initialisation failure on some targets if (featureIsEnabled(FEATURE_OSD)) { - osdDisplayPortDevice_e device = osdConfig()->displayPortDevice; - - switch(device) { - - case OSD_DISPLAYPORT_DEVICE_AUTO: - FALLTHROUGH; - #if defined(USE_MAX7456) - case OSD_DISPLAYPORT_DEVICE_MAX7456: - // If there is a max7456 chip for the OSD configured and detectd then use it. - osdDisplayPort = max7456DisplayPortInit(vcdProfile()); - if (osdDisplayPort || device == OSD_DISPLAYPORT_DEVICE_MAX7456) { - break; - } - FALLTHROUGH; + // If there is a max7456 chip for the OSD configured and detectd then use it. + osdDisplayPort = max7456DisplayPortInit(vcdProfile()); #endif #if defined(USE_CMS) && defined(USE_MSP_DISPLAYPORT) && defined(USE_OSD_OVER_MSP_DISPLAYPORT) - case OSD_DISPLAYPORT_DEVICE_MSP: + if (!osdDisplayPort) { osdDisplayPort = displayPortMspInit(); - if (osdDisplayPort || device == OSD_DISPLAYPORT_DEVICE_MSP) { - break; - } - FALLTHROUGH; -#endif - - // Other device cases can be added here - - case OSD_DISPLAYPORT_DEVICE_NONE: - default: - break; } +#endif // osdInit will register with CMS by itself. osdInit(osdDisplayPort); diff --git a/src/main/io/serial.h b/src/main/io/serial.h index dff90a1970..eabd033171 100644 --- a/src/main/io/serial.h +++ b/src/main/io/serial.h @@ -88,8 +88,7 @@ typedef enum { SERIAL_PORT_USART8, SERIAL_PORT_USB_VCP = 20, SERIAL_PORT_SOFTSERIAL1 = 30, - SERIAL_PORT_SOFTSERIAL2, - SERIAL_PORT_IDENTIFIER_MAX = SERIAL_PORT_SOFTSERIAL2 + SERIAL_PORT_SOFTSERIAL2 } serialPortIdentifier_e; extern const serialPortIdentifier_e serialPortIdentifiers[SERIAL_PORT_COUNT]; diff --git a/src/main/msp/msp_serial.c b/src/main/msp/msp_serial.c index 5134d1fd57..ae38ea9177 100644 --- a/src/main/msp/msp_serial.c +++ b/src/main/msp/msp_serial.c @@ -35,7 +35,6 @@ #include "drivers/system.h" #include "io/serial.h" -#include "io/displayport_msp.h" #include "msp/msp.h" @@ -58,7 +57,6 @@ void mspSerialAllocatePorts(void) serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_MSP); while (portConfig && portIndex < MAX_MSP_PORT_COUNT) { mspPort_t *mspPort = &mspPorts[portIndex]; - if (mspPort->port) { portIndex++; continue; @@ -68,13 +66,6 @@ void mspSerialAllocatePorts(void) if (serialPort) { bool sharedWithTelemetry = isSerialPortShared(portConfig, FUNCTION_MSP, TELEMETRY_PORT_FUNCTIONS_MASK); resetMspPort(mspPort, serialPort, sharedWithTelemetry); - -#ifdef USE_MSP_DISPLAYPORT - if (serialPort->identifier == displayPortProfileMsp()->displayPortSerial) { - mspPort->isDisplayPort = true; - } -#endif - portIndex++; } @@ -571,8 +562,12 @@ int mspSerialPush(uint8_t cmd, uint8_t *data, int datalen, mspDirection_e direct for (int portIndex = 0; portIndex < MAX_MSP_PORT_COUNT; portIndex++) { mspPort_t * const mspPort = &mspPorts[portIndex]; + if (!mspPort->port) { + continue; + } - if (!mspPort->port || !mspPort->isDisplayPort) { + // XXX Kludge!!! Avoid zombie VCP port (avoid VCP entirely for now) + if (mspPort->port->identifier == SERIAL_PORT_USB_VCP) { continue; } diff --git a/src/main/msp/msp_serial.h b/src/main/msp/msp_serial.h index f1d27efbe8..010f489451 100644 --- a/src/main/msp/msp_serial.h +++ b/src/main/msp/msp_serial.h @@ -111,7 +111,6 @@ typedef struct mspPort_s { uint8_t checksum2; bool sharedWithTelemetry; mspDescriptor_t descriptor; - bool isDisplayPort; } mspPort_t; void mspSerialInit(void); diff --git a/src/main/osd/osd.h b/src/main/osd/osd.h index 26db7ca3d0..73d3e9355f 100644 --- a/src/main/osd/osd.h +++ b/src/main/osd/osd.h @@ -219,13 +219,6 @@ typedef enum { OSD_WARNING_COUNT // MUST BE LAST } osdWarningsFlags_e; -typedef enum { - OSD_DISPLAYPORT_DEVICE_NONE = 0, - OSD_DISPLAYPORT_DEVICE_AUTO, - OSD_DISPLAYPORT_DEVICE_MAX7456, - OSD_DISPLAYPORT_DEVICE_MSP, -} osdDisplayPortDevice_e; - // Make sure the number of warnings do not exceed the available 32bit storage STATIC_ASSERT(OSD_WARNING_COUNT <= 32, osdwarnings_overflow); @@ -258,7 +251,7 @@ typedef struct osdConfig_s { int16_t esc_rpm_alarm; int16_t esc_current_alarm; uint8_t core_temp_alarm; - uint8_t ahInvert; // invert the artificial horizon + uint8_t ahInvert; // invert the artificial horizon uint8_t osdProfileIndex; uint8_t overlay_radio_mode; char profile[OSD_PROFILE_COUNT][OSD_PROFILE_NAME_LENGTH + 1]; diff --git a/src/main/target/common_pre.h b/src/main/target/common_pre.h index 646a7c4629..0a898ab895 100644 --- a/src/main/target/common_pre.h +++ b/src/main/target/common_pre.h @@ -222,7 +222,6 @@ #define USE_CMS #define USE_MSP_DISPLAYPORT #define USE_MSP_OVER_TELEMETRY -#define USE_OSD_OVER_MSP_DISPLAYPORT #define USE_LED_STRIP #endif