mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-27 02:05:31 +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)
|
bool cmsDisplayPortRegister(displayPort_t *pDisplay)
|
||||||
{
|
{
|
||||||
if (cmsDeviceCount >= CMS_MAX_DEVICE) {
|
if (!pDisplay || cmsDeviceCount >= CMS_MAX_DEVICE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,20 @@
|
||||||
#if defined(USE_CRSF_CMS_TELEMETRY)
|
#if defined(USE_CRSF_CMS_TELEMETRY)
|
||||||
|
|
||||||
#include "cms/cms.h"
|
#include "cms/cms.h"
|
||||||
|
|
||||||
#include "common/maths.h"
|
#include "common/maths.h"
|
||||||
#include "common/printf.h"
|
#include "common/printf.h"
|
||||||
#include "common/time.h"
|
#include "common/time.h"
|
||||||
|
|
||||||
|
#include "config/feature.h"
|
||||||
|
|
||||||
#include "drivers/display.h"
|
#include "drivers/display.h"
|
||||||
#include "drivers/time.h"
|
#include "drivers/time.h"
|
||||||
|
|
||||||
#include "io/displayport_crsf.h"
|
#include "io/displayport_crsf.h"
|
||||||
|
|
||||||
|
#include "rx/rx.h"
|
||||||
|
|
||||||
#define CRSF_DISPLAY_PORT_OPEN_DELAY_MS 400
|
#define CRSF_DISPLAY_PORT_OPEN_DELAY_MS 400
|
||||||
#define CRSF_DISPLAY_PORT_CLEAR_DELAY_MS 45
|
#define CRSF_DISPLAY_PORT_CLEAR_DELAY_MS 45
|
||||||
|
|
||||||
|
@ -198,9 +205,16 @@ bool crsfDisplayPortIsReady(void)
|
||||||
|
|
||||||
displayPort_t *displayPortCrsfInit()
|
displayPort_t *displayPortCrsfInit()
|
||||||
{
|
{
|
||||||
crsfDisplayPortSetDimensions(CRSF_DISPLAY_PORT_ROWS_MAX, CRSF_DISPLAY_PORT_COLS_MAX);
|
if (featureIsEnabled(FEATURE_TELEMETRY)
|
||||||
displayInit(&crsfDisplayPort, &crsfDisplayPortVTable);
|
&& featureIsEnabled(FEATURE_RX_SERIAL)
|
||||||
return &crsfDisplayPort;
|
&& (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
|
#endif
|
||||||
|
|
|
@ -25,10 +25,15 @@
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#if defined (USE_SPEKTRUM_CMS_TELEMETRY) && defined (USE_CMS) && defined(USE_TELEMETRY_SRXL)
|
#if defined (USE_SPEKTRUM_CMS_TELEMETRY) && defined (USE_CMS) && defined(USE_TELEMETRY_SRXL)
|
||||||
|
|
||||||
|
#include "cms/cms.h"
|
||||||
|
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
|
|
||||||
|
#include "config/feature.h"
|
||||||
|
|
||||||
#include "drivers/display.h"
|
#include "drivers/display.h"
|
||||||
#include "cms/cms.h"
|
|
||||||
|
#include "rx/rx.h"
|
||||||
|
|
||||||
#include "telemetry/srxl.h"
|
#include "telemetry/srxl.h"
|
||||||
|
|
||||||
|
@ -140,11 +145,18 @@ static const displayPortVTable_t srxlVTable = {
|
||||||
|
|
||||||
displayPort_t *displayPortSrxlInit()
|
displayPort_t *displayPortSrxlInit()
|
||||||
{
|
{
|
||||||
srxlDisplayPort.device = NULL;
|
if (featureIsEnabled(FEATURE_TELEMETRY)
|
||||||
displayInit(&srxlDisplayPort, &srxlVTable);
|
&& featureIsEnabled(FEATURE_RX_SERIAL)
|
||||||
srxlDisplayPort.rows = SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS;
|
&& ((rxConfig()->serialrx_provider == SERIALRX_SRXL) || (rxConfig()->serialrx_provider == SERIALRX_SRXL2))) {
|
||||||
srxlDisplayPort.cols = SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS;
|
|
||||||
return &srxlDisplayPort;
|
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
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue