mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Merge pull request #4404 from mikeller/fix_vtx_rtc6705_no_power_pin
Fixed power configuration for RTC6705 based VTX with no power pin.
This commit is contained in:
commit
42f1bfef0f
5 changed files with 13 additions and 15 deletions
|
@ -48,18 +48,18 @@ static const char * const rtc6705BandNames[] = {
|
||||||
|
|
||||||
static OSD_TAB_t entryVtxBand = {&cmsx_vtxBand, ARRAYLEN(rtc6705BandNames) - 1, &rtc6705BandNames[0]};
|
static OSD_TAB_t entryVtxBand = {&cmsx_vtxBand, ARRAYLEN(rtc6705BandNames) - 1, &rtc6705BandNames[0]};
|
||||||
static OSD_UINT8_t entryVtxChannel = {&cmsx_vtxChannel, 1, VTX_RTC6705_CHANNEL_COUNT, 1};
|
static OSD_UINT8_t entryVtxChannel = {&cmsx_vtxChannel, 1, VTX_RTC6705_CHANNEL_COUNT, 1};
|
||||||
static OSD_TAB_t entryVtxPower = {&cmsx_vtxPower, VTX_RTC6705_POWER_COUNT - 1, &rtc6705PowerNames[0]};
|
static OSD_TAB_t entryVtxPower = {&cmsx_vtxPower, VTX_RTC6705_POWER_COUNT - 1 - VTX_RTC6705_MIN_POWER, &rtc6705PowerNames[VTX_RTC6705_MIN_POWER]};
|
||||||
|
|
||||||
static void cmsx_Vtx_ConfigRead(void)
|
static void cmsx_Vtx_ConfigRead(void)
|
||||||
{
|
{
|
||||||
cmsx_vtxBand = vtxSettingsConfig()->band - 1;
|
cmsx_vtxBand = vtxSettingsConfig()->band - 1;
|
||||||
cmsx_vtxChannel = vtxSettingsConfig()->channel;
|
cmsx_vtxChannel = vtxSettingsConfig()->channel;
|
||||||
cmsx_vtxPower = vtxSettingsConfig()->power;
|
cmsx_vtxPower = vtxSettingsConfig()->power - VTX_RTC6705_MIN_POWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmsx_Vtx_ConfigWriteback(void)
|
static void cmsx_Vtx_ConfigWriteback(void)
|
||||||
{
|
{
|
||||||
vtxSettingsSaveBandChanAndPower(cmsx_vtxBand + 1, cmsx_vtxChannel, cmsx_vtxPower);
|
vtxSettingsSaveBandChanAndPower(cmsx_vtxBand + 1, cmsx_vtxChannel, cmsx_vtxPower + VTX_RTC6705_MIN_POWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long cmsx_Vtx_onEnter(void)
|
static long cmsx_Vtx_onEnter(void)
|
||||||
|
|
|
@ -746,7 +746,7 @@ const clivalue_t valueTable[] = {
|
||||||
#ifdef VTX_SETTINGS_CONFIG
|
#ifdef VTX_SETTINGS_CONFIG
|
||||||
{ "vtx_band", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, VTX_SETTINGS_MAX_BAND }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, band) },
|
{ "vtx_band", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, VTX_SETTINGS_MAX_BAND }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, band) },
|
||||||
{ "vtx_channel", VAR_UINT8 | MASTER_VALUE, .config.minmax = { VTX_SETTINGS_MIN_CHANNEL, VTX_SETTINGS_MAX_CHANNEL }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, channel) },
|
{ "vtx_channel", VAR_UINT8 | MASTER_VALUE, .config.minmax = { VTX_SETTINGS_MIN_CHANNEL, VTX_SETTINGS_MAX_CHANNEL }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, channel) },
|
||||||
{ "vtx_power", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, VTX_SETTINGS_POWER_COUNT }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, power) },
|
{ "vtx_power", VAR_UINT8 | MASTER_VALUE, .config.minmax = { VTX_SETTINGS_MIN_POWER, VTX_SETTINGS_POWER_COUNT }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, power) },
|
||||||
#ifdef VTX_SETTINGS_FREQCMD
|
#ifdef VTX_SETTINGS_FREQCMD
|
||||||
{ "vtx_freq", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, VTX_SETTINGS_MAX_FREQUENCY_MHZ }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, freq) },
|
{ "vtx_freq", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, VTX_SETTINGS_MAX_FREQUENCY_MHZ }, PG_VTX_SETTINGS_CONFIG, offsetof(vtxSettingsConfig_t, freq) },
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "cms/cms.h"
|
#include "cms/cms.h"
|
||||||
#include "cms/cms_types.h"
|
#include "cms/cms_types.h"
|
||||||
|
|
||||||
|
#include "common/maths.h"
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
|
|
||||||
#include "config/parameter_group.h"
|
#include "config/parameter_group.h"
|
||||||
|
@ -52,15 +53,9 @@ bool canUpdateVTX(void);
|
||||||
#define WAIT_FOR_VTX while (!canUpdateVTX()) {}
|
#define WAIT_FOR_VTX while (!canUpdateVTX()) {}
|
||||||
|
|
||||||
#if defined(CMS) || defined(VTX_COMMON)
|
#if defined(CMS) || defined(VTX_COMMON)
|
||||||
#ifdef RTC6705_POWER_PIN
|
|
||||||
const char * const rtc6705PowerNames[VTX_RTC6705_POWER_COUNT] = {
|
const char * const rtc6705PowerNames[VTX_RTC6705_POWER_COUNT] = {
|
||||||
"---", "25 ", "200",
|
"---", "25 ", "200",
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
const char * const rtc6705PowerNames[VTX_RTC6705_POWER_COUNT] = {
|
|
||||||
"25 ", "200",
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VTX_COMMON
|
#ifdef VTX_COMMON
|
||||||
|
@ -110,7 +105,7 @@ void vtxRTC6705Process(uint32_t now)
|
||||||
if (!configured) {
|
if (!configured) {
|
||||||
vtxRTC6705.band = vtxSettingsConfig()->band;
|
vtxRTC6705.band = vtxSettingsConfig()->band;
|
||||||
vtxRTC6705.channel = vtxSettingsConfig()->channel;
|
vtxRTC6705.channel = vtxSettingsConfig()->channel;
|
||||||
vtxRTC6705.powerIndex = vtxSettingsConfig()->power;
|
vtxRTC6705.powerIndex = MAX(vtxSettingsConfig()->power, VTX_RTC6705_MIN_POWER);
|
||||||
|
|
||||||
#ifdef RTC6705_POWER_PIN
|
#ifdef RTC6705_POWER_PIN
|
||||||
if (vtxRTC6705.powerIndex > 0) {
|
if (vtxRTC6705.powerIndex > 0) {
|
||||||
|
@ -186,7 +181,7 @@ void vtxRTC6705SetPowerByIndex(uint8_t index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
vtxRTC6705.powerIndex = index;
|
vtxRTC6705.powerIndex = MAX(index, VTX_RTC6705_MIN_POWER);
|
||||||
rtc6705SetRFPower(index);
|
rtc6705SetRFPower(index);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,13 @@
|
||||||
#define VTX_RTC6705_BAND_COUNT (VTX_RTC6705_MAX_BAND - VTX_RTC6705_MIN_BAND + 1)
|
#define VTX_RTC6705_BAND_COUNT (VTX_RTC6705_MAX_BAND - VTX_RTC6705_MIN_BAND + 1)
|
||||||
#define VTX_RTC6705_CHANNEL_COUNT (VTX_RTC6705_MAX_CHANNEL - VTX_RTC6705_MIN_CHANNEL + 1)
|
#define VTX_RTC6705_CHANNEL_COUNT (VTX_RTC6705_MAX_CHANNEL - VTX_RTC6705_MIN_CHANNEL + 1)
|
||||||
|
|
||||||
#ifdef RTC6705_POWER_PIN
|
|
||||||
#define VTX_RTC6705_POWER_COUNT 3
|
#define VTX_RTC6705_POWER_COUNT 3
|
||||||
#define VTX_RTC6705_DEFAULT_POWER 1
|
#define VTX_RTC6705_DEFAULT_POWER 1
|
||||||
|
|
||||||
|
#if defined(RTC6705_POWER_PIN)
|
||||||
|
#define VTX_RTC6705_MIN_POWER 0
|
||||||
#else
|
#else
|
||||||
#define VTX_RTC6705_POWER_COUNT 2
|
#define VTX_RTC6705_MIN_POWER 1
|
||||||
#define VTX_RTC6705_DEFAULT_POWER 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const char * const rtc6705PowerNames[VTX_RTC6705_POWER_COUNT];
|
extern const char * const rtc6705PowerNames[VTX_RTC6705_POWER_COUNT];
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#define VTX_SETTINGS_POWER_COUNT 5
|
#define VTX_SETTINGS_POWER_COUNT 5
|
||||||
#define VTX_SETTINGS_DEFAULT_POWER 1
|
#define VTX_SETTINGS_DEFAULT_POWER 1
|
||||||
|
#define VTX_SETTINGS_MIN_POWER 0
|
||||||
#define VTX_SETTINGS_CONFIG
|
#define VTX_SETTINGS_CONFIG
|
||||||
#define VTX_SETTINGS_FREQCMD
|
#define VTX_SETTINGS_FREQCMD
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
|
|
||||||
#define VTX_SETTINGS_POWER_COUNT VTX_RTC6705_POWER_COUNT
|
#define VTX_SETTINGS_POWER_COUNT VTX_RTC6705_POWER_COUNT
|
||||||
#define VTX_SETTINGS_DEFAULT_POWER VTX_RTC6705_DEFAULT_POWER
|
#define VTX_SETTINGS_DEFAULT_POWER VTX_RTC6705_DEFAULT_POWER
|
||||||
|
#define VTX_SETTINGS_MIN_POWER VTX_RTC6705_MIN_POWER
|
||||||
#define VTX_SETTINGS_CONFIG
|
#define VTX_SETTINGS_CONFIG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue