1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 15:25:36 +03:00

Further fix CMS displayPort registration

1. Avoid OSD over MSP_DISPLAYPORT case (not ready yet).
2. osdInit to take care NULL displayPortToUse.
This commit is contained in:
jflyper 2017-04-02 01:26:49 +09:00
parent d2fe67aa45
commit e186a2d709
2 changed files with 7 additions and 6 deletions

View file

@ -444,18 +444,16 @@ void init(void)
#if defined(USE_MAX7456) #if defined(USE_MAX7456)
// if there is a max7456 chip for the OSD then use it, otherwise use MSP // if there is a max7456 chip for the OSD then use it, otherwise use MSP
osdDisplayPort = max7456DisplayPortInit(vcdProfile()); osdDisplayPort = max7456DisplayPortInit(vcdProfile());
#elif defined(USE_MSP_DISPLAYPORT) #elif defined(USE_OSD_OVER_MSP_DISPLAYPORT) // OSD over MSP; not supported (yet)
osdDisplayPort = displayPortMspInit(); osdDisplayPort = displayPortMspInit();
#endif #endif
osdInit(osdDisplayPort); osdInit(osdDisplayPort);
} }
#endif #endif
#if defined(USE_MSP_DISPLAYPORT) && defined(CMS) #if defined(CMS) && defined(USE_MSP_DISPLAYPORT)
// If BFOSD is active, then register it as CMS device, else register MSP. // If BFOSD is not active, then register as register MSP_DISPLAYPORT.
if (osdDisplayPort) if (!osdDisplayPort)
cmsDisplayPortRegister(osdDisplayPort);
else
cmsDisplayPortRegister(displayPortMspInit()); cmsDisplayPortRegister(displayPortMspInit());
#endif #endif

View file

@ -582,6 +582,9 @@ static void osdDrawLogo(int x, int y)
void osdInit(displayPort_t *osdDisplayPortToUse) void osdInit(displayPort_t *osdDisplayPortToUse)
{ {
if (!osdDisplayPortToUse)
return;
BUILD_BUG_ON(OSD_POS_MAX != OSD_POS(31,31)); BUILD_BUG_ON(OSD_POS_MAX != OSD_POS(31,31));
osdDisplayPort = osdDisplayPortToUse; osdDisplayPort = osdDisplayPortToUse;