final touches for async support

pull/75/head
Pawel Spychalski (DzikuVx) 8 years ago
parent 026edebe88
commit 771be944d9

@ -693,9 +693,6 @@
"configurationCalculatedCyclesSec": {
"message": "Cycles/Sec (Hz)"
},
"configurationLoopTimeHelp": {
"message": "<strong>Note:</strong> Changing this may require PID re-tuning."
},
"configurationGPS": {
"message": "GPS"
},
@ -1822,5 +1819,23 @@
},
"configurationAttitudeFrequencyTitle": {
"message": "Attitude task frequency"
},
"configurationGyroLpfHelp": {
"message": "Hardware based cutoff frequency for gyroscope. In general, bigger value is better but makes UAV more sensitive to vibrations"
},
"configurationAsyncModeHelp": {
"message": "See Firmware \"Looptime\" documentation for details"
},
"configurationGyroFrequencyHelp": {
"message": "In general, higher value is better but makes UAV more sensitive to vibrations. Should be kept above 'Flight Controller Loop Time' frequency. Maximal practical value is hardware dependant. If set too high, board might not run properly. Observe CPU usage."
},
"configurationAccelerometerFrequencyHelp": {
"message": "For Acro purposes, this value can be lowered from default"
},
"configurationAttitudeFrequencyHelp": {
"message": "For Acro purposes, this value can be lowered from default"
},
"configurationLoopTimeHelp": {
"message": "In general, higher value is better. With asynchronous gyroscope, should be kept below gyro update frequency. Maximal practical value is hardware dependant. If set too high, board might not run properly. Observe CPU usage."
}
}

@ -193,9 +193,16 @@
</div>
<div class="spacer_box">
<div class="select requires-v1_4">
<select id="gyro-lpf"></select>
<label for="gyro-lpf"> <span data-i18n="configurationGyroLpfTitle"></span></label>
<div class="helpicon cf_tip" data-i18n_title="configurationGyroLpfHelp"></div>
</div>
<div class="select requires-v1_4">
<select id="async-mode"></select>
<label for="async-mode"> <span data-i18n="configurationAsyncMode"></span></label>
<div class="helpicon cf_tip" data-i18n_title="configurationAsyncModeHelp"></div>
</div>
<div id="gyro-sync-wrapper" class="checkbox requires-v1_4">
@ -210,6 +217,7 @@
<label for="gyro-frequency">
<span data-i18n="configurationGyroFrequencyTitle"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="configurationGyroFrequencyHelp"></div>
</div>
<div id="accelerometer-frequency-wrapper" class="checkbox requires-v1_4">
@ -217,6 +225,7 @@
<label for="accelerometer-frequency">
<span data-i18n="configurationAccelerometerFrequencyTitle"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="configurationAccelerometerFrequencyHelp"></div>
</div>
<div id="attitude-frequency-wrapper" class="checkbox requires-v1_4">
@ -224,11 +233,7 @@
<label for="attitude-frequency">
<span data-i18n="configurationAttitudeFrequencyTitle"></span>
</label>
</div>
<div class="select requires-v1_4">
<select id="gyro-lpf"></select>
<label for="gyro-lpf"> <span data-i18n="configurationGyroLpfTitle"></span></label>
<div class="helpicon cf_tip" data-i18n_title="configurationAttitudeFrequencyHelp"></div>
</div>
<div class="select">
@ -236,6 +241,7 @@
<label for="looptime">
<span data-i18n="configurationLoopTime"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="configurationLoopTimeHelp"></div>
</div>
</div>
</div>

@ -356,17 +356,29 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
var $looptime = $("#looptime");
if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
//TODO move this up and use in more places
var fillSelect = function ($element, values, currentValue, unit) {
if (unit == null) {
unit = '';
}
//TODO move this up and use in more places
var fillSelect = function ($element, values) {
for (i in values) {
if (values.hasOwnProperty(i)) {
$element.append('<option value="' + i + '">' + values[i] + '</option>');
}
$element.find("*").remove();
for (i in values) {
if (values.hasOwnProperty(i)) {
$element.append('<option value="' + i + '">' + values[i] + '</option>');
}
};
}
/*
* If current Value is not on the list, add a new entry
*/
if (currentValue != null && $element.find('[value="' + currentValue + '"]').length == 0) {
$element.append('<option value="' + currentValue + '">' + currentValue + unit + '</option>');
}
};
if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
$(".requires-v1_4").show();
var $gyroLpf = $("#gyro-lpf"),
@ -376,9 +388,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$accelerometerFrequency = $('#accelerometer-frequency'),
$attitudeFrequency = $('#attitude-frequency');
for (i in FC.getGyroLpfValues()) {
if (FC.getGyroLpfValues().hasOwnProperty(i)) {
$gyroLpf.append('<option value="' + i + '">' + FC.getGyroLpfValues()[i].label + '</option>');
var values = FC.getGyroLpfValues();
for (i in values) {
if (values.hasOwnProperty(i)) {
//noinspection JSUnfilteredForInLoop
$gyroLpf.append('<option value="' + i + '">' + values[i].label + '</option>');
}
}
@ -386,25 +401,20 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$gyroSync.prop("checked", ADVANCED_CONFIG.gyroSync);
$gyroLpf.change(function () {
var i,
looptimeOptions;
INAV_PID_CONFIG.gyroscopeLpf = $gyroLpf.val();
function fillSelect($element, values) {
$element.find("*").remove();
looptimeOptions = values[FC.getGyroLpfValues()[INAV_PID_CONFIG.gyroscopeLpf].tick];
for (i in looptimeOptions.looptimes) {
if (looptimeOptions.looptimes.hasOwnProperty(i)) {
$element.append('<option value="' + i + '">' + looptimeOptions.looptimes[i] + '</option>');
}
}
$element.val(looptimeOptions.defaultLooptime);
$element.change();
}
fillSelect($looptime, FC.getLooptimes());
fillSelect($gyroFrequency, FC.getGyroFrequencies());
fillSelect(
$looptime,
FC.getLooptimes()[FC.getGyroLpfValues()[INAV_PID_CONFIG.gyroscopeLpf].tick].looptimes,
FC_CONFIG.loopTime,
'Hz'
);
$looptime.val(FC.getLooptimes()[FC.getGyroLpfValues()[INAV_PID_CONFIG.gyroscopeLpf].tick].defaultLooptime);
$looptime.change();
fillSelect($gyroFrequency, FC.getGyroFrequencies()[FC.getGyroLpfValues()[INAV_PID_CONFIG.gyroscopeLpf].tick].looptimes);
$gyroFrequency.val(FC.getLooptimes()[FC.getGyroLpfValues()[INAV_PID_CONFIG.gyroscopeLpf].tick].defaultLooptime);
$gyroFrequency.change();
});
$gyroLpf.change();
@ -464,25 +474,21 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
});
$asyncMode.change();
fillSelect($accelerometerFrequency, FC.getAccelerometerTaskFrequencies());
fillSelect($accelerometerFrequency, FC.getAccelerometerTaskFrequencies(), INAV_PID_CONFIG.accelerometerTaskFrequency, 'Hz');
$accelerometerFrequency.val(INAV_PID_CONFIG.accelerometerTaskFrequency);
$accelerometerFrequency.change(function () {
INAV_PID_CONFIG.accelerometerTaskFrequency = $accelerometerFrequency.val();
});
fillSelect($attitudeFrequency, FC.getAttitudeTaskFrequencies());
fillSelect($attitudeFrequency, FC.getAttitudeTaskFrequencies(), INAV_PID_CONFIG.attitudeTaskFrequency, 'Hz');
$attitudeFrequency.val(INAV_PID_CONFIG.attitudeTaskFrequency);
$attitudeFrequency.change(function () {
INAV_PID_CONFIG.attitudeTaskFrequency = $attitudeFrequency.val();
});
} else {
var looptimeOptions = FC.getLooptimes()[125];
for (i in looptimeOptions.looptimes) {
if (looptimeOptions.looptimes.hasOwnProperty(i)) {
$looptime.append('<option value="' + i + '">' + looptimeOptions.looptimes[i] + '</option>');
}
}
fillSelect($looptime, FC.getLooptimes()[125].looptimes, FC_CONFIG.loopTime, 'Hz');
$looptime.val(FC_CONFIG.loopTime);
$looptime.change(function () {
FC_CONFIG.loopTime = $(this).val();

Loading…
Cancel
Save