mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 17:25:14 +03:00
Remove Profiles tab
This commit is contained in:
parent
1d5b7808d5
commit
4e9825a1e5
6 changed files with 0 additions and 1569 deletions
|
@ -2411,24 +2411,6 @@
|
||||||
"tabMixer": {
|
"tabMixer": {
|
||||||
"message": "Mixer"
|
"message": "Mixer"
|
||||||
},
|
},
|
||||||
"tabPresets": {
|
|
||||||
"message": "Presets"
|
|
||||||
},
|
|
||||||
"presetsPreset": {
|
|
||||||
"message": "Preset"
|
|
||||||
},
|
|
||||||
"presetsDescription": {
|
|
||||||
"message": "Description"
|
|
||||||
},
|
|
||||||
"presetsButtonApply": {
|
|
||||||
"message": "Apply"
|
|
||||||
},
|
|
||||||
"presetApplyTitle" : {
|
|
||||||
"message": "Confirm"
|
|
||||||
},
|
|
||||||
"presetsButtonSaveAndReboot": {
|
|
||||||
"message": "Save and reboot"
|
|
||||||
},
|
|
||||||
"presetsApplyHeader": {
|
"presetsApplyHeader": {
|
||||||
"message": "Warning"
|
"message": "Warning"
|
||||||
},
|
},
|
||||||
|
|
|
@ -112,7 +112,6 @@ sources.js = [
|
||||||
'./js/vtx.js',
|
'./js/vtx.js',
|
||||||
'./main.js',
|
'./main.js',
|
||||||
'./js/tabs.js',
|
'./js/tabs.js',
|
||||||
'./js/preset_definitions.js',
|
|
||||||
'./tabs/*.js',
|
'./tabs/*.js',
|
||||||
'./js/eventFrequencyAnalyzer.js',
|
'./js/eventFrequencyAnalyzer.js',
|
||||||
'./js/periodicStatusUpdater.js',
|
'./js/periodicStatusUpdater.js',
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -195,9 +195,6 @@
|
||||||
<li class="tab_outputs">
|
<li class="tab_outputs">
|
||||||
<a href="#" data-i18n="tabOutputs" class="tabicon ic_motor" title="Outputs"></a>
|
<a href="#" data-i18n="tabOutputs" class="tabicon ic_motor" title="Outputs"></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="tab_profiles">
|
|
||||||
<a href="#" data-i18n="tabPresets" class="tabicon ic_wizzard" title="Presets"></a>
|
|
||||||
</li>
|
|
||||||
<li class="tab_ports">
|
<li class="tab_ports">
|
||||||
<a href="#" data-i18n="tabPorts" class="tabicon ic_ports" title="Ports"></a>
|
<a href="#" data-i18n="tabPorts" class="tabicon ic_ports" title="Ports"></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<div class="tab-configuration tab-profiles toolbar_fixed_bottom">
|
|
||||||
<div class="content_wrapper">
|
|
||||||
<div class="tab_title" data-i18n="tabPresets">Presets</div>
|
|
||||||
<div class="cf_column full">
|
|
||||||
<div class="gui_box grey">
|
|
||||||
<div class="cf_column fourth preset__list-wrapper">
|
|
||||||
<div class="select">
|
|
||||||
<ul id="presets-list" class="full-width list-menu">
|
|
||||||
<!-- list generated here -->
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="threefourth_left preset">
|
|
||||||
<div class="preset-spacer top">
|
|
||||||
<div id="preset-image"></div>
|
|
||||||
<h2 id="preset-name" class="preset__head"></h2>
|
|
||||||
<div id="preset-info" data-i18n="presetApplyDescription"></div>
|
|
||||||
<p id="preset-description" class="preset__description"></p>
|
|
||||||
</div>
|
|
||||||
<div class="preset-spacer bottom">
|
|
||||||
<div id="details-head"><p data-i18n="presetApplyHead"></p></div>
|
|
||||||
<ul id="preset-features" class="preset__features"></ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="presetApplyContent" class="is-hidden">
|
|
||||||
<div class="modal__content">
|
|
||||||
<h1 class="modal__title modal__title--warning" data-i18n="presetsApplyHeader"></h1>
|
|
||||||
<div class="modal__text" data-i18n="presetApplyDescription"></div>
|
|
||||||
</div>
|
|
||||||
<div class="modal__buttons">
|
|
||||||
<a id="execute-button" class="modal__button modal__button--main" data-i18n="presetsButtonSaveAndReboot"></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="clear-both"></div>
|
|
||||||
</div>
|
|
||||||
<div class="content_toolbar">
|
|
||||||
<div class="btn save_btn">
|
|
||||||
<a id="save-button" class="save disabled" href="#" data-i18n="presetsButtonApply"></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
223
tabs/profiles.js
223
tabs/profiles.js
|
@ -1,223 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var presets = presets || {};
|
|
||||||
|
|
||||||
presets.model = (function () {
|
|
||||||
|
|
||||||
var self = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Array} toApply
|
|
||||||
* @param {Object} defaults
|
|
||||||
* @param {String} mixerType
|
|
||||||
*/
|
|
||||||
self.applyDefaults = function (toApply, defaults, mixerType) {
|
|
||||||
|
|
||||||
for (var settingToApply in toApply) {
|
|
||||||
if (toApply.hasOwnProperty(settingToApply)) {
|
|
||||||
|
|
||||||
var settingName = toApply[settingToApply],
|
|
||||||
values = defaults[settingName];
|
|
||||||
|
|
||||||
for (var key in values) {
|
|
||||||
if (values.hasOwnProperty(key)) {
|
|
||||||
window[settingName][key] = values[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mixerType == 'airplane' || mixerType == 'flyingwing') {
|
|
||||||
// Always set MOTOR_STOP and feature AIRMODE for fixed wing
|
|
||||||
window.BF_CONFIG.features |= 1 << 4; // MOTOR_STOP
|
|
||||||
window.BF_CONFIG.features |= 1 << 22; // AIRMODE
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self.extractPresetNames = function (presets) {
|
|
||||||
|
|
||||||
var retVal = {};
|
|
||||||
|
|
||||||
for (var i in presets) {
|
|
||||||
if (presets.hasOwnProperty(i)) {
|
|
||||||
retVal[i] = presets[i].name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
};
|
|
||||||
|
|
||||||
return self;
|
|
||||||
})();
|
|
||||||
|
|
||||||
TABS.profiles = {};
|
|
||||||
|
|
||||||
TABS.profiles.initialize = function (callback, scrollPosition) {
|
|
||||||
|
|
||||||
var currentPreset,
|
|
||||||
currentPresetId,
|
|
||||||
loadChainer = new MSPChainerClass(),
|
|
||||||
saveChainer = new MSPChainerClass();
|
|
||||||
|
|
||||||
if (GUI.active_tab != 'profiles') {
|
|
||||||
GUI.active_tab = 'profiles';
|
|
||||||
googleAnalytics.sendAppView('Presets');
|
|
||||||
}
|
|
||||||
|
|
||||||
loadChainer.setChain([
|
|
||||||
mspHelper.loadBfConfig,
|
|
||||||
mspHelper.loadLoopTime,
|
|
||||||
mspHelper.loadINAVPidConfig,
|
|
||||||
mspHelper.loadAdvancedConfig,
|
|
||||||
mspHelper.loadFilterConfig,
|
|
||||||
mspHelper.loadPidAdvanced,
|
|
||||||
mspHelper.loadRcTuningData,
|
|
||||||
mspHelper.loadPidData,
|
|
||||||
mspHelper.loadMixerConfig
|
|
||||||
]);
|
|
||||||
loadChainer.setExitPoint(loadHtml);
|
|
||||||
loadChainer.execute();
|
|
||||||
|
|
||||||
saveChainer.setChain([
|
|
||||||
mspHelper.saveBfConfig,
|
|
||||||
mspHelper.saveMixerConfig,
|
|
||||||
mspHelper.saveINAVPidConfig,
|
|
||||||
mspHelper.saveLooptimeConfig,
|
|
||||||
mspHelper.saveAdvancedConfig,
|
|
||||||
mspHelper.saveFilterConfig,
|
|
||||||
mspHelper.savePidData,
|
|
||||||
mspHelper.saveRcTuningData,
|
|
||||||
mspHelper.savePidAdvanced
|
|
||||||
]);
|
|
||||||
saveChainer.setExitPoint(applySettings);
|
|
||||||
|
|
||||||
function loadHtml() {
|
|
||||||
GUI.load("./tabs/profiles.html", processHtml);
|
|
||||||
}
|
|
||||||
|
|
||||||
function applySettings() {
|
|
||||||
if (currentPreset.settings && currentPreset.settings.length > 0) {
|
|
||||||
Promise.mapSeries(currentPreset.settings, function (input, ii) {
|
|
||||||
return mspHelper.getSetting(input.key);
|
|
||||||
}).then(function () {
|
|
||||||
Promise.mapSeries(currentPreset.settings, function (input, ii) {
|
|
||||||
console.log('applying', input.key, input.value);
|
|
||||||
return mspHelper.setSetting(input.key, input.value);
|
|
||||||
}).then(function () {
|
|
||||||
mspHelper.saveToEeprom(function () {
|
|
||||||
//noinspection JSUnresolvedVariable
|
|
||||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
|
||||||
|
|
||||||
GUI.tab_switch_cleanup(function() {
|
|
||||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
|
||||||
//noinspection JSUnresolvedVariable
|
|
||||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
|
||||||
GUI.handleReconnect();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyAndSave() {
|
|
||||||
|
|
||||||
presets.model.applyDefaults(currentPreset.applyDefaults, presets.defaultValues, currentPreset.type);
|
|
||||||
|
|
||||||
var setting;
|
|
||||||
|
|
||||||
//Iterate over settings saved in preset
|
|
||||||
for (let i in currentPreset.settingsMSP) {
|
|
||||||
if (currentPreset.settingsMSP.hasOwnProperty(i)) {
|
|
||||||
setting = currentPreset.settingsMSP[i];
|
|
||||||
//Apply setting
|
|
||||||
window[setting.group][setting.field] = setting.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var promises = {};
|
|
||||||
var settings = presets.settings.get(currentPreset.type);
|
|
||||||
Object.keys(settings).forEach(function(key, ii) {
|
|
||||||
var value = settings[key];
|
|
||||||
promises[key] = mspHelper.setSetting(name, value);
|
|
||||||
});
|
|
||||||
Promise.props(promises).then(function () {
|
|
||||||
saveChainer.execute();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function fillPresetDescription(preset) {
|
|
||||||
|
|
||||||
var $features = $('#preset-features');
|
|
||||||
|
|
||||||
$('#preset-image').html('<div class="' + preset.type + '"></div>');
|
|
||||||
$('#preset-name').html(preset.name);
|
|
||||||
$('#preset-description').html(preset.description);
|
|
||||||
document.getElementById('preset-info').style.display = "none";
|
|
||||||
document.getElementById('details-head').style.display = "block";
|
|
||||||
|
|
||||||
|
|
||||||
$features.find('*').remove();
|
|
||||||
|
|
||||||
for (var i in preset.features) {
|
|
||||||
if (preset.features.hasOwnProperty(i)) {
|
|
||||||
$features.append('<li class="preset__feature"><span class="preset__feature-text">' + preset.features[i] + "</span></li>");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function processHtml() {
|
|
||||||
var modal;
|
|
||||||
var $presetList = $('#presets-list');
|
|
||||||
|
|
||||||
var presetsList = presets.model.extractPresetNames(presets.presets);
|
|
||||||
|
|
||||||
for (var preset in presetsList) {
|
|
||||||
if (presetsList.hasOwnProperty(preset)) {
|
|
||||||
$presetList.append('<li class="preset__element-wrapper"><a href="#" class="preset__element-link" data-val="' + preset + '">' + presetsList[preset] + '</a></li>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$('.preset__element-link').click(function () {
|
|
||||||
currentPresetId = $(this).data('val');
|
|
||||||
currentPreset = presets.presets[currentPresetId];
|
|
||||||
fillPresetDescription(currentPreset);
|
|
||||||
|
|
||||||
$presetList.find('li').removeClass('active');
|
|
||||||
$(this).parent().addClass('active');
|
|
||||||
|
|
||||||
$('#save-button').removeClass('disabled');
|
|
||||||
|
|
||||||
googleAnalytics.sendEvent('Presets', 'Displayed', currentPreset.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#execute-button').click(function () {
|
|
||||||
applyAndSave();
|
|
||||||
modal.close();
|
|
||||||
|
|
||||||
googleAnalytics.sendEvent('Presets', 'Applied', currentPreset.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
localize();
|
|
||||||
|
|
||||||
//noinspection JSValidateTypes
|
|
||||||
$('#content').scrollTop((scrollPosition) ? scrollPosition : 0);
|
|
||||||
|
|
||||||
modal = new jBox('Modal', {
|
|
||||||
width: 600,
|
|
||||||
height: 240,
|
|
||||||
closeButton: 'title',
|
|
||||||
animation: false,
|
|
||||||
attach: $('#save-button'),
|
|
||||||
title: chrome.i18n.getMessage("presetApplyTitle"),
|
|
||||||
content: $('#presetApplyContent')
|
|
||||||
});
|
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
TABS.profiles.cleanup = function (callback) {
|
|
||||||
if (callback) callback();
|
|
||||||
};
|
|
Loading…
Add table
Add a link
Reference in a new issue