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