1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 11:59:58 +03:00

Fixed reporting of configured / detected OSD device.

This commit is contained in:
mikeller 2020-05-17 03:56:20 +12:00
parent 6aeac3caa6
commit 98efe1a972
4 changed files with 29 additions and 29 deletions

View file

@ -4741,10 +4741,10 @@ static void cliStatus(const char *cmdName, char *cmdline)
#endif /* USE_SENSOR_NAMES */ #endif /* USE_SENSOR_NAMES */
#if defined(USE_OSD) #if defined(USE_OSD)
osdDisplayPortDevice_e displayPortDevice; osdDisplayPortDevice_e displayPortDeviceType;
osdGetDisplayPort(&displayPortDevice); osdGetDisplayPort(&displayPortDeviceType);
cliPrintLinef("OSD: %s", lookupTableOsdDisplayPortDevice[displayPortDevice]); cliPrintLinef("OSD: %s", lookupTableOsdDisplayPortDevice[displayPortDeviceType]);
#endif #endif
// Uptime and wall clock // Uptime and wall clock

View file

@ -1003,8 +1003,9 @@ void init(void)
#if defined(USE_CMS) && defined(USE_MSP_DISPLAYPORT) #if defined(USE_CMS) && defined(USE_MSP_DISPLAYPORT)
// If BFOSD is not active, then register MSP_DISPLAYPORT as a CMS device. // If BFOSD is not active, then register MSP_DISPLAYPORT as a CMS device.
if (!osdDisplayPort) if (!osdDisplayPort) {
cmsDisplayPortRegister(displayPortMspInit()); cmsDisplayPortRegister(displayPortMspInit());
}
#endif #endif
#ifdef USE_DASHBOARD #ifdef USE_DASHBOARD

View file

@ -886,27 +886,25 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
#if defined(USE_OSD) #if defined(USE_OSD)
osdFlags |= OSD_FLAGS_OSD_FEATURE; osdFlags |= OSD_FLAGS_OSD_FEATURE;
osdDisplayPortDevice_e device = OSD_DISPLAYPORT_DEVICE_NONE; osdDisplayPortDevice_e deviceType;
displayPort_t *osdDisplayPort = osdGetDisplayPort(&device); displayPort_t *osdDisplayPort = osdGetDisplayPort(&deviceType);
if (osdDisplayPort) { switch (deviceType) {
switch (device) { case OSD_DISPLAYPORT_DEVICE_MAX7456:
case OSD_DISPLAYPORT_DEVICE_NONE: osdFlags |= OSD_FLAGS_OSD_HARDWARE_MAX_7456;
case OSD_DISPLAYPORT_DEVICE_AUTO: if (osdDisplayPort && displayIsReady(osdDisplayPort)) {
break; osdFlags |= OSD_FLAGS_OSD_DEVICE_DETECTED;
case OSD_DISPLAYPORT_DEVICE_MAX7456:
osdFlags |= OSD_FLAGS_OSD_HARDWARE_MAX_7456;
break;
case OSD_DISPLAYPORT_DEVICE_MSP:
break;
case OSD_DISPLAYPORT_DEVICE_FRSKYOSD:
osdFlags |= OSD_FLAGS_OSD_HARDWARE_FRSKYOSD;
break;
} }
if (osdFlags | (OSD_FLAGS_OSD_HARDWARE_MAX_7456 | OSD_FLAGS_OSD_HARDWARE_FRSKYOSD)) {
if (displayIsReady(osdDisplayPort)) { break;
osdFlags |= OSD_FLAGS_OSD_DEVICE_DETECTED; case OSD_DISPLAYPORT_DEVICE_FRSKYOSD:
} osdFlags |= OSD_FLAGS_OSD_HARDWARE_FRSKYOSD;
if (osdDisplayPort && displayIsReady(osdDisplayPort)) {
osdFlags |= OSD_FLAGS_OSD_DEVICE_DETECTED;
} }
break;
default:
break;
} }
#endif #endif
sbufWriteU8(dst, osdFlags); sbufWriteU8(dst, osdFlags);

View file

@ -130,7 +130,7 @@ static uint8_t armState;
static uint8_t osdProfile = 1; static uint8_t osdProfile = 1;
#endif #endif
static displayPort_t *osdDisplayPort; static displayPort_t *osdDisplayPort;
static osdDisplayPortDevice_e osdDisplayPortDevice; static osdDisplayPortDevice_e osdDisplayPortDeviceType;
static bool osdIsReady; static bool osdIsReady;
static bool suppressStatsDisplay = false; static bool suppressStatsDisplay = false;
@ -415,14 +415,15 @@ static void osdCompleteInitialization(void)
osdIsReady = true; osdIsReady = true;
} }
void osdInit(displayPort_t *osdDisplayPortToUse, osdDisplayPortDevice_e displayPortDeviceToUse) void osdInit(displayPort_t *osdDisplayPortToUse, osdDisplayPortDevice_e displayPortDeviceType)
{ {
osdDisplayPortDeviceType = displayPortDeviceType;
if (!osdDisplayPortToUse) { if (!osdDisplayPortToUse) {
return; return;
} }
osdDisplayPort = osdDisplayPortToUse; osdDisplayPort = osdDisplayPortToUse;
osdDisplayPortDevice = displayPortDeviceToUse;
#ifdef USE_CMS #ifdef USE_CMS
cmsDisplayPortRegister(osdDisplayPort); cmsDisplayPortRegister(osdDisplayPort);
#endif #endif
@ -1078,10 +1079,10 @@ bool osdNeedsAccelerometer(void)
} }
#endif // USE_ACC #endif // USE_ACC
displayPort_t *osdGetDisplayPort(osdDisplayPortDevice_e *displayPortDevice) displayPort_t *osdGetDisplayPort(osdDisplayPortDevice_e *displayPortDeviceType)
{ {
if (displayPortDevice) { if (displayPortDeviceType) {
*displayPortDevice = osdDisplayPortDevice; *displayPortDeviceType = osdDisplayPortDeviceType;
} }
return osdDisplayPort; return osdDisplayPort;
} }