Added analytics for new configurator elements.
parent
93e4cf83b8
commit
005868bc07
|
@ -2461,7 +2461,7 @@
|
||||||
"message": "Load from file"
|
"message": "Load from file"
|
||||||
},
|
},
|
||||||
"cliConfirmSnippetDialogTitle": {
|
"cliConfirmSnippetDialogTitle": {
|
||||||
"message": "Review loaded commands"
|
"message": "Loaded file <strong>{{fileName}}</strong>. Review the loaded commands"
|
||||||
},
|
},
|
||||||
"cliConfirmSnippetNote": {
|
"cliConfirmSnippetNote": {
|
||||||
"message": "<strong>Note</strong>: You can review and edit commands before execution."
|
"message": "<strong>Note</strong>: You can review and edit commands before execution."
|
||||||
|
|
|
@ -35,7 +35,6 @@ var Analytics = function (trackingId, userId, appName, appVersion, changesetId,
|
||||||
FIRMWARE_TYPE: 'firmwareType',
|
FIRMWARE_TYPE: 'firmwareType',
|
||||||
FIRMWARE_VERSION: 'firmwareVersion',
|
FIRMWARE_VERSION: 'firmwareVersion',
|
||||||
FIRMWARE_NAME: 'firmwareName',
|
FIRMWARE_NAME: 'firmwareName',
|
||||||
FIRMWARE_CHECKSUM: 'firmwareChecksum',
|
|
||||||
FIRMWARE_SOURCE: 'firmwareSource',
|
FIRMWARE_SOURCE: 'firmwareSource',
|
||||||
FIRMWARE_CHANNEL: 'firmwareChannel',
|
FIRMWARE_CHANNEL: 'firmwareChannel',
|
||||||
FIRMWARE_ERASE_ALL: 'firmwareEraseAll',
|
FIRMWARE_ERASE_ALL: 'firmwareEraseAll',
|
||||||
|
@ -158,7 +157,6 @@ Analytics.prototype._rebuildFirmwareEvent = function () {
|
||||||
this.setDimension(this.DIMENSIONS.FIRMWARE_ERASE_ALL, this._firmwareData[this.DATA.FIRMWARE_ERASE_ALL]);
|
this.setDimension(this.DIMENSIONS.FIRMWARE_ERASE_ALL, this._firmwareData[this.DATA.FIRMWARE_ERASE_ALL]);
|
||||||
this.setDimension(this.DIMENSIONS.FIRMWARE_CHANNEL, this._firmwareData[this.DATA.FIRMWARE_CHANNEL]);
|
this.setDimension(this.DIMENSIONS.FIRMWARE_CHANNEL, this._firmwareData[this.DATA.FIRMWARE_CHANNEL]);
|
||||||
this.setMetric(this.METRICS.FIRMWARE_SIZE, this._firmwareData[this.DATA.FIRMWARE_SIZE]);
|
this.setMetric(this.METRICS.FIRMWARE_SIZE, this._firmwareData[this.DATA.FIRMWARE_SIZE]);
|
||||||
this._googleAnalytics.set('eventLabel', this._firmwareData[this.DATA.FIRMWARE_CHECKSUM]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Analytics.prototype.setFirmwareData = function (property, value) {
|
Analytics.prototype.setFirmwareData = function (property, value) {
|
||||||
|
|
|
@ -51,6 +51,8 @@ CliAutoComplete.setEnabled = function(enable) {
|
||||||
};
|
};
|
||||||
|
|
||||||
CliAutoComplete.initialize = function($textarea, sendLine, writeToOutput) {
|
CliAutoComplete.initialize = function($textarea, sendLine, writeToOutput) {
|
||||||
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'CliAutoComplete', this.configEnabled);
|
||||||
|
|
||||||
this.$textarea = $textarea;
|
this.$textarea = $textarea;
|
||||||
this.forceOpen = false,
|
this.forceOpen = false,
|
||||||
this.sendLine = sendLine;
|
this.sendLine = sendLine;
|
||||||
|
|
|
@ -12,7 +12,6 @@ const languagesAvailables = ['ca', 'de', 'en', 'es', 'fr', 'gl', 'hr', 'id', 'it
|
||||||
* Functions that depend on the i18n framework
|
* Functions that depend on the i18n framework
|
||||||
*/
|
*/
|
||||||
i18n.init = function(cb) {
|
i18n.init = function(cb) {
|
||||||
|
|
||||||
getStoredUserLocale(function(userLanguage) {
|
getStoredUserLocale(function(userLanguage) {
|
||||||
|
|
||||||
i18next
|
i18next
|
||||||
|
|
|
@ -21,6 +21,11 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
i18n.init(function() {
|
i18n.init(function() {
|
||||||
startProcess();
|
startProcess();
|
||||||
|
|
||||||
|
checkSetupAnalytics(function (analytics) {
|
||||||
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'SelectedLanguage', i18n.selectedLanguage);
|
||||||
|
});
|
||||||
|
|
||||||
initializeSerialBackend();
|
initializeSerialBackend();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -391,7 +396,7 @@ function startProcess() {
|
||||||
var checked = $(this).is(':checked');
|
var checked = $(this).is(':checked');
|
||||||
|
|
||||||
ConfigStorage.set({'darkTheme': checked});
|
ConfigStorage.set({'darkTheme': checked});
|
||||||
DarkTheme.setConfig(checked);
|
setDarkTheme(checked);
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
function close_and_cleanup(e) {
|
function close_and_cleanup(e) {
|
||||||
|
@ -543,10 +548,18 @@ function startProcess() {
|
||||||
});
|
});
|
||||||
|
|
||||||
ConfigStorage.get('darkTheme', function (result) {
|
ConfigStorage.get('darkTheme', function (result) {
|
||||||
DarkTheme.setConfig(result.darkTheme);
|
setDarkTheme(result.darkTheme);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setDarkTheme(enabled) {
|
||||||
|
DarkTheme.setConfig(enabled);
|
||||||
|
|
||||||
|
checkSetupAnalytics(function (analytics) {
|
||||||
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'DarkTheme', enabled);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function checkForConfiguratorUpdates() {
|
function checkForConfiguratorUpdates() {
|
||||||
var releaseChecker = new ReleaseChecker('configurator', 'https://api.github.com/repos/betaflight/betaflight-configurator/releases');
|
var releaseChecker = new ReleaseChecker('configurator', 'https://api.github.com/repos/betaflight/betaflight-configurator/releases');
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ function getCliCommand(command, cliBuffer) {
|
||||||
|
|
||||||
function copyToClipboard(text) {
|
function copyToClipboard(text) {
|
||||||
function onCopySuccessful() {
|
function onCopySuccessful() {
|
||||||
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'CliCopyToClipboard', text.length);
|
||||||
const button = $('.tab-cli .copy');
|
const button = $('.tab-cli .copy');
|
||||||
const origText = button.text();
|
const origText = button.text();
|
||||||
const origWidth = button.css("width");
|
const origWidth = button.css("width");
|
||||||
|
@ -207,13 +208,16 @@ TABS.cli.initialize = function (callback) {
|
||||||
|
|
||||||
let previewArea = $("#snippetpreviewcontent textarea#preview");
|
let previewArea = $("#snippetpreviewcontent textarea#preview");
|
||||||
|
|
||||||
function executeSnippet() {
|
function executeSnippet(fileName) {
|
||||||
const commands = previewArea.val();
|
const commands = previewArea.val();
|
||||||
|
|
||||||
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'CliExecuteFromFile', fileName);
|
||||||
|
|
||||||
executeCommands(commands);
|
executeCommands(commands);
|
||||||
self.GUI.snippetPreviewWindow.close();
|
self.GUI.snippetPreviewWindow.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function previewCommands(result) {
|
function previewCommands(result, fileName) {
|
||||||
if (!self.GUI.snippetPreviewWindow) {
|
if (!self.GUI.snippetPreviewWindow) {
|
||||||
self.GUI.snippetPreviewWindow = new jBox("Modal", {
|
self.GUI.snippetPreviewWindow = new jBox("Modal", {
|
||||||
id: "snippetPreviewWindow",
|
id: "snippetPreviewWindow",
|
||||||
|
@ -222,10 +226,10 @@ TABS.cli.initialize = function (callback) {
|
||||||
closeButton: 'title',
|
closeButton: 'title',
|
||||||
animation: false,
|
animation: false,
|
||||||
isolateScroll: false,
|
isolateScroll: false,
|
||||||
title: i18n.getMessage("cliConfirmSnippetDialogTitle"),
|
title: i18n.getMessage("cliConfirmSnippetDialogTitle", { fileName: fileName }),
|
||||||
content: $('#snippetpreviewcontent'),
|
content: $('#snippetpreviewcontent'),
|
||||||
onCreated: () =>
|
onCreated: () =>
|
||||||
$("#snippetpreviewcontent a.confirm").click(() => executeSnippet())
|
$("#snippetpreviewcontent a.confirm").click(() => executeSnippet(fileName))
|
||||||
,
|
,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -236,7 +240,7 @@ TABS.cli.initialize = function (callback) {
|
||||||
entry.file((file) => {
|
entry.file((file) => {
|
||||||
let reader = new FileReader();
|
let reader = new FileReader();
|
||||||
reader.onload =
|
reader.onload =
|
||||||
() => previewCommands(reader.result);
|
() => previewCommands(reader.result, file.name);
|
||||||
reader.onerror = () => console.error(reader.error);
|
reader.onerror = () => console.error(reader.error);
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
});
|
});
|
||||||
|
|
|
@ -353,6 +353,42 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
orientation_acc_e.val(SENSOR_ALIGNMENT.align_acc);
|
orientation_acc_e.val(SENSOR_ALIGNMENT.align_acc);
|
||||||
orientation_mag_e.val(SENSOR_ALIGNMENT.align_mag);
|
orientation_mag_e.val(SENSOR_ALIGNMENT.align_mag);
|
||||||
|
|
||||||
|
orientation_gyro_e.change(function () {
|
||||||
|
let value = parseInt($(this).val());
|
||||||
|
|
||||||
|
let newValue = undefined;
|
||||||
|
if (value !== SENSOR_ALIGNMENT.align_gyro) {
|
||||||
|
newValue = $(this).find('option:selected').text();
|
||||||
|
}
|
||||||
|
self.analyticsChanges['GyroAlignment'] = newValue;
|
||||||
|
|
||||||
|
SENSOR_ALIGNMENT.align_gyro = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
orientation_acc_e.change(function () {
|
||||||
|
let value = parseInt($(this).val());
|
||||||
|
|
||||||
|
let newValue = undefined;
|
||||||
|
if (value !== SENSOR_ALIGNMENT.align_acc) {
|
||||||
|
newValue = $(this).find('option:selected').text();
|
||||||
|
}
|
||||||
|
self.analyticsChanges['AccAlignment'] = newValue;
|
||||||
|
|
||||||
|
SENSOR_ALIGNMENT.align_acc = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
orientation_mag_e.change(function () {
|
||||||
|
let value = parseInt($(this).val());
|
||||||
|
|
||||||
|
let newValue = undefined;
|
||||||
|
if (value !== SENSOR_ALIGNMENT.align_mag) {
|
||||||
|
newValue = $(this).find('option:selected').text();
|
||||||
|
}
|
||||||
|
self.analyticsChanges['MagAlignment'] = newValue;
|
||||||
|
|
||||||
|
SENSOR_ALIGNMENT.align_mag = value;
|
||||||
|
});
|
||||||
|
|
||||||
// Multi gyro config
|
// Multi gyro config
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||||
|
|
||||||
|
@ -393,6 +429,30 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('.gyro_alignment_inputs_second').toggle(detected_gyro_2);
|
$('.gyro_alignment_inputs_second').toggle(detected_gyro_2);
|
||||||
$('.gyro_alignment_inputs_selection').toggle(detected_gyro_1 || detected_gyro_2);
|
$('.gyro_alignment_inputs_selection').toggle(detected_gyro_1 || detected_gyro_2);
|
||||||
$('.gyro_alignment_inputs_notfound').toggle(!detected_gyro_1 && !detected_gyro_2);
|
$('.gyro_alignment_inputs_notfound').toggle(!detected_gyro_1 && !detected_gyro_2);
|
||||||
|
|
||||||
|
orientation_gyro_1_align_e.change(function () {
|
||||||
|
let value = parseInt($(this).val());
|
||||||
|
|
||||||
|
let newValue = undefined;
|
||||||
|
if (value !== SENSOR_ALIGNMENT.gyro_1_align) {
|
||||||
|
newValue = $(this).find('option:selected').text();
|
||||||
|
}
|
||||||
|
self.analyticsChanges['Gyro1Alignment'] = newValue;
|
||||||
|
|
||||||
|
SENSOR_ALIGNMENT.gyro_1_align = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
orientation_gyro_2_align_e.change(function () {
|
||||||
|
let value = parseInt($(this).val());
|
||||||
|
|
||||||
|
let newValue = undefined;
|
||||||
|
if (value !== SENSOR_ALIGNMENT.gyro_2_align) {
|
||||||
|
newValue = $(this).find('option:selected').text();
|
||||||
|
}
|
||||||
|
self.analyticsChanges['Gyro2Alignment'] = newValue;
|
||||||
|
|
||||||
|
SENSOR_ALIGNMENT.gyro_2_align = value;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,8 +497,24 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('input[id="unsyncedPWMSwitch"]').prop('checked', PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0).change();
|
$('input[id="unsyncedPWMSwitch"]').prop('checked', PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0).change();
|
||||||
$('input[name="unsyncedpwmfreq"]').val(PID_ADVANCED_CONFIG.motor_pwm_rate);
|
$('input[name="unsyncedpwmfreq"]').val(PID_ADVANCED_CONFIG.motor_pwm_rate);
|
||||||
$('input[name="digitalIdlePercent"]').val(PID_ADVANCED_CONFIG.digitalIdlePercent);
|
$('input[name="digitalIdlePercent"]').val(PID_ADVANCED_CONFIG.digitalIdlePercent);
|
||||||
$('input[id="dshotBidir"]').prop('checked', MOTOR_CONFIG.use_dshot_telemetry).change();
|
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||||
|
let dshotBidirectional_e = $('input[id="dshotBidir"]');
|
||||||
|
dshotBidirectional_e.prop('checked', MOTOR_CONFIG.use_dshot_telemetry).change();
|
||||||
|
|
||||||
|
dshotBidirectional_e.change(function () {
|
||||||
|
let value = $(this).prop('checked');
|
||||||
|
|
||||||
|
var newValue = undefined;
|
||||||
|
if (value !== MOTOR_CONFIG.use_dshot_telemetry) {
|
||||||
|
newValue = value ? 'On' : 'Off';
|
||||||
|
}
|
||||||
|
self.analyticsChanges['BidirectionalDshot'] = newValue;
|
||||||
|
|
||||||
|
MOTOR_CONFIG.use_dshot_telemetry = value;
|
||||||
|
});
|
||||||
|
|
||||||
$('input[name="motorPoles"]').val(MOTOR_CONFIG.motor_poles);
|
$('input[name="motorPoles"]').val(MOTOR_CONFIG.motor_poles);
|
||||||
|
}
|
||||||
|
|
||||||
esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol + 1);
|
esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol + 1);
|
||||||
esc_protocol_e.change(function () {
|
esc_protocol_e.change(function () {
|
||||||
|
@ -1069,7 +1145,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
MOTOR_CONFIG.mincommand = parseInt($('input[name="mincommand"]').val());
|
MOTOR_CONFIG.mincommand = parseInt($('input[name="mincommand"]').val());
|
||||||
if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||||
MOTOR_CONFIG.motor_poles = parseInt($('input[name="motorPoles"]').val());
|
MOTOR_CONFIG.motor_poles = parseInt($('input[name="motorPoles"]').val());
|
||||||
MOTOR_CONFIG.use_dshot_telemetry = $('input[id="dshotBidir"]').prop('checked');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self.SHOW_OLD_BATTERY_CONFIG) {
|
if(self.SHOW_OLD_BATTERY_CONFIG) {
|
||||||
|
@ -1089,13 +1164,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
MOTOR_3D_CONFIG.neutral = parseInt($('input[name="3dneutral"]').val());
|
MOTOR_3D_CONFIG.neutral = parseInt($('input[name="3dneutral"]').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
SENSOR_ALIGNMENT.align_gyro = parseInt(orientation_gyro_e.val());
|
|
||||||
SENSOR_ALIGNMENT.align_acc = parseInt(orientation_acc_e.val());
|
|
||||||
SENSOR_ALIGNMENT.align_mag = parseInt(orientation_mag_e.val());
|
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||||
SENSOR_ALIGNMENT.gyro_to_use = parseInt(orientation_gyro_to_use_e.val());
|
SENSOR_ALIGNMENT.gyro_to_use = parseInt(orientation_gyro_to_use_e.val());
|
||||||
SENSOR_ALIGNMENT.gyro_1_align = parseInt(orientation_gyro_1_align_e.val());
|
|
||||||
SENSOR_ALIGNMENT.gyro_2_align = parseInt(orientation_gyro_2_align_e.val());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PID_ADVANCED_CONFIG.fast_pwm_protocol = parseInt(esc_protocol_e.val()-1);
|
PID_ADVANCED_CONFIG.fast_pwm_protocol = parseInt(esc_protocol_e.val()-1);
|
||||||
|
|
|
@ -6,6 +6,12 @@ TABS.firmware_flasher = {
|
||||||
jenkinsLoader: new JenkinsLoader('https://ci.betaflight.tech'),
|
jenkinsLoader: new JenkinsLoader('https://ci.betaflight.tech'),
|
||||||
localFirmwareLoaded: false,
|
localFirmwareLoaded: false,
|
||||||
selectedBoard: undefined,
|
selectedBoard: undefined,
|
||||||
|
intel_hex: undefined, // standard intel hex in string format
|
||||||
|
parsed_hex: undefined, // parsed raw hex in array format
|
||||||
|
unifiedTargetConfig: undefined, // the Unified Target configuration to be spliced into the configuration
|
||||||
|
unifiedTargetConfigName: undefined,
|
||||||
|
isConfigLocal: false, // Set to true if the user loads one locally
|
||||||
|
remoteUnifiedTargetConfig: undefined, // Unified target configuration loaded from the menu, used when throwing out a local config
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.firmware_flasher.initialize = function (callback) {
|
TABS.firmware_flasher.initialize = function (callback) {
|
||||||
|
@ -15,25 +21,15 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
GUI.active_tab = 'firmware_flasher';
|
GUI.active_tab = 'firmware_flasher';
|
||||||
}
|
}
|
||||||
|
|
||||||
TABS.firmware_flasher.selectedBoard = undefined;
|
self.selectedBoard = undefined;
|
||||||
TABS.firmware_flasher.localFirmwareLoaded = false;
|
self.localFirmwareLoaded = false;
|
||||||
var intel_hex = false; // standard intel hex in string format
|
self.isConfigLocal = false;
|
||||||
var parsed_hex = false; // parsed raw hex in array format
|
self.intel_hex = undefined;
|
||||||
var targetConfig; // the Unified Target configuration to be spliced into the configuration
|
self.parsed_hex = undefined;
|
||||||
var isConfigLocal = false; // Set to true if the user loads one locally
|
|
||||||
var unifiedConfig; // Unified target configuration loaded from the menu, used when throwing out a local config
|
|
||||||
|
|
||||||
var unifiedSource = 'https://api.github.com/repos/betaflight/unified-targets/contents/configs/default';
|
var unifiedSource = 'https://api.github.com/repos/betaflight/unified-targets/contents/configs/default';
|
||||||
|
|
||||||
|
|
||||||
// These two functions are handy for peeking under the hood. Please don't call them in code.
|
|
||||||
self.peekTargetConfig = function () {
|
|
||||||
return targetConfig;
|
|
||||||
}
|
|
||||||
self.peekHex = function () {
|
|
||||||
return parsed_hex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change boldness of firmware option depending on cache status
|
* Change boldness of firmware option depending on cache status
|
||||||
*
|
*
|
||||||
|
@ -64,7 +60,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
worker.postMessage(str);
|
worker.postMessage(str);
|
||||||
}
|
}
|
||||||
function show_loaded_hex(summary) {
|
function show_loaded_hex(summary) {
|
||||||
self.flashingMessage('<a class="save_firmware" href="#" title="Save Firmware">' + i18n.getMessage('firmwareFlasherFirmwareOnlineLoaded', parsed_hex.bytes_total) + '</a>',
|
self.flashingMessage('<a class="save_firmware" href="#" title="Save Firmware">' + i18n.getMessage('firmwareFlasherFirmwareOnlineLoaded', self.parsed_hex.bytes_total) + '</a>',
|
||||||
self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||||
|
|
||||||
self.enableFlashing(true);
|
self.enableFlashing(true);
|
||||||
|
@ -83,18 +79,16 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
$('div.release_info').slideDown();
|
$('div.release_info').slideDown();
|
||||||
}
|
}
|
||||||
function process_hex(data, summary) {
|
function process_hex(data, summary) {
|
||||||
intel_hex = data;
|
self.intel_hex = data;
|
||||||
|
|
||||||
analytics.setFirmwareData(analytics.DATA.FIRMWARE_CHECKSUM, objectHash.sha1(intel_hex));
|
parse_hex(self.intel_hex, function (data) {
|
||||||
|
self.parsed_hex = data;
|
||||||
|
|
||||||
parse_hex(intel_hex, function (data) {
|
if (self.parsed_hex) {
|
||||||
parsed_hex = data;
|
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SIZE, self.parsed_hex.bytes_total);
|
||||||
|
|
||||||
if (parsed_hex) {
|
|
||||||
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SIZE, parsed_hex.bytes_total);
|
|
||||||
|
|
||||||
if (!FirmwareCache.has(summary)) {
|
if (!FirmwareCache.has(summary)) {
|
||||||
FirmwareCache.put(summary, intel_hex);
|
FirmwareCache.put(summary, self.intel_hex);
|
||||||
}
|
}
|
||||||
show_loaded_hex(summary)
|
show_loaded_hex(summary)
|
||||||
|
|
||||||
|
@ -418,7 +412,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
if (targetVersions) {
|
if (targetVersions) {
|
||||||
versions_element.append($("<option value='0'>{0} {1}</option>".format(i18n.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersionFor'), target)));
|
versions_element.append($("<option value='0'>{0} {1}</option>".format(i18n.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersionFor'), target)));
|
||||||
targetVersions.forEach(function(descriptor) {
|
targetVersions.forEach(function(descriptor) {
|
||||||
if (unifiedConfig && !checkOneVersionForUnification(descriptor.version)) {
|
if (self.remoteUnifiedTargetConfig && !checkOneVersionForUnification(descriptor.version)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var select_e =
|
var select_e =
|
||||||
|
@ -453,24 +447,27 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
// a target might request a firmware with the same name, remove configuration in this case.
|
// a target might request a firmware with the same name, remove configuration in this case.
|
||||||
if (bareBoard == target) {
|
if (bareBoard == target) {
|
||||||
console.log(bareBoard, '==', target);
|
console.log(bareBoard, '==', target);
|
||||||
if (!isConfigLocal) {
|
if (!self.isConfigLocal) {
|
||||||
targetConfig = undefined;
|
self.unifiedTargetConfig = undefined;
|
||||||
unifiedConfig = undefined;
|
self.unifiedTargetConfigName = undefined;
|
||||||
|
self.remoteUnifiedTargetConfig = undefined;
|
||||||
} else {
|
} else {
|
||||||
unifiedConfig = undefined;
|
self.remoteUnifiedTargetConfig = undefined;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
targetConfig = configText;
|
self.unifiedTargetConfig = configText;
|
||||||
isConfigLocal = false;
|
self.unifiedTargetConfigName = `${target}.config`;
|
||||||
unifiedConfig = configText;
|
self.isConfigLocal = false;
|
||||||
|
self.remoteUnifiedTargetConfig = configText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function clearBufferedFirmware() {
|
function clearBufferedFirmware() {
|
||||||
isConfigLocal = false;
|
self.isConfigLocal = false;
|
||||||
targetConfig = undefined;
|
self.unifiedTargetConfig = undefined;
|
||||||
unifiedConfig = undefined;
|
self.unifiedTargetConfigName = undefined;
|
||||||
intel_hex = false;
|
self.remoteUnifiedTargetConfig = undefined;
|
||||||
parsed_hex = false;
|
self.intel_hex = undefined;
|
||||||
|
self.parsed_hex = undefined;
|
||||||
self.localFirmwareLoaded = false;
|
self.localFirmwareLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,10 +478,11 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
if (!GUI.connect_lock) {
|
if (!GUI.connect_lock) {
|
||||||
if (TABS.firmware_flasher.selectedBoard != target) {
|
if (TABS.firmware_flasher.selectedBoard != target) {
|
||||||
// We're sure the board actually changed
|
// We're sure the board actually changed
|
||||||
if (isConfigLocal) {
|
if (self.isConfigLocal) {
|
||||||
console.log('Board changed, unloading local config');
|
console.log('Board changed, unloading local config');
|
||||||
isConfigLocal = false;
|
self.isConfigLocal = false;
|
||||||
targetConfig = undefined;
|
self.unifiedTargetConfig = undefined;
|
||||||
|
self.unifiedTargetConfigName = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConfigStorage.set({'selected_board': target});
|
ConfigStorage.set({'selected_board': target});
|
||||||
|
@ -541,9 +539,10 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
populateVersions(versions_e, TABS.firmware_flasher.releases[bareBoard], target);
|
populateVersions(versions_e, TABS.firmware_flasher.releases[bareBoard], target);
|
||||||
}).fail(xhr => {
|
}).fail(xhr => {
|
||||||
//TODO error, populate nothing?
|
//TODO error, populate nothing?
|
||||||
targetConfig = undefined;
|
self.unifiedTargetConfig = undefined;
|
||||||
isConfigLocal = false;
|
self.unifiedTargetConfigName = undefined;
|
||||||
unifiedConfig= undefined;
|
self.isConfigLocal = false;
|
||||||
|
self.remoteUnifiedTargetConfig = undefined;
|
||||||
let baseFileName = TABS.firmware_flasher.unifiedConfigs[target].reverse()[0];
|
let baseFileName = TABS.firmware_flasher.unifiedConfigs[target].reverse()[0];
|
||||||
GUI.log(i18n.getMessage('firmwareFlasherFailedToLoadUnifiedConfig',
|
GUI.log(i18n.getMessage('firmwareFlasherFailedToLoadUnifiedConfig',
|
||||||
{remote_file: baseFileName}));
|
{remote_file: baseFileName}));
|
||||||
|
@ -559,11 +558,12 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (!isConfigLocal) {
|
if (!self.isConfigLocal) {
|
||||||
targetConfig = undefined;
|
self.unifiedTargetConfig = undefined;
|
||||||
unifiedConfig = undefined;
|
self.unifiedTargetConfigName = undefined;
|
||||||
|
self.remoteUnifiedTargetConfig = undefined;
|
||||||
} else {
|
} else {
|
||||||
unifiedConfig = undefined;
|
self.remoteUnifiedTargetConfig = undefined;
|
||||||
}
|
}
|
||||||
TABS.firmware_flasher.bareBoard = target;
|
TABS.firmware_flasher.bareBoard = target;
|
||||||
populateVersions(versions_e, TABS.firmware_flasher.releases[target], target);
|
populateVersions(versions_e, TABS.firmware_flasher.releases[target], target);
|
||||||
|
@ -575,16 +575,16 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
|
|
||||||
function flashingMessageLocal() {
|
function flashingMessageLocal() {
|
||||||
// used by the a.load_file hook, evaluate the loaded information, and enable flashing if suitable
|
// used by the a.load_file hook, evaluate the loaded information, and enable flashing if suitable
|
||||||
if (isConfigLocal && !parsed_hex) {
|
if (self.isConfigLocal && !self.parsed_hex) {
|
||||||
self.flashingMessage(i18n.getMessage('firmwareFlasherLoadedConfig'), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
self.flashingMessage(i18n.getMessage('firmwareFlasherLoadedConfig'), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||||
}
|
}
|
||||||
if (isConfigLocal && parsed_hex && !self.localFirmwareLoaded) {
|
if (self.isConfigLocal && self.parsed_hex && !self.localFirmwareLoaded) {
|
||||||
self.enableFlashing(true);
|
self.enableFlashing(true);
|
||||||
self.flashingMessage(i18n.getMessage('firmwareFlasherFirmwareLocalLoaded', parsed_hex.bytes_total), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
self.flashingMessage(i18n.getMessage('firmwareFlasherFirmwareLocalLoaded', self.parsed_hex.bytes_total), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||||
}
|
}
|
||||||
if (self.localFirmwareLoaded) {
|
if (self.localFirmwareLoaded) {
|
||||||
self.enableFlashing(true);
|
self.enableFlashing(true);
|
||||||
self.flashingMessage(i18n.getMessage('firmwareFlasherFirmwareLocalLoaded', parsed_hex.bytes_total), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
self.flashingMessage(i18n.getMessage('firmwareFlasherFirmwareLocalLoaded', self.parsed_hex.bytes_total), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
|
@ -625,16 +625,15 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
console.log('File loaded (' + e.loaded + ')');
|
console.log('File loaded (' + e.loaded + ')');
|
||||||
|
|
||||||
if (file.name.split('.').pop() === "hex") {
|
if (file.name.split('.').pop() === "hex") {
|
||||||
intel_hex = e.target.result;
|
self.intel_hex = e.target.result;
|
||||||
|
|
||||||
analytics.setFirmwareData(analytics.DATA.FIRMWARE_CHECKSUM, objectHash.sha1(intel_hex));
|
parse_hex(self.intel_hex, function (data) {
|
||||||
|
self.parsed_hex = data;
|
||||||
|
|
||||||
parse_hex(intel_hex, function (data) {
|
if (self.parsed_hex) {
|
||||||
parsed_hex = data;
|
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SIZE, self.parsed_hex.bytes_total);
|
||||||
|
|
||||||
if (parsed_hex) {
|
|
||||||
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SIZE, parsed_hex.bytes_total);
|
|
||||||
self.localFirmwareLoaded = true;
|
self.localFirmwareLoaded = true;
|
||||||
|
|
||||||
flashingMessageLocal();
|
flashingMessageLocal();
|
||||||
} else {
|
} else {
|
||||||
self.flashingMessage('firmwareFlasherHexCorrupted', self.FLASH_MESSAGE_TYPES.INVALID);
|
self.flashingMessage('firmwareFlasherHexCorrupted', self.FLASH_MESSAGE_TYPES.INVALID);
|
||||||
|
@ -642,8 +641,9 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
clearBufferedFirmware();
|
clearBufferedFirmware();
|
||||||
targetConfig = e.target.result;
|
self.unifiedTargetConfig = e.target.result;
|
||||||
isConfigLocal = true;
|
self.unifiedTargetConfigName = file.name;
|
||||||
|
self.isConfigLocal = true;
|
||||||
flashingMessageLocal();
|
flashingMessageLocal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -664,11 +664,11 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
if (!self.localFirmwareLoaded) {
|
if (!self.localFirmwareLoaded) {
|
||||||
self.enableFlashing(false);
|
self.enableFlashing(false);
|
||||||
self.flashingMessage(i18n.getMessage('firmwareFlasherLoadFirmwareFile'), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
self.flashingMessage(i18n.getMessage('firmwareFlasherLoadFirmwareFile'), self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||||
if(parsed_hex && parsed_hex.bytes_total) {
|
if(self.parsed_hex && self.parsed_hex.bytes_total) {
|
||||||
// Changing the board triggers a version change, so we need only dump it here.
|
// Changing the board triggers a version change, so we need only dump it here.
|
||||||
console.log('throw out loaded hex');
|
console.log('throw out loaded hex');
|
||||||
intel_hex = false;
|
self.intel_hex = undefined;
|
||||||
parsed_hex = false;
|
self.parsed_hex = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
|
|
||||||
var summary = $('select[name="firmware_version"] option:selected').data('summary');
|
var summary = $('select[name="firmware_version"] option:selected').data('summary');
|
||||||
if (summary) { // undefined while list is loading or while running offline
|
if (summary) { // undefined while list is loading or while running offline
|
||||||
if (isConfigLocal && FirmwareCache.has(summary)) {
|
if (self.isConfigLocal && FirmwareCache.has(summary)) {
|
||||||
// Load the .hex from Cache if available when the user is providing their own config.
|
// Load the .hex from Cache if available when the user is providing their own config.
|
||||||
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SOURCE, 'cache');
|
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SOURCE, 'cache');
|
||||||
FirmwareCache.get(summary, cached => {
|
FirmwareCache.get(summary, cached => {
|
||||||
|
@ -757,7 +757,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
baud = parseInt($('#flash_manual_baud_rate').val());
|
baud = parseInt($('#flash_manual_baud_rate').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
analytics.sendEvent(analytics.EVENT_CATEGORIES.FIRMWARE, 'Flashing');
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.FIRMWARE, 'Flashing', self.unifiedTargetConfigName || null);
|
||||||
|
|
||||||
STM32.connect(port, baud, firmware, options);
|
STM32.connect(port, baud, firmware, options);
|
||||||
} else {
|
} else {
|
||||||
|
@ -765,7 +765,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
GUI.log(i18n.getMessage('firmwareFlasherNoValidPort'));
|
GUI.log(i18n.getMessage('firmwareFlasherNoValidPort'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
analytics.sendEvent(analytics.EVENT_CATEGORIES.FIRMWARE, 'Flashing');
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.FIRMWARE, 'Flashing', self.unifiedTargetConfigName || null);
|
||||||
|
|
||||||
STM32DFU.connect(usbDevices, firmware, options);
|
STM32DFU.connect(usbDevices, firmware, options);
|
||||||
}
|
}
|
||||||
|
@ -774,21 +774,22 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
$('a.flash_firmware').click(function () {
|
$('a.flash_firmware').click(function () {
|
||||||
if (!$(this).hasClass('disabled')) {
|
if (!$(this).hasClass('disabled')) {
|
||||||
if (!GUI.connect_lock) { // button disabled while flashing is in progress
|
if (!GUI.connect_lock) { // button disabled while flashing is in progress
|
||||||
if (parsed_hex != false) {
|
if (self.parsed_hex != false) {
|
||||||
try {
|
try {
|
||||||
if (targetConfig && !parsed_hex.configInserted) {
|
if (self.unifiedTargetConfig && !self.parsed_hex.configInserted) {
|
||||||
var configInserter = new ConfigInserter();
|
var configInserter = new ConfigInserter();
|
||||||
|
|
||||||
if (configInserter.insertConfig(parsed_hex, targetConfig)) {
|
if (configInserter.insertConfig(self.parsed_hex, self.unifiedTargetConfig)) {
|
||||||
parsed_hex.configInserted = true;
|
self.parsed_hex.configInserted = true;
|
||||||
} else {
|
} else {
|
||||||
console.log('Firmware does not support custom defaults.');
|
console.log('Firmware does not support custom defaults.');
|
||||||
|
|
||||||
targetConfig = undefined;
|
self.unifiedTargetConfig = undefined;
|
||||||
|
self.unifiedTargetConfigName = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flashFirmware(parsed_hex);
|
flashFirmware(self.parsed_hex);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`Flashing failed: ${e.message}`);
|
console.log(`Flashing failed: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
@ -814,7 +815,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
// check if file is writable
|
// check if file is writable
|
||||||
chrome.fileSystem.isWritableEntry(fileEntry, function (isWritable) {
|
chrome.fileSystem.isWritableEntry(fileEntry, function (isWritable) {
|
||||||
if (isWritable) {
|
if (isWritable) {
|
||||||
var blob = new Blob([intel_hex], {type: 'text/plain'});
|
var blob = new Blob([self.intel_hex], {type: 'text/plain'});
|
||||||
|
|
||||||
fileEntry.createWriter(function (writer) {
|
fileEntry.createWriter(function (writer) {
|
||||||
var truncated = false;
|
var truncated = false;
|
||||||
|
@ -1007,7 +1008,6 @@ TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL',
|
||||||
ACTION : 'ACTION'};
|
ACTION : 'ACTION'};
|
||||||
|
|
||||||
TABS.firmware_flasher.flashingMessage = function(message, type) {
|
TABS.firmware_flasher.flashingMessage = function(message, type) {
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
let progressLabel_e = $('span.progressLabel');
|
let progressLabel_e = $('span.progressLabel');
|
||||||
|
|
|
@ -176,6 +176,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
blackbox_baudrate_e.append('<option value="' + blackboxBaudRates[i] + '">' + blackboxBaudRates[i] + '</option>');
|
blackbox_baudrate_e.append('<option value="' + blackboxBaudRates[i] + '">' + blackboxBaudRates[i] + '</option>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let lastVtxControlSelected;
|
||||||
var ports_e = $('.tab-ports .ports');
|
var ports_e = $('.tab-ports .ports');
|
||||||
var port_configuration_template_e = $('#tab-ports-templates .portConfiguration');
|
var port_configuration_template_e = $('#tab-ports-templates .portConfiguration');
|
||||||
|
|
||||||
|
@ -259,6 +260,10 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
if (serialPort.functions.indexOf(functionName) >= 0) {
|
if (serialPort.functions.indexOf(functionName) >= 0) {
|
||||||
select_e.val(functionName);
|
select_e.val(functionName);
|
||||||
|
|
||||||
|
if (column === 'peripherals' && (functionName === "TBS_SMARTAUDIO" || functionName === "IRC_TRAMP")) {
|
||||||
|
lastVtxControlSelected = functionName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (column === 'telemetry') {
|
if (column === 'telemetry') {
|
||||||
|
@ -279,30 +284,42 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
ports_e.find('tbody').append(port_configuration_e);
|
ports_e.find('tbody').append(port_configuration_e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let vtxTableNotConfigured = true;
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||||
var vtxTableNotConfigured = VTX_CONFIG.vtx_table_available &&
|
vtxTableNotConfigured = VTX_CONFIG.vtx_table_available &&
|
||||||
(VTX_CONFIG.vtx_table_bands == 0 ||
|
(VTX_CONFIG.vtx_table_bands == 0 ||
|
||||||
VTX_CONFIG.vtx_table_channels == 0 ||
|
VTX_CONFIG.vtx_table_channels == 0 ||
|
||||||
VTX_CONFIG.vtx_table_powerlevels == 0);
|
VTX_CONFIG.vtx_table_powerlevels == 0);
|
||||||
|
} else {
|
||||||
|
$('.vtxTableNotSet').hide();
|
||||||
|
}
|
||||||
|
|
||||||
const pheripheralsSelectElement = $('select[name="function-peripherals"]');
|
const pheripheralsSelectElement = $('select[name="function-peripherals"]');
|
||||||
pheripheralsSelectElement.change(function() {
|
pheripheralsSelectElement.change(function() {
|
||||||
let vtxControlSelected = false;
|
let vtxControlSelected = undefined;
|
||||||
pheripheralsSelectElement.each(function() {
|
pheripheralsSelectElement.each(function() {
|
||||||
const el = $(this);
|
const el = $(this);
|
||||||
if (el.val() == "TBS_SMARTAUDIO" || el.val() == "IRC_TRAMP") {
|
if (el.val() === "TBS_SMARTAUDIO" || el.val() === "IRC_TRAMP") {
|
||||||
vtxControlSelected = true;
|
vtxControlSelected = el.val();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (lastVtxControlSelected !== vtxControlSelected) {
|
||||||
|
self.analyticsChanges['VtxControl'] = vtxControlSelected;
|
||||||
|
|
||||||
|
lastVtxControlSelected = vtxControlSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||||
if (vtxControlSelected && vtxTableNotConfigured) {
|
if (vtxControlSelected && vtxTableNotConfigured) {
|
||||||
$('.vtxTableNotSet').show();
|
$('.vtxTableNotSet').show();
|
||||||
} else {
|
} else {
|
||||||
$('.vtxTableNotSet').hide();
|
$('.vtxTableNotSet').hide();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
pheripheralsSelectElement.change();
|
pheripheralsSelectElement.change();
|
||||||
} else {
|
|
||||||
$('.vtxTableNotSet').hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_tab_loaded_handler() {
|
function on_tab_loaded_handler() {
|
||||||
|
|
|
@ -8,14 +8,18 @@ TABS.vtx = {
|
||||||
MAX_BAND_CHANNELS_VALUES: 8,
|
MAX_BAND_CHANNELS_VALUES: 8,
|
||||||
VTXTABLE_BAND_LIST: [],
|
VTXTABLE_BAND_LIST: [],
|
||||||
VTXTABLE_POWERLEVEL_LIST: [],
|
VTXTABLE_POWERLEVEL_LIST: [],
|
||||||
|
analyticsChanges: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.vtx.initialize = function (callback) {
|
TABS.vtx.initialize = function (callback) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
if (GUI.active_tab != 'vtx') {
|
if (GUI.active_tab != 'vtx') {
|
||||||
GUI.active_tab = 'vtx';
|
GUI.active_tab = 'vtx';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.analyticsChanges = {};
|
||||||
|
|
||||||
this.supported = semver.gte(CONFIG.apiVersion, "1.42.0");
|
this.supported = semver.gte(CONFIG.apiVersion, "1.42.0");
|
||||||
|
|
||||||
if (!this.supported) {
|
if (!this.supported) {
|
||||||
|
@ -304,6 +308,13 @@ TABS.vtx.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#vtx_table_channels").on('input', showHideBandChannels).trigger('input');
|
$("#vtx_table_channels").on('input', showHideBandChannels).trigger('input');
|
||||||
|
$("#vtx_table").change(function() {
|
||||||
|
let fromScratch = true;
|
||||||
|
if (self.analyticsChanges['VtxTableLoadFromClipboard'] !== undefined || self.analyticsChanges['VtxTableLoadFromFile'] !== undefined) {
|
||||||
|
fromScratch = false;
|
||||||
|
}
|
||||||
|
self.analyticsChanges['VtxTableEdit'] = fromScratch ? 'modificationOnly' : 'fromTemplate';
|
||||||
|
});
|
||||||
|
|
||||||
/*** Helper functions */
|
/*** Helper functions */
|
||||||
|
|
||||||
|
@ -527,19 +538,19 @@ TABS.vtx.initialize = function (callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
writer.onwriteend = function() {
|
writer.onwriteend = function() {
|
||||||
|
|
||||||
// we get here at the end of the truncate method, change to the new end
|
|
||||||
writer.onwriteend = function() {
|
|
||||||
console.log('Write VTX file end');
|
|
||||||
GUI.log(i18n.getMessage('vtxSavedFileOk'));
|
|
||||||
}
|
|
||||||
|
|
||||||
dump_html_to_msp();
|
dump_html_to_msp();
|
||||||
let vtxConfig = createVtxConfigInfo();
|
let vtxConfig = createVtxConfigInfo();
|
||||||
let text = JSON.stringify(vtxConfig, null, 4);
|
let text = JSON.stringify(vtxConfig, null, 4);
|
||||||
let data = new Blob([text], { type: "application/json" });
|
let data = new Blob([text], { type: "application/json" });
|
||||||
writer.write(data);
|
|
||||||
|
|
||||||
|
// we get here at the end of the truncate method, change to the new end
|
||||||
|
writer.onwriteend = function() {
|
||||||
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'VtxTableSave', text.length);
|
||||||
|
console.log('Write VTX file end');
|
||||||
|
GUI.log(i18n.getMessage('vtxSavedFileOk'));
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.write(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
writer.truncate(0);
|
writer.truncate(0);
|
||||||
|
@ -584,6 +595,9 @@ TABS.vtx.initialize = function (callback) {
|
||||||
|
|
||||||
TABS.vtx.vtxTableSavePending = true;
|
TABS.vtx.vtxTableSavePending = true;
|
||||||
|
|
||||||
|
self.analyticsChanges['VtxTableLoadFromClipboard'] = undefined;
|
||||||
|
self.analyticsChanges['VtxTableLoadFromFile'] = file.name;
|
||||||
|
|
||||||
console.log('Load VTX file end');
|
console.log('Load VTX file end');
|
||||||
GUI.log(i18n.getMessage('vtxLoadFileOk'));
|
GUI.log(i18n.getMessage('vtxLoadFileOk'));
|
||||||
|
|
||||||
|
@ -616,6 +630,9 @@ TABS.vtx.initialize = function (callback) {
|
||||||
|
|
||||||
TABS.vtx.vtxTableSavePending = true;
|
TABS.vtx.vtxTableSavePending = true;
|
||||||
|
|
||||||
|
self.analyticsChanges['VtxTableLoadFromFile'] = undefined;
|
||||||
|
self.analyticsChanges['VtxTableLoadFromClipboard'] = text.length;
|
||||||
|
|
||||||
console.log('Load VTX clipboard end');
|
console.log('Load VTX clipboard end');
|
||||||
GUI.log(i18n.getMessage('vtxLoadClipboardOk'));
|
GUI.log(i18n.getMessage('vtxLoadClipboardOk'));
|
||||||
|
|
||||||
|
@ -640,6 +657,8 @@ TABS.vtx.initialize = function (callback) {
|
||||||
// Start MSP saving
|
// Start MSP saving
|
||||||
save_vtx_config();
|
save_vtx_config();
|
||||||
|
|
||||||
|
analytics.sendChangeEvents(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, self.analyticsChanges);
|
||||||
|
|
||||||
function save_vtx_config() {
|
function save_vtx_config() {
|
||||||
MSP.send_message(MSPCodes.MSP_SET_VTX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_VTX_CONFIG), false, save_vtx_powerlevels);
|
MSP.send_message(MSPCodes.MSP_SET_VTX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_VTX_CONFIG), false, save_vtx_powerlevels);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
<div i18n="vtxMessageVerifyTable"/>
|
<div i18n="vtxMessageVerifyTable"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gui_box grey vtx_table_box vtx_table_available">
|
<div id="vtx_table" class="gui_box grey vtx_table_box vtx_table_available">
|
||||||
|
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" i18n="vtxTable"></div>
|
<div class="spacer_box_title" i18n="vtxTable"></div>
|
||||||
|
|
Loading…
Reference in New Issue