mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 20:10:18 +03:00
Made the displayport initialisation consistent for all telemetry protocols.
This commit is contained in:
parent
28d3156e8b
commit
b53b2fe76c
10 changed files with 70 additions and 83 deletions
|
@ -101,11 +101,9 @@
|
|||
#include "io/asyncfatfs/asyncfatfs.h"
|
||||
#include "io/beeper.h"
|
||||
#include "io/dashboard.h"
|
||||
#include "io/displayport_crsf.h"
|
||||
#include "io/displayport_frsky_osd.h"
|
||||
#include "io/displayport_max7456.h"
|
||||
#include "io/displayport_msp.h"
|
||||
#include "io/displayport_srxl.h"
|
||||
#include "io/flashfs.h"
|
||||
#include "io/gimbal.h"
|
||||
#include "io/gps.h"
|
||||
|
@ -1011,15 +1009,6 @@ void init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_CMS) && defined(USE_SPEKTRUM_CMS_TELEMETRY) && defined(USE_TELEMETRY_SRXL)
|
||||
// Register the srxl Textgen telemetry sensor as a displayport device
|
||||
cmsDisplayPortRegister(displayPortSrxlInit());
|
||||
#endif
|
||||
|
||||
#if defined(USE_CMS) && defined(USE_CRSF_CMS_TELEMETRY)
|
||||
cmsDisplayPortRegister(displayPortCrsfInit());
|
||||
#endif
|
||||
|
||||
setArmingDisabled(ARMING_DISABLED_BOOT_GRACE_TIME);
|
||||
|
||||
#ifdef USE_MOTOR
|
||||
|
|
|
@ -31,14 +31,10 @@
|
|||
#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"
|
||||
#include "displayport_crsf.h"
|
||||
|
||||
#define CRSF_DISPLAY_PORT_OPEN_DELAY_MS 400
|
||||
#define CRSF_DISPLAY_PORT_CLEAR_DELAY_MS 45
|
||||
|
@ -203,18 +199,16 @@ bool crsfDisplayPortIsReady(void)
|
|||
return (bool)(delayExpired && cmsReady);
|
||||
}
|
||||
|
||||
displayPort_t *displayPortCrsfInit()
|
||||
static 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, DISPLAYPORT_DEVICE_TYPE_CRSF);
|
||||
|
||||
crsfDisplayPortSetDimensions(CRSF_DISPLAY_PORT_ROWS_MAX, CRSF_DISPLAY_PORT_COLS_MAX);
|
||||
displayInit(&crsfDisplayPort, &crsfDisplayPortVTable, DISPLAYPORT_DEVICE_TYPE_CRSF);
|
||||
return &crsfDisplayPort;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
return &crsfDisplayPort;
|
||||
}
|
||||
|
||||
void crsfDisplayportRegister(void)
|
||||
{
|
||||
cmsDisplayPortRegister(displayPortCrsfInit());
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,7 @@ typedef struct crsfDisplayPortScreen_s {
|
|||
bool reset;
|
||||
} crsfDisplayPortScreen_t;
|
||||
|
||||
displayPort_t *displayPortCrsfInit(void);
|
||||
void crsfDisplayportRegister(void);
|
||||
crsfDisplayPortScreen_t *crsfDisplayPortScreen(void);
|
||||
void crsfDisplayPortMenuOpen(void);
|
||||
void crsfDisplayPortMenuExit(void);
|
||||
|
|
|
@ -128,7 +128,7 @@ static const displayPortVTable_t hottVTable = {
|
|||
.layerCopy = NULL,
|
||||
};
|
||||
|
||||
displayPort_t *displayPortHottInit()
|
||||
static displayPort_t *displayPortHottInit()
|
||||
{
|
||||
hottDisplayPort.device = NULL;
|
||||
displayInit(&hottDisplayPort, &hottVTable, DISPLAYPORT_DEVICE_TYPE_HOTT);
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
#pragma once
|
||||
#include "drivers/display.h"
|
||||
|
||||
displayPort_t *displayPortHottInit();
|
||||
|
||||
extern displayPort_t hottDisplayPort;
|
||||
|
||||
void hottDisplayportRegister();
|
||||
void hottCmsOpen();
|
||||
void hottSetCmsKey(uint8_t hottKey, bool esc);
|
||||
|
|
|
@ -23,20 +23,19 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "platform.h"
|
||||
#if defined (USE_SPEKTRUM_CMS_TELEMETRY) && defined (USE_CMS) && defined(USE_TELEMETRY_SRXL)
|
||||
|
||||
#if defined(USE_SPEKTRUM_CMS_TELEMETRY)
|
||||
|
||||
#include "cms/cms.h"
|
||||
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "drivers/display.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
|
||||
#include "telemetry/srxl.h"
|
||||
|
||||
#include "displayport_srxl.h"
|
||||
|
||||
displayPort_t srxlDisplayPort;
|
||||
|
||||
static int srxlDrawScreen(displayPort_t *displayPort)
|
||||
|
@ -143,20 +142,18 @@ static const displayPortVTable_t srxlVTable = {
|
|||
.layerCopy = NULL,
|
||||
};
|
||||
|
||||
displayPort_t *displayPortSrxlInit()
|
||||
static 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, DISPLAYPORT_DEVICE_TYPE_SRXL);
|
||||
srxlDisplayPort.rows = SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS;
|
||||
srxlDisplayPort.cols = SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS;
|
||||
|
||||
srxlDisplayPort.device = NULL;
|
||||
displayInit(&srxlDisplayPort, &srxlVTable, DISPLAYPORT_DEVICE_TYPE_SRXL);
|
||||
srxlDisplayPort.rows = SPEKTRUM_SRXL_TEXTGEN_BUFFER_ROWS;
|
||||
srxlDisplayPort.cols = SPEKTRUM_SRXL_TEXTGEN_BUFFER_COLS;
|
||||
return &srxlDisplayPort;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
return &srxlDisplayPort;
|
||||
}
|
||||
|
||||
void srxlDisplayportRegister(void)
|
||||
{
|
||||
cmsDisplayPortRegister(displayPortSrxlInit());
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
displayPort_t *displayPortSrxlInit();
|
||||
|
||||
extern displayPort_t srxlDisplayPort;
|
||||
|
||||
void srxlDisplayportRegister(void);
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#endif
|
||||
|
||||
#if !defined(USE_TELEMETRY)
|
||||
#undef USE_CRSF_CMS_TELEMETRY
|
||||
#undef USE_TELEMETRY_CRSF
|
||||
#undef USE_TELEMETRY_GHST
|
||||
#undef USE_TELEMETRY_FRSKY_HUB
|
||||
|
@ -136,10 +135,13 @@
|
|||
#undef USE_SPEKTRUM_RSSI_PERCENT_CONVERSION
|
||||
#undef USE_SPEKTRUM_VTX_CONTROL
|
||||
#undef USE_SPEKTRUM_VTX_TELEMETRY
|
||||
#undef USE_SPEKTRUM_CMS_TELEMETRY
|
||||
#undef USE_TELEMETRY_SRXL
|
||||
#endif
|
||||
|
||||
#if !defined(USE_CMS) || !defined(USE_TELEMETRY_SRXL)
|
||||
#undef USE_SPEKTRUM_CMS_TELEMETRY
|
||||
#endif
|
||||
|
||||
#if defined(USE_SERIALRX_SBUS) || defined(USE_SERIALRX_FPORT)
|
||||
#define USE_SBUS_CHANNELS
|
||||
#endif
|
||||
|
|
|
@ -30,21 +30,19 @@
|
|||
#include "build/build_config.h"
|
||||
#include "build/version.h"
|
||||
|
||||
#include "config/feature.h"
|
||||
#include "pg/pg.h"
|
||||
#include "pg/pg_ids.h"
|
||||
#include "cms/cms.h"
|
||||
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "common/crc.h"
|
||||
#include "common/maths.h"
|
||||
#include "common/printf.h"
|
||||
#include "common/streambuf.h"
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "cms/cms.h"
|
||||
|
||||
#include "drivers/nvic.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
|
||||
|
@ -55,6 +53,9 @@
|
|||
#include "io/gps.h"
|
||||
#include "io/serial.h"
|
||||
|
||||
#include "pg/pg.h"
|
||||
#include "pg/pg_ids.h"
|
||||
|
||||
#include "rx/crsf.h"
|
||||
#include "rx/crsf_protocol.h"
|
||||
|
||||
|
@ -64,7 +65,7 @@
|
|||
#include "telemetry/telemetry.h"
|
||||
#include "telemetry/msp_shared.h"
|
||||
|
||||
#include "telemetry/crsf.h"
|
||||
#include "crsf.h"
|
||||
|
||||
|
||||
#define CRSF_CYCLETIME_US 100000 // 100ms, 10 Hz
|
||||
|
@ -525,7 +526,11 @@ void initCrsfTelemetry(void)
|
|||
}
|
||||
#endif
|
||||
crsfScheduleCount = (uint8_t)index;
|
||||
}
|
||||
|
||||
#if defined(USE_CRSF_CMS_TELEMETRY)
|
||||
crsfDisplayportRegister();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool checkCrsfTelemetryState(void)
|
||||
{
|
||||
|
|
|
@ -29,46 +29,44 @@
|
|||
#include "build/version.h"
|
||||
|
||||
#include "cms/cms.h"
|
||||
#include "io/displayport_srxl.h"
|
||||
|
||||
#include "common/crc.h"
|
||||
#include "common/streambuf.h"
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "io/gps.h"
|
||||
#include "io/serial.h"
|
||||
#include "drivers/dshot.h"
|
||||
#include "drivers/vtx_common.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/runtime_config.h"
|
||||
|
||||
#include "flight/imu.h"
|
||||
#include "flight/mixer.h"
|
||||
|
||||
#include "io/displayport_srxl.h"
|
||||
#include "io/gps.h"
|
||||
#include "io/serial.h"
|
||||
#include "io/vtx_smartaudio.h"
|
||||
#include "io/vtx_tramp.h"
|
||||
|
||||
#include "pg/rx.h"
|
||||
#include "pg/motor.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
#include "rx/spektrum.h"
|
||||
#include "rx/srxl2.h"
|
||||
#include "io/spektrum_vtx_control.h"
|
||||
#include "rx/srxl2.h"
|
||||
|
||||
#include "sensors/battery.h"
|
||||
#include "sensors/adcinternal.h"
|
||||
#include "sensors/battery.h"
|
||||
#include "sensors/esc_sensor.h"
|
||||
|
||||
#include "telemetry/telemetry.h"
|
||||
#include "telemetry/srxl.h"
|
||||
|
||||
#include "drivers/vtx_common.h"
|
||||
#include "drivers/dshot.h"
|
||||
|
||||
#include "io/vtx_tramp.h"
|
||||
#include "io/vtx_smartaudio.h"
|
||||
#include "srxl.h"
|
||||
|
||||
#define SRXL_ADDRESS_FIRST 0xA5
|
||||
#define SRXL_ADDRESS_SECOND 0x80
|
||||
|
@ -774,18 +772,24 @@ void initSrxlTelemetry(void)
|
|||
{
|
||||
// check if there is a serial port open for SRXL telemetry (ie opened by the SRXL RX)
|
||||
// and feature is enabled, if so, set SRXL telemetry enabled
|
||||
if (srxlRxIsActive()) {
|
||||
srxlTelemetryEnabled = true;
|
||||
srxl2 = false;
|
||||
if (srxlRxIsActive()) {
|
||||
srxlTelemetryEnabled = true;
|
||||
srxl2 = false;
|
||||
#if defined(USE_SERIALRX_SRXL2)
|
||||
} else if (srxl2RxIsActive()) {
|
||||
srxlTelemetryEnabled = true;
|
||||
srxl2 = true;
|
||||
} else if (srxl2RxIsActive()) {
|
||||
srxlTelemetryEnabled = true;
|
||||
srxl2 = true;
|
||||
#endif
|
||||
} else {
|
||||
srxlTelemetryEnabled = false;
|
||||
srxl2 = false;
|
||||
}
|
||||
|
||||
#if defined(USE_SPEKTRUM_CMS_TELEMETRY)
|
||||
if (srxlTelemetryEnabled) {
|
||||
srxlDisplayportRegister();
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
srxlTelemetryEnabled = false;
|
||||
srxl2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool checkSrxlTelemetryState(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue