1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 03:50:02 +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 */
#if defined(USE_OSD)
osdDisplayPortDevice_e displayPortDevice;
osdGetDisplayPort(&displayPortDevice);
osdDisplayPortDevice_e displayPortDeviceType;
osdGetDisplayPort(&displayPortDeviceType);
cliPrintLinef("OSD: %s", lookupTableOsdDisplayPortDevice[displayPortDevice]);
cliPrintLinef("OSD: %s", lookupTableOsdDisplayPortDevice[displayPortDeviceType]);
#endif
// Uptime and wall clock

View file

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

View file

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

View file

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