Merge remote-tracking branch 'origin/master' into sh_mixer_profile
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 20 KiB |
@ -0,0 +1,32 @@
|
||||
.ez-tune-preview {
|
||||
background-color: #8ecae6;
|
||||
margin-left: 1em;
|
||||
margin-bottom: 1em;
|
||||
min-width: 25%;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
.ez-tune-preview h2 {
|
||||
font-size: 1.3em;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 0.5em;
|
||||
color: #303030
|
||||
}
|
||||
|
||||
.ez-tune-preview table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ez-tune-preview table td,
|
||||
.ez-tune-preview table th {
|
||||
padding: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ez-tune-preview table th {
|
||||
background-color: #3EA5D4;
|
||||
}
|
||||
|
||||
.ez-tune-preview table td {
|
||||
background-color: #A8D6EC;
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
<!--suppress ALL -->
|
||||
<div id="content-watermark"></div>
|
||||
<div class="tab-ez_tune toolbar_fixed_bottom">
|
||||
<div class="content_wrapper">
|
||||
<div class="tab_title" data-i18n="tabEzTune"></div>
|
||||
<div class="note spacebottom">
|
||||
<div class="note_spacer">
|
||||
<p i18n="ezTuneDisclaimer"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
<div style="display: flex;">
|
||||
|
||||
<div>
|
||||
|
||||
<div class="pid-sliders-axis" style="background-color: #2a9d8f;">
|
||||
<div style="padding: 1em;" data-i18n="ezTuneEnabledTips"></div>
|
||||
<div class="pid-switch-row">
|
||||
<span data-i18n="configurationFeatureEnabled" class="bold label"></span>
|
||||
<div class="checkbox no-border">
|
||||
<input id="ez_tune_enabled" type="checkbox" class="ez-element toggle" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div class="pid-sliders-axis" data-axis="roll">
|
||||
<div style="padding: 1em;" data-i18n="ezTuneFilterHzTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="ezTuneFilterHz" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_filter_hz" type="number" class="ez-element" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div class="pid-sliders-axis" data-axis="pitch">
|
||||
<div style="padding: 1em;" data-i18n="ezTuneAxisRatioTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
|
||||
<span data-i18n="ezTuneAxisRatio" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_axis_ratio" type="number" class="ez-element" />
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div style="padding: 1em;" data-i18n="ezTuneResponseTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="ezTuneResponse" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_response" type="number" class="ez-element" />
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div style="padding: 1em;" data-i18n="ezTuneDampingTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="ezTuneDamping" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_damping" type="number" class="ez-element" />
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div style="padding: 1em;" data-i18n="ezTuneStabilityTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="ezTuneStability" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_stability" type="number" class="ez-element" />
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div style="padding: 1em;" data-i18n="ezTuneAggressivenessTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="ezTuneAggressiveness" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_aggressiveness" type="number" class="ez-element" />
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pid-sliders-axis" data-axis="yaw">
|
||||
<div style="padding: 1em;" data-i18n="ezTuneRateTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="ezTuneRate" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_rate" type="number" class="ez-element" />
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div style="padding: 1em;" data-i18n="ezTuneExpoTips"></div>
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="ezTuneExpo" class="bold"></span>
|
||||
<div class="number no-border">
|
||||
<input id="ez_tune_expo" type="number" class="ez-element" />
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ez-tune-preview">
|
||||
<h2 data-i18n="ezTunePidPreview"></h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>P</th>
|
||||
<th>I</th>
|
||||
<th>D</th>
|
||||
<th>FF</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th data-i18n="axisRoll"></th>
|
||||
<td id="preview-roll-p"></td>
|
||||
<td id="preview-roll-i"></td>
|
||||
<td id="preview-roll-d"></td>
|
||||
<td id="preview-roll-ff"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th data-i18n="axisPitch"></th>
|
||||
<td id="preview-pitch-p"></td>
|
||||
<td id="preview-pitch-i"></td>
|
||||
<td id="preview-pitch-d"></td>
|
||||
<td id="preview-pitch-ff"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th data-i18n="axisYaw"></th>
|
||||
<td id="preview-yaw-p"></td>
|
||||
<td id="preview-yaw-i"></td>
|
||||
<td id="preview-yaw-d"></td>
|
||||
<td id="preview-yaw-ff"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2 data-i18n="ezTuneRatePreview"></h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th data-i18n="ezTuneRatePreviewAxis"></th>
|
||||
<th data-i18n="ezTuneRatePreviewRate"></th>
|
||||
<th data-i18n="ezTuneRatePreviewExpo"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th data-i18n="axisRoll"></th>
|
||||
<td id="preview-roll-rate"></td>
|
||||
<td id="preview-roll-expo"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th data-i18n="axisPitch"></th>
|
||||
<td id="preview-pitch-rate"></td>
|
||||
<td id="preview-pitch-expo"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th data-i18n="axisYaw"></th>
|
||||
<td id="preview-yaw-rate"></td>
|
||||
<td id="preview-yaw-expo"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
<div class="content_toolbar">
|
||||
<div class="btn save_btn">
|
||||
<a class="update" href="#" data-i18n="pidTuning_ButtonSave"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,161 @@
|
||||
/*global chrome,helper,mspHelper*/
|
||||
'use strict';
|
||||
|
||||
TABS.ez_tune = {
|
||||
|
||||
};
|
||||
|
||||
TABS.ez_tune.initialize = function (callback) {
|
||||
|
||||
let loadChainer = new MSPChainerClass();
|
||||
|
||||
let loadChain = [
|
||||
mspHelper.loadEzTune,
|
||||
];
|
||||
|
||||
let EZ_TUNE_PID_RP_DEFAULT = [40, 75, 23, 100];
|
||||
let EZ_TUNE_PID_YAW_DEFAULT = [45, 80, 0, 100];
|
||||
|
||||
loadChain.push(mspHelper.loadRateProfileData);
|
||||
|
||||
loadChainer.setChain(loadChain);
|
||||
loadChainer.setExitPoint(load_html);
|
||||
loadChainer.execute();
|
||||
|
||||
var saveChainer = new MSPChainerClass();
|
||||
|
||||
var saveChain = [
|
||||
mspHelper.saveEzTune,
|
||||
mspHelper.saveToEeprom
|
||||
];
|
||||
|
||||
saveChainer.setChain(saveChain);
|
||||
saveChainer.setExitPoint(reboot);
|
||||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
}
|
||||
|
||||
function reinitialize() {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_ez_tune a'));
|
||||
}
|
||||
|
||||
if (GUI.active_tab != 'ez_tune') {
|
||||
GUI.active_tab = 'ez_tune';
|
||||
googleAnalytics.sendAppView('Ez Tune');
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/ez_tune.html", Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
function getYawPidScale(input) {
|
||||
const normalized = (input - 100) * 0.01;
|
||||
|
||||
return 1.0 + (normalized * 0.5);
|
||||
}
|
||||
|
||||
function scaleRange(x, srcMin, srcMax, destMin, destMax) {
|
||||
let a = (destMax - destMin) * (x - srcMin);
|
||||
let b = srcMax - srcMin;
|
||||
return ((a / b) + destMin);
|
||||
}
|
||||
|
||||
function updatePreview() {
|
||||
|
||||
let axisRatio = $('#ez_tune_axis_ratio').val() / 100;
|
||||
let response = $('#ez_tune_response').val();
|
||||
let damping = $('#ez_tune_damping').val();
|
||||
let stability = $('#ez_tune_stability').val();
|
||||
let aggressiveness = $('#ez_tune_aggressiveness').val();
|
||||
let rate = $('#ez_tune_rate').val();
|
||||
let expo = $('#ez_tune_expo').val();
|
||||
|
||||
$('#preview-roll-p').html(Math.floor(EZ_TUNE_PID_RP_DEFAULT[0] * response / 100));
|
||||
$('#preview-roll-i').html(Math.floor(EZ_TUNE_PID_RP_DEFAULT[1] * stability / 100));
|
||||
$('#preview-roll-d').html(Math.floor(EZ_TUNE_PID_RP_DEFAULT[2] * damping / 100));
|
||||
$('#preview-roll-ff').html(Math.floor(EZ_TUNE_PID_RP_DEFAULT[3] * aggressiveness / 100));
|
||||
|
||||
$('#preview-pitch-p').html(Math.floor(axisRatio * EZ_TUNE_PID_RP_DEFAULT[0] * response / 100));
|
||||
$('#preview-pitch-i').html(Math.floor(axisRatio * EZ_TUNE_PID_RP_DEFAULT[1] * stability / 100));
|
||||
$('#preview-pitch-d').html(Math.floor(axisRatio * EZ_TUNE_PID_RP_DEFAULT[2] * damping / 100));
|
||||
$('#preview-pitch-ff').html(Math.floor(axisRatio * EZ_TUNE_PID_RP_DEFAULT[3] * aggressiveness / 100));
|
||||
|
||||
$('#preview-yaw-p').html(Math.floor(EZ_TUNE_PID_YAW_DEFAULT[0] * getYawPidScale(response)));
|
||||
$('#preview-yaw-i').html(Math.floor(EZ_TUNE_PID_YAW_DEFAULT[1] * getYawPidScale(stability)));
|
||||
$('#preview-yaw-d').html(Math.floor(EZ_TUNE_PID_YAW_DEFAULT[2] * getYawPidScale(damping)));
|
||||
$('#preview-yaw-ff').html(Math.floor(EZ_TUNE_PID_YAW_DEFAULT[3] * getYawPidScale(aggressiveness)));
|
||||
|
||||
$('#preview-roll-rate').html(Math.floor(scaleRange(rate, 0, 200, 30, 90)) * 10 + " dps");
|
||||
$('#preview-pitch-rate').html(Math.floor(scaleRange(rate, 0, 200, 30, 90)) * 10 + " dps");
|
||||
$('#preview-yaw-rate').html((Math.floor(scaleRange(rate, 0, 200, 30, 90)) - 10) * 10 + " dps");
|
||||
|
||||
$('#preview-roll-expo').html(Math.floor(scaleRange(expo, 0, 200, 40, 100)) + "%");
|
||||
$('#preview-pitch-expo').html(Math.floor(scaleRange(expo, 0, 200, 40, 100)) + "%");
|
||||
$('#preview-yaw-expo').html(Math.floor(scaleRange(expo, 0, 200, 40, 100)) + "%");
|
||||
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
localize();
|
||||
|
||||
helper.tabs.init($('.tab-ez_tune'));
|
||||
helper.features.updateUI($('.tab-ez_tune'), FEATURES);
|
||||
|
||||
$("#ez_tune_enabled").prop('checked', EZ_TUNE.enabled);
|
||||
|
||||
GUI.sliderize($('#ez_tune_filter_hz'), EZ_TUNE.filterHz, 10, 300);
|
||||
GUI.sliderize($('#ez_tune_axis_ratio'), EZ_TUNE.axisRatio, 25, 175);
|
||||
GUI.sliderize($('#ez_tune_response'), EZ_TUNE.response, 0, 200);
|
||||
GUI.sliderize($('#ez_tune_damping'), EZ_TUNE.damping, 0, 200);
|
||||
GUI.sliderize($('#ez_tune_stability'), EZ_TUNE.stability, 0, 200);
|
||||
GUI.sliderize($('#ez_tune_aggressiveness'), EZ_TUNE.aggressiveness, 0, 200);
|
||||
|
||||
GUI.sliderize($('#ez_tune_rate'), EZ_TUNE.rate, 0, 200);
|
||||
GUI.sliderize($('#ez_tune_expo'), EZ_TUNE.expo, 0, 200);
|
||||
|
||||
|
||||
$('.ez-element').on('updated', function () {
|
||||
updatePreview();
|
||||
});
|
||||
|
||||
updatePreview();
|
||||
|
||||
GUI.simpleBind();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
||||
$('a.update').on('click', function () {
|
||||
|
||||
if ($("#ez_tune_enabled").is(":checked")) {
|
||||
EZ_TUNE.enabled = 1;
|
||||
} else {
|
||||
EZ_TUNE.enabled = 0;
|
||||
}
|
||||
|
||||
EZ_TUNE.filterHz = $('#ez_tune_filter_hz').val();
|
||||
EZ_TUNE.axisRatio = $('#ez_tune_axis_ratio').val();
|
||||
EZ_TUNE.response = $('#ez_tune_response').val();
|
||||
EZ_TUNE.damping = $('#ez_tune_damping').val();
|
||||
EZ_TUNE.stability = $('#ez_tune_stability').val();
|
||||
EZ_TUNE.aggressiveness = $('#ez_tune_aggressiveness').val();
|
||||
EZ_TUNE.rate = $('#ez_tune_rate').val();
|
||||
EZ_TUNE.expo = $('#ez_tune_expo').val();
|
||||
|
||||
saveChainer.execute();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
TABS.ez_tune.cleanup = function (callback) {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
};
|