Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable video transmitter tab #3505

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/js/Features.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { bit_check, bit_set, bit_clear } from "./bit";
import { API_VERSION_1_44, API_VERSION_1_45 } from './data_storage';
import { API_VERSION_1_44, API_VERSION_1_45, API_VERSION_1_46 } from './data_storage';
import semver from "semver";
import { tracking } from "./Analytics";

Expand Down Expand Up @@ -40,6 +40,7 @@ const Features = function (config) {

self._features = features;

// Filter features based on build options
if (semver.gte(config.apiVersion, API_VERSION_1_45) && config.buildOptions.length) {
self._features = [];

Expand All @@ -50,6 +51,11 @@ const Features = function (config) {
}
}

// Enable vtx feature if not already enabled in firmware. This is needed for the vtx tab to show up.
if (semver.gte(config.apiVersion, API_VERSION_1_46) && config.buildOptions.some(opt => opt.includes('VTX'))) {
self.enable('VTX');
}

self._features.sort((a, b) => a.name.localeCompare(b.name, window.navigator.language, { ignorePunctuation: true }));
self._featureMask = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GuiControl {
'help',
];

this.defaultAllowedTabsCloudBuild = [
this.defaultAllowedTabs = [
'setup',
'failsafe',
'power',
Expand Down Expand Up @@ -62,7 +62,7 @@ class GuiControl {
'vtx',
];

this.defaultAllowedFCTabsWhenConnected = [ ...this.defaultAllowedTabsCloudBuild, ...this.defaultCloudBuildTabOptions];
this.defaultAllowedFCTabsWhenConnected = [ ...this.defaultAllowedTabs, ...this.defaultCloudBuildTabOptions];

this.allowedTabs = this.defaultAllowedTabsWhenDisconnected;

Expand Down
5 changes: 3 additions & 2 deletions src/js/serial_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,10 @@ function setRtc() {

function finishOpen() {
CONFIGURATOR.connectionValid = true;

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) && FC.CONFIG.buildOptions.length) {

GUI.allowedTabs = GUI.defaultAllowedTabsCloudBuild;
GUI.allowedTabs = Array.from(GUI.defaultAllowedTabs);

for (const tab of GUI.defaultCloudBuildTabOptions) {
if (FC.CONFIG.buildOptions.some(opt => opt.toLowerCase().includes(tab))) {
Expand All @@ -547,7 +548,7 @@ function finishOpen() {
}

} else {
GUI.allowedTabs = GUI.defaultAllowedFCTabsWhenConnected.slice();
GUI.allowedTabs = Array.from(GUI.defaultAllowedFCTabsWhenConnected);
}

if (GUI.isCordova()) {
Expand Down
11 changes: 0 additions & 11 deletions src/js/tabs/ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ ports.initialize = function (callback) {
let enableBlackbox = false;
let enableEsc = false;
let enableGps = false;
let enableVtx = false;

for (const port of FC.SERIAL_CONFIG.ports) {
const func = port.functions;
Expand All @@ -438,10 +437,6 @@ ports.initialize = function (callback) {
if (func.includes('GPS')) {
enableGps = true;
}

if (func.includes('IRC_TRAMP') || func.includes('TBS_SMARTAUDIO')) {
enableVtx = true;
}
}

const featureConfig = FC.FEATURE_CONFIG.features;
Expand Down Expand Up @@ -474,12 +469,6 @@ ports.initialize = function (callback) {
featureConfig.disable('GPS');
}

if (enableVtx) {
featureConfig.enable('VTX');
} else {
featureConfig.disable('VTX');
}

mspHelper.sendSerialConfig(save_features);

function save_features() {
Expand Down
11 changes: 10 additions & 1 deletion src/js/utils/updateTabList.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import semver from "semver";
import { API_VERSION_1_42, API_VERSION_1_46 } from "../data_storage";
import FC from "../fc";

export function updateTabList(features) {
const isExpertModeEnabled = $('input[name="expertModeCheckbox"]').is(':checked');

Expand All @@ -11,5 +15,10 @@ export function updateTabList(features) {
$('#tabs ul.mode-connected li.tab_led_strip').toggle(features.isEnabled('LED_STRIP'));
$('#tabs ul.mode-connected li.tab_transponder').toggle(features.isEnabled('TRANSPONDER'));
$('#tabs ul.mode-connected li.tab_osd').toggle(features.isEnabled('OSD'));
$('#tabs ul.mode-connected li.tab_vtx').toggle(features.isEnabled('VTX'));

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
$('#tabs ul.mode-connected li.tab_vtx').toggle(features.isEnabled('VTX'));
} else {
$('#tabs ul.mode-connected li.tab_vtx').toggle(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42));
}
}