mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 17:55:30 +03:00
Merge pull request #10448 from etracer65/fix_cms_displayport_register
Only register CMS displayPort for SRXL and CRSF when appropriate
This commit is contained in:
commit
3ea8c657c0
3 changed files with 36 additions and 10 deletions
|
@ -92,7 +92,7 @@ int menuChainBack;
|
|||
|
||||
bool cmsDisplayPortRegister(displayPort_t *pDisplay)
|
||||
{
|
||||
if (cmsDeviceCount >= CMS_MAX_DEVICE) {
|
||||
if (!pDisplay || cmsDeviceCount >= CMS_MAX_DEVICE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,20 @@
|
|||
#if defined(USE_CRSF_CMS_TELEMETRY)
|
||||
|
||||
#include "cms/cms.h"
|
||||
|
||||
#include "common/maths.h"
|
||||
#include "common/printf.h"
|
||||
#include "common/time.h"
|
||||
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "drivers/display.h"
|
||||
#include "drivers/time.h"
|
||||
|
||||
#include "io/displayport_crsf.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
|
||||
#define CRSF_DISPLAY_PORT_OPEN_DELAY_MS 400
|
||||
#define CRSF_DISPLAY_PORT_CLEAR_DELAY_MS 45
|
||||
|
||||
|
@ -198,9 +205,16 @@ bool crsfDisplayPortIsReady(void)
|
|||
|
||||
displayPort_t *displayPortCrsfInit()
|
||||
{
|
||||
if (featureIsEnabled(FEATURE_TELEMETRY)
|
||||
&& featureIsEnabled(FEATURE_RX_SERIAL)
|
||||
&& (rxConfig()->serialrx_provider == SERIALRX_CRSF)) {
|
||||
|
||||
crsfDisplayPortSetDimensions(CRSF_DISPLAY_PORT_ROWS_MAX, CRSF_DISPLAY_PORT_COLS_MAX);
|
||||
displayInit(&crsfDisplayPort, &crsfDisplayPortVTable);
|
||||
return &crsfDisplayPort;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,10 +25,15 @@
|
|||
#include "platform.h"
|
||||
#if defined (USE_SPEKTRUM_CMS_TELEMETRY) && defined (USE_CMS) && defined(USE_TELEMETRY_SRXL)
|
||||
|
||||
#include "cms/cms.h"
|
||||
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "drivers/display.h"
|
||||
#include "cms/cms.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
|
||||
#include "telemetry/srxl.h"
|
||||
|
||||
|
@ -140,11 +145,18 @@ static const displayPortVTable_t srxlVTable = {
|
|||
|
||||
displayPort_t *displayPortSrxlInit()
|
||||
{
|
||||
if (featureIsEnabled(FEATURE_TELEMETRY)
|
||||
&& featureIsEnabled(FEATURE_RX_SERIAL)
|
||||
&& ((rxConfig()->serialrx_provider == SERIALRX_SRXL) || (rxConfig()->serialrx_provider == SERIALRX_SRXL2))) {
|
||||
|
||||
srxlDisplayPort.device = NULL;
|
||||
displayInit(&srxlDisplayPort, &srxlVTable);
|
||||
srxlDisplayPort.rows = SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS;
|
||||
srxlDisplayPort.cols = SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS;
|
||||
return &srxlDisplayPort;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue