1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 06:45:16 +03:00

SPRACINGF3NEO - Use RTC6705 clk hack.

CF/BF - Fix typo in max7456DmaInProgress.  Always define an
implementation even when there is no TX-DMA.

CF/BF - Ensure that max7456 communication does not disrupt RTC6705
communication when using the same SPI port for both.

CF/BF - Port RTC6705 to use the VTX API.

* Support VTX channel/band/power on OSD for ALL vtx APIs - previously it only supported RTC6705.
* Remove all FEATURE_VTX usage.
* Remove all `#define VTX` usage.

Note that due to the async nature of tramp/smartaudio it's not possible
to know the current band/channel after requesting a change (as the
request hasn't been processed) so it makes no sense to try and save the
config - and on the tramp/smartaudio vtx the vtx maintains it's state.
So on an RTX6705 equipped FC the user should now MANUALLY save the
config using the save config stick position.

CF/BF - Move CMS for RTC6705 into vtx_rtc6705.c for consistency with
other VTX CMS menus.

CF/BF - Update RTC6705 via SOFT SPI to use VTX API.

* Achieved by simply aligning the API at the driver level and removing
all legacy conditional compilation checks.

CF/BF - Use new IO for RTC6705 CLK Hack

CF/BF - Port VTX button from CF v1.x.

Features:
* Channel Cycle
* Band Cycle
* Power Cycle
* Save Settings
* Works with any VTX using VTX API.

CF/BF - Allow support for Internal and External VTX - External takes
precedence when configured.

CF/BF - Fix display of VTX power in CMS.

* Issue occured when CMS was transitioned from integer to list of
strings.

CF/BF - Disable SMARTAUDIO and TRAMP on the SPRacingF3NEO due to flash
size.

CF/BF - Cleanup const usage of bass-by-value parameters.  Cleanup
naming.

CF/BF - Cleanup naming.  Removing noise-words. Improving consistency.

CF/BF - Improve readability by further naming cleanups.

CF/BF - Remove some magic numbers in the RTC6705 VTX code.

CF/BF - Use braces on some procedural macros.

CF/BF - Improve code readability by renaming rtc6705SetChannel to
rtc6705SetBandAndChannel.

CF/BF - Remove editor mishap.

CF/BF - Make the rtc6705Dev variable static.

CF/BF - remove duplicate state variablertc6705Dev_t - vtxDevice_t had
all we needed.  Use brackets on some procedural style macros.  Make all
the vtx vtable static const.

CF/BF - making some declarations const.

CF/BF - Fix vtx_power maximum value (out by one).
This commit is contained in:
Hydra 2016-12-28 18:58:44 +00:00 committed by Michael Keller
parent aae589cab8
commit 723831b579
47 changed files with 1084 additions and 655 deletions

View file

@ -100,7 +100,8 @@ extern uint8_t __config_end;
#include "io/ledstrip.h"
#include "io/osd.h"
#include "io/serial.h"
#include "io/vtx.h"
#include "io/vtx_rtc6705.h"
#include "io/vtx_control.h"
#include "rx/rx.h"
#include "rx/spektrum.h"
@ -864,15 +865,10 @@ static const clivalue_t valueTable[] = {
{ "debug_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_DEBUG }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, debug_mode) },
// PG_VTX_CONFIG
#ifdef VTX
{ "vtx_band", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 1, 5 }, PG_VTX_CONFIG, offsetof(vtxConfig_t, vtx_band) },
{ "vtx_channel", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 1, 8 }, PG_VTX_CONFIG, offsetof(vtxConfig_t, vtx_channel) },
{ "vtx_mode", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 2 }, PG_VTX_CONFIG, offsetof(vtxConfig_t, vtx_mode) },
{ "vtx_mhz", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 5600, 5950 }, PG_VTX_CONFIG, offsetof(vtxConfig_t, vtx_mhz) },
#endif
#if defined(USE_RTC6705)
{ "vtx_channel", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 39 }, PG_VTX_CONFIG, offsetof(vtxConfig_t, vtx_channel) },
{ "vtx_power", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 1 }, PG_VTX_CONFIG, offsetof(vtxConfig_t, vtx_power) },
#ifdef VTX_RTC6705
{ "vtx_band", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 1, 5 }, PG_VTX_RTC6705_CONFIG, offsetof(vtxRTC6705Config_t, band) },
{ "vtx_channel", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 1, 8 }, PG_VTX_RTC6705_CONFIG, offsetof(vtxRTC6705Config_t, channel) },
{ "vtx_power", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, RTC6705_POWER_COUNT - 1 }, PG_VTX_RTC6705_CONFIG, offsetof(vtxRTC6705Config_t, power) },
#endif
// PG_VCD_CONFIG
@ -965,7 +961,10 @@ static systemConfig_t systemConfigCopy;
static beeperDevConfig_t beeperDevConfigCopy;
static beeperConfig_t beeperConfigCopy;
#endif
#if defined(USE_RTC6705) || defined(VTX)
#ifdef VTX_RTC6705
static vtxRTC6705Config_t vtxRTC6705ConfigCopy;
#endif
#ifdef VTX_CONTROL
static vtxConfig_t vtxConfigCopy;
#endif
#ifdef USE_MAX7456
@ -1336,7 +1335,13 @@ static const cliCurrentAndDefaultConfig_t *getCurrentAndDefaultConfigs(pgn_t pgn
ret.defaultConfig = beeperDevConfig();
break;
#endif
#ifdef VTX
#ifdef VTX_RTC6705
case PG_VTX_RTC6705_CONFIG:
ret.currentConfig = &vtxRTC6705ConfigCopy;
ret.defaultConfig = vtxRTC6705Config();
break;
#endif
#ifdef VTX_CONTROL
case PG_VTX_CONFIG:
ret.currentConfig = &vtxConfigCopy;
ret.defaultConfig = vtxConfig();
@ -2810,7 +2815,7 @@ static void cliFlashRead(char *cmdline)
#endif
#endif
#if defined(USE_RTC6705) || defined(VTX)
#ifdef VTX_CONTROL
static void printVtx(uint8_t dumpMask, const vtxConfig_t *vtxConfig, const vtxConfig_t *vtxConfigDefault)
{
// print out vtx channel settings
@ -2845,7 +2850,12 @@ static void printVtx(uint8_t dumpMask, const vtxConfig_t *vtxConfig, const vtxCo
}
}
#ifdef VTX
// FIXME remove these and use the VTX API
#define VTX_BAND_MIN 1
#define VTX_BAND_MAX 5
#define VTX_CHANNEL_MIN 1
#define VTX_CHANNEL_MAX 8
static void cliVtx(char *cmdline)
{
int i, val = 0;
@ -2870,6 +2880,7 @@ static void cliVtx(char *cmdline)
ptr = nextArg(ptr);
if (ptr) {
val = atoi(ptr);
// FIXME Use VTX API to get min/max
if (val >= VTX_BAND_MIN && val <= VTX_BAND_MAX) {
cac->band = val;
validArgumentCount++;
@ -2878,6 +2889,7 @@ static void cliVtx(char *cmdline)
ptr = nextArg(ptr);
if (ptr) {
val = atoi(ptr);
// FIXME Use VTX API to get min/max
if (val >= VTX_CHANNEL_MIN && val <= VTX_CHANNEL_MAX) {
cac->channel = val;
validArgumentCount++;
@ -2893,8 +2905,8 @@ static void cliVtx(char *cmdline)
}
}
}
#endif // VTX
#endif
#endif // VTX_CONTROL
static void printName(uint8_t dumpMask, const systemConfig_t *systemConfig)
{
@ -4140,7 +4152,7 @@ static void printConfig(char *cmdline, bool doDiff)
cliPrintHashLine("rxrange");
printRxRange(dumpMask, rxChannelRangeConfigsCopy, rxChannelRangeConfigs(0));
#if defined(USE_RTC6705) || defined(VTX)
#ifdef VTX_CONTROL
cliPrintHashLine("vtx");
printVtx(dumpMask, &vtxConfigCopy, vtxConfig());
#endif
@ -4311,7 +4323,7 @@ const clicmd_t cmdTable[] = {
CLI_COMMAND_DEF("tasks", "show task stats", NULL, cliTasks),
#endif
CLI_COMMAND_DEF("version", "show version", NULL, cliVersion),
#ifdef VTX
#ifdef VTX_CONTROL
CLI_COMMAND_DEF("vtx", "vtx channels on switch", NULL, cliVtx),
#endif
};