mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
Fix VTX ready status (#3538)
* Fix VTX ready status * i18n is case-sensitive * Cannot replicate * Remove initial status
This commit is contained in:
parent
92a8748621
commit
26e78ed97a
2 changed files with 15 additions and 26 deletions
|
@ -27,39 +27,30 @@ const vtx = {
|
||||||
analyticsChanges: {},
|
analyticsChanges: {},
|
||||||
updating: true,
|
updating: true,
|
||||||
env: new djv(),
|
env: new djv(),
|
||||||
get _DEVICE_STATUS_UPDATE_INTERVAL_NAME() {
|
|
||||||
return "vtx_device_status_request";
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vtx.isVtxDeviceStatusNotReady = function()
|
vtx.isVtxDeviceStatusReady = function() {
|
||||||
{
|
|
||||||
const isReady = (null !== FC.VTX_DEVICE_STATUS) && (FC.VTX_DEVICE_STATUS.deviceIsReady);
|
const isReady = (null !== FC.VTX_DEVICE_STATUS) && (FC.VTX_DEVICE_STATUS.deviceIsReady);
|
||||||
return !isReady;
|
|
||||||
|
return !!isReady;
|
||||||
};
|
};
|
||||||
|
|
||||||
vtx.updateVtxDeviceStatus = function()
|
vtx.updateVtxDeviceStatus = function() {
|
||||||
{
|
function vtxDeviceStatusReceived() {
|
||||||
function vtxDeviceStatusReceived()
|
|
||||||
{
|
|
||||||
$("#vtx_type_description").text(TABS.vtx.getVtxTypeString());
|
$("#vtx_type_description").text(TABS.vtx.getVtxTypeString());
|
||||||
}
|
|
||||||
|
|
||||||
function vtxDeviceStatusReady()
|
|
||||||
{
|
|
||||||
const vtxReady_e = $('.VTX_info span.colorToggle');
|
const vtxReady_e = $('.VTX_info span.colorToggle');
|
||||||
|
const isReady = vtx.isVtxDeviceStatusReady();
|
||||||
|
|
||||||
// update device ready state
|
// update device ready state
|
||||||
vtxReady_e.text(FC.VTX_CONFIG.vtx_device_ready ? i18n.getMessage('vtxReadyTrue') : i18n.getMessage('vtxReadyFalse'));
|
vtxReady_e.text(isReady ? i18n.getMessage('vtxReadyTrue') : i18n.getMessage('vtxReadyFalse'));
|
||||||
vtxReady_e.toggleClass('ready', FC.VTX_CONFIG.vtx_device_ready);
|
vtxReady_e.toggleClass('ready', isReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP2_GET_VTX_DEVICE_STATUS, false, false, vtxDeviceStatusReceived);
|
MSP.send_message(MSPCodes.MSP2_GET_VTX_DEVICE_STATUS, false, false, vtxDeviceStatusReceived);
|
||||||
MSP.send_message(MSPCodes.MSP_VTX_CONFIG, false, false, vtxDeviceStatusReady);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vtx.getVtxTypeString = function()
|
vtx.getVtxTypeString = function() {
|
||||||
{
|
|
||||||
let result = i18n.getMessage(`vtxType_${FC.VTX_CONFIG.vtx_type}`);
|
let result = i18n.getMessage(`vtxType_${FC.VTX_CONFIG.vtx_type}`);
|
||||||
|
|
||||||
const isSmartAudio = VtxDeviceTypes.VTXDEV_SMARTAUDIO === FC.VTX_CONFIG.vtx_type;
|
const isSmartAudio = VtxDeviceTypes.VTXDEV_SMARTAUDIO === FC.VTX_CONFIG.vtx_type;
|
||||||
|
@ -118,11 +109,7 @@ vtx.initialize = function (callback) {
|
||||||
|
|
||||||
function vtxConfigReceived() {
|
function vtxConfigReceived() {
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
GUI.interval_add_condition(self._DEVICE_STATUS_UPDATE_INTERVAL_NAME,
|
vtx.intervalId = setInterval(vtx.updateVtxDeviceStatus, 1000);
|
||||||
TABS.vtx.updateVtxDeviceStatus,
|
|
||||||
1000, false,
|
|
||||||
TABS.vtx.isVtxDeviceStatusNotReady,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vtxtable_bands();
|
vtxtable_bands();
|
||||||
|
@ -306,7 +293,7 @@ vtx.initialize = function (callback) {
|
||||||
$("#vtx_type_description").text(self.getVtxTypeString());
|
$("#vtx_type_description").text(self.getVtxTypeString());
|
||||||
$("#vtx_channel_description").text(FC.VTX_CONFIG.vtx_channel);
|
$("#vtx_channel_description").text(FC.VTX_CONFIG.vtx_channel);
|
||||||
$("#vtx_frequency_description").text(FC.VTX_CONFIG.vtx_frequency);
|
$("#vtx_frequency_description").text(FC.VTX_CONFIG.vtx_frequency);
|
||||||
$("#vtx_pit_mode_description").text(FC.VTX_CONFIG.vtx_pit_mode ? i18n.getMessage("Yes") : i18n.getMessage("No"));
|
$("#vtx_pit_mode_description").text(FC.VTX_CONFIG.vtx_pit_mode ? i18n.getMessage("yes") : i18n.getMessage("no"));
|
||||||
$("#vtx_pit_mode_frequency_description").text(FC.VTX_CONFIG.vtx_pit_mode_frequency);
|
$("#vtx_pit_mode_frequency_description").text(FC.VTX_CONFIG.vtx_pit_mode_frequency);
|
||||||
$("#vtx_low_power_disarm_description").text(i18n.getMessage(`vtxLowPowerDisarmOption_${FC.VTX_CONFIG.vtx_low_power_disarm}`));
|
$("#vtx_low_power_disarm_description").text(i18n.getMessage(`vtxLowPowerDisarmOption_${FC.VTX_CONFIG.vtx_low_power_disarm}`));
|
||||||
|
|
||||||
|
@ -915,6 +902,8 @@ vtx.initialize = function (callback) {
|
||||||
|
|
||||||
saveButton.html(i18n.getMessage('vtxButtonSaving')).addClass('disabled');
|
saveButton.html(i18n.getMessage('vtxButtonSaving')).addClass('disabled');
|
||||||
|
|
||||||
|
clearInterval(TABS.vtx.intervalId);
|
||||||
|
|
||||||
// Allow firmware to make relevant changes before initialization
|
// Allow firmware to make relevant changes before initialization
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
saveButton.html(i18n.getMessage('vtxButtonSaved'));
|
saveButton.html(i18n.getMessage('vtxButtonSaved'));
|
||||||
|
@ -1048,7 +1037,7 @@ vtx.cleanup = function (callback) {
|
||||||
this.VTXTABLE_BAND_LIST = [];
|
this.VTXTABLE_BAND_LIST = [];
|
||||||
this.VTXTABLE_POWERLEVEL_LIST = [];
|
this.VTXTABLE_POWERLEVEL_LIST = [];
|
||||||
|
|
||||||
GUI.interval_remove(this._DEVICE_STATUS_UPDATE_INTERVAL_NAME);
|
clearInterval(this.intervalId);
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="description_text" i18n="vtxDeviceReady"></td>
|
<td class="description_text" i18n="vtxDeviceReady"></td>
|
||||||
<td><span class="colorToggle" i18n="vtxReadyFalse"></span></td>
|
<td><span class="colorToggle"></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="description vtx_type">
|
<tr class="description vtx_type">
|
||||||
<td class="description_text" i18n="vtxType"></td>
|
<td class="description_text" i18n="vtxType"></td>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue