1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Fix vtx_freq default value when USE_VTX_TABLES is defined

When a `vtxDevice` was active (like if `USE_VTX_RTC6705` is defined for the target) then the initialization logic would try to look up the frequency based on the band/channel and update the `vtx_freq` setting. The problem is that initially the `vtxtable` is not defined so the frequency lookup fails and returns 0. This resulted in a defaults difference since the default value was 5740 which would have matched the default band and channel if the "standard" bands/channels were set up with `vtxtable`. So instead set the default value to 0 unless legacy built-in frequencies are used (`USE_VTX_TABLES` not defined).
This commit is contained in:
Bruce Luckcuck 2019-07-31 21:23:18 -04:00
parent 924c40a50d
commit f543daa8ba

View file

@ -47,16 +47,21 @@
#include "vtx.h"
PG_REGISTER_WITH_RESET_TEMPLATE(vtxSettingsConfig_t, vtxSettingsConfig, PG_VTX_SETTINGS_CONFIG, 0);
PG_REGISTER_WITH_RESET_FN(vtxSettingsConfig_t, vtxSettingsConfig, PG_VTX_SETTINGS_CONFIG, 0);
PG_RESET_TEMPLATE(vtxSettingsConfig_t, vtxSettingsConfig,
.band = VTX_TABLE_DEFAULT_BAND,
.channel = VTX_TABLE_DEFAULT_CHANNEL,
.power = VTX_TABLE_DEFAULT_POWER,
.freq = VTX_TABLE_DEFAULT_FREQ,
.pitModeFreq = VTX_TABLE_DEFAULT_PITMODE_FREQ,
.lowPowerDisarm = VTX_LOW_POWER_DISARM_OFF,
);
void pgResetFn_vtxSettingsConfig(vtxSettingsConfig_t *vtxSettingsConfig)
{
vtxSettingsConfig->band = VTX_TABLE_DEFAULT_BAND;
vtxSettingsConfig->channel = VTX_TABLE_DEFAULT_CHANNEL;
vtxSettingsConfig->power = VTX_TABLE_DEFAULT_POWER;
#ifdef USE_VTX_TABLE
vtxSettingsConfig->freq = 0;
#else
vtxSettingsConfig->freq = VTX_TABLE_DEFAULT_FREQ;
#endif
vtxSettingsConfig->pitModeFreq = VTX_TABLE_DEFAULT_PITMODE_FREQ;
vtxSettingsConfig->lowPowerDisarm = VTX_LOW_POWER_DISARM_OFF;
}
typedef enum {
VTX_PARAM_POWER = 0,