Skip to content

Commit

Permalink
Port new VTX API and settings from Betaflight
Browse files Browse the repository at this point in the history
- VTX with support for FC control are now totally managed from the
FC. The FC will store the VTX configuration and override any changes
made manually (e.g. with a button). Users can disable VTX control
to manage channels manually.
- OSD VTX item now shows the power level too.
- Added new parameters for VTX configuration: vtx_band, vtx_channel,
vtx_freq, vtx_halfduplex, vtx_low_power_disarm, vtx_pit_mode_freq
and vtx_power.
- Added support for automatically switching the VTX power when
arming (fixes #3112).

Note that there are a several changes from the BF code. We do support
an additional setting for the low power during disarm option and
the MSP messages contain more data to allow users to configure the
VTX channel/power from the configurator. Our MSP messages also work
when the VTX is offline (the settings are stored in the FC and applied
later once the VTX is powered up).

Thanks to Matek (http://www.mateksys.com) for providing an FCHUB-VTX
to test the Tramp protocol.

Thanks to AKK (http://www.mateksys.com) for providing an X2-ultimate
to test SmartAudio.
  • Loading branch information
fiam committed Jun 20, 2018
1 parent b665c48 commit c873dcf
Show file tree
Hide file tree
Showing 37 changed files with 1,419 additions and 591 deletions.
7 changes: 7 additions & 0 deletions docs/Cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,13 @@ Re-apply any new defaults as desired.
| model_preview_type | -1 | ID of mixer preset applied in a Configurator. **Do not modify manually**. Used only for backup/restore reasons. |
| tz_offset | 0 | Time zone offset from UTC, in minutes. This is applied to the GPS time for logging and time-stamping of Blackbox logs |
| tz_automatic_dst | OFF | Automatically add Daylight Saving Time to the GPS time when needed or simply ignore it. Includes presets for EU and the USA - if you live outside these areas it is suggested to manage DST manually via `tz_offset`. |
| vtx_band | 4 | Configure the VTX band. Set to zero to use `vtx_freq`. Bands: 1: A, 2: B, 3: E, 4: F, 5: Race. |
| vtx_channel | 1 | Channel to use within the configured `vtx_band`. Valid values are [1, 8]. |
| vtx_freq | 5740 | Set the VTX frequency using raw MHz. This parameter is ignored unless `vtx_band` is 0. |
| vtx_halfduplex | ON | Use half duplex UART to communicate with the VTX, using only a TX pin in the FC. |
| vtx_low_power_disarm | OFF | When the craft is disarmed, set the VTX to its lowest power. `ON` will set the power to its minimum value on startup, increase it to `vtx_power` when arming and change it back to its lowest setting after disarming. `UNTIL_FIRST_ARM` will start with minimum power, but once the craft is armed it will increase to `vtx_power` and it will never decrease until the craft is power cycled. |
| vtx_pit_mode_freq | Frequency to use (in MHz) when the VTX is in pit mode. |
| vtx_power | 1 | VTX RF power level to use. The exact number of mw depends on the VTX hardware. |

This Markdown table is made by MarkdwonTableMaker addon for google spreadsheet.
Original Spreadsheet used to make this table can be found here https://docs.google.com/spreadsheets/d/1ubjYdMGmZ2aAMUNYkdfe3hhIF7wRfIjcuPOi_ysmp00/edit?usp=sharing
1 change: 1 addition & 0 deletions make/source.mk
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ COMMON_SRC = \
telemetry/msp_shared.c \
telemetry/smartport.c \
telemetry/telemetry.c \
io/vtx.c \
io/vtx_string.c \
io/vtx_smartaudio.c \
io/vtx_tramp.c \
Expand Down
1 change: 1 addition & 0 deletions src/main/build/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ typedef enum {
DEBUG_VIBE,
DEBUG_CRUISE,
DEBUG_REM_FLIGHT_TIME,
DEBUG_SMARTAUDIO,
DEBUG_COUNT
} debugType_e;

Expand Down
6 changes: 3 additions & 3 deletions src/main/cms/cms_menu_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ static const OSD_Entry menuFeaturesEntries[] =
#if defined(VTX) || defined(USE_RTC6705)
OSD_SUBMENU_ENTRY("VTX", &cmsx_menuVtx),
#endif // VTX || USE_RTC6705
#if defined(VTX_CONTROL)
#if defined(VTX_SMARTAUDIO)
#if defined(USE_VTX_CONTROL)
#if defined(USE_VTX_SMARTAUDIO)
OSD_SUBMENU_ENTRY("VTX SA", &cmsx_menuVtxSmartAudio),
#endif
#if defined(VTX_TRAMP)
#if defined(USE_VTX_TRAMP)
OSD_SUBMENU_ENTRY("VTX TR", &cmsx_menuVtxTramp),
#endif
#endif // VTX_CONTROL
Expand Down
4 changes: 2 additions & 2 deletions src/main/cms/cms_menu_osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static const OSD_Entry menuOsdElemsEntries[] =
OSD_ELEMENT_ENTRY("THR. (MANU)", OSD_THROTTLE_POS),
OSD_ELEMENT_ENTRY("THR. (MANU/AUTO)", OSD_THROTTLE_POS_AUTO_THR),
OSD_ELEMENT_ENTRY("SYS MESSAGES", OSD_MESSAGES),
#ifdef VTX_COMMON
#ifdef USE_VTX_COMMON
OSD_ELEMENT_ENTRY("VTX CHAN", OSD_VTX_CHANNEL),
#endif // VTX
OSD_ELEMENT_ENTRY("CURRENT (A)", OSD_CURRENT_DRAW),
Expand Down Expand Up @@ -215,7 +215,7 @@ static const OSD_Entry menuOsdElemsEntries[] =
OSD_END_ENTRY,
};

#if defined(VTX_COMMON) && defined(USE_GPS) && defined(USE_BARO) && defined(USE_PITOT)
#if defined(USE_VTX_COMMON) && defined(USE_GPS) && defined(USE_BARO) && defined(USE_PITOT)
// All CMS OSD elements should be enabled in this case. The menu has 3 extra
// elements (label, back and end), but there's an OSD element that we intentionally
// don't show here (OSD_DEBUG).
Expand Down
Loading

0 comments on commit c873dcf

Please sign in to comment.