Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial cut on DJI HD FPV goggles support #5303

Merged
merged 6 commits into from Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions make/source.mk
Expand Up @@ -101,6 +101,7 @@ COMMON_SRC = \
io/beeper.c \
io/esc_serialshot.c \
io/frsky_osd.c \
io/osd_dji_hd.c \
io/lights.c \
io/piniobox.c \
io/pwmdriver_i2c.c \
Expand Down
6 changes: 6 additions & 0 deletions src/main/fc/fc_init.c
Expand Up @@ -108,6 +108,7 @@
#include "io/ledstrip.h"
#include "io/pwmdriver_i2c.h"
#include "io/osd.h"
#include "io/osd_dji_hd.h"
#include "io/rcdevice_cam.h"
#include "io/serial.h"
#include "io/displayport_msp.h"
Expand Down Expand Up @@ -265,6 +266,11 @@ void init(void)
// to run after the sensors have been detected.
mspSerialInit();

#if defined(USE_DJI_HD_OSD)
// DJI OSD uses a special flavour of MSP (subset of Betaflight 4.1.1 MSP) - process as part of serial task
djiOsdSerialInit();
#endif

#if defined(USE_LOG)
// LOG might use serial output, so we only can init it after serial port is ready
// From this point on we can use LOG_*() to produce real-time debugging information
Expand Down
6 changes: 6 additions & 0 deletions src/main/fc/fc_tasks.c
Expand Up @@ -61,6 +61,7 @@
#include "io/serial.h"
#include "io/rcdevice_cam.h"
#include "io/vtx.h"
#include "io/osd_dji_hd.h"

#include "msp/msp_serial.h"

Expand Down Expand Up @@ -97,6 +98,11 @@ void taskHandleSerial(timeUs_t currentTimeUs)

// Allow MSP processing even if in CLI mode
mspSerialProcess(ARMING_FLAG(ARMED) ? MSP_SKIP_NON_MSP_DATA : MSP_EVALUATE_NON_MSP_DATA, mspFcProcessCommand);

#if defined(USE_DJI_HD_OSD)
// DJI OSD uses a special flavour of MSP (subset of Betaflight 4.1.1 MSP) - process as part of serial task
djiOsdSerialProcess();
#endif
}

void taskUpdateBattery(timeUs_t currentTimeUs)
Expand Down
11 changes: 7 additions & 4 deletions src/main/fc/runtime_config.c
Expand Up @@ -102,18 +102,21 @@ uint32_t sensorsMask(void)

flightModeForTelemetry_e getFlightModeForTelemetry(void)
{
if (FLIGHT_MODE(MANUAL_MODE))
return FLM_MANUAL;

if (FLIGHT_MODE(FAILSAFE_MODE))
return FLM_FAILSAFE;

if (FLIGHT_MODE(MANUAL_MODE))
return FLM_MANUAL;

if (FLIGHT_MODE(NAV_RTH_MODE))
return FLM_RTH;

if (FLIGHT_MODE(NAV_POSHOLD_MODE))
return FLM_POSITION_HOLD;

if (FLIGHT_MODE(NAV_CRUISE_MODE))
return FLM_CRUISE;

if (FLIGHT_MODE(NAV_WP_MODE))
return FLM_MISSION;

Expand All @@ -129,5 +132,5 @@ flightModeForTelemetry_e getFlightModeForTelemetry(void)
if (FLIGHT_MODE(NAV_LAUNCH_MODE))
return FLM_LAUNCH;

return FLM_ACRO;
return STATE(AIRMODE_ACTIVE) ? FLM_ACRO_AIR : FLM_ACRO;
}
2 changes: 2 additions & 0 deletions src/main/fc/runtime_config.h
Expand Up @@ -134,12 +134,14 @@ extern uint32_t stateFlags;
typedef enum {
FLM_MANUAL,
FLM_ACRO,
FLM_ACRO_AIR,
FLM_ANGLE,
FLM_HORIZON,
FLM_ALTITUDE_HOLD,
FLM_POSITION_HOLD,
FLM_RTH,
FLM_MISSION,
FLM_CRUISE,
FLM_LAUNCH,
FLM_FAILSAFE,
FLM_COUNT
Expand Down
2 changes: 1 addition & 1 deletion src/main/fc/settings.yaml
Expand Up @@ -25,7 +25,7 @@ tables:
values: ["NONE", "PWM", "PPM", "SERIAL", "MSP", "SPI", "UIB"]
enum: rxReceiverType_e
- name: serial_rx
values: ["SPEK1024", "SPEK2048", "SBUS", "SUMD", "SUMH", "XB-B", "XB-B-RJ01", "IBUS", "JETIEXBUS", "CRSF", "FPORT"]
values: ["SPEK1024", "SPEK2048", "SBUS", "SUMD", "SUMH", "XB-B", "XB-B-RJ01", "IBUS", "JETIEXBUS", "CRSF", "FPORT", "SBUS_FAST"]
- name: rx_spi_protocol
values: ["V202_250K", "V202_1M", "SYMA_X", "SYMA_X5C", "CX10", "CX10A", "H8_3D", "INAV", "ELERES"]
enum: rx_spi_protocol_e
Expand Down