mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
Merge pull request #67 from mikeller/fix_throttle_values_show_hide_pids
Made throttle rates display properly, made 'Show all PIDs' persist across tab reloads.
This commit is contained in:
commit
e5df05bc33
2 changed files with 34 additions and 16 deletions
|
@ -307,7 +307,7 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer_left topspacer">
|
<div class="spacer_left topspacer throttle">
|
||||||
<table class="tpa cf">
|
<table class="tpa cf">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -274,32 +274,36 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
FILTER_CONFIG.yaw_lpf_hz = parseInt($('.pid_tuning input[name="yaw"]').val());
|
FILTER_CONFIG.yaw_lpf_hz = parseInt($('.pid_tuning input[name="yaw"]').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideUnusedPids(sensors_detected) {
|
function showAllPids() {
|
||||||
|
$('.tab-pid_tuning .pid_tuning').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideUnusedPids() {
|
||||||
$('.tab-pid_tuning .pid_tuning').hide();
|
$('.tab-pid_tuning .pid_tuning').hide();
|
||||||
|
|
||||||
$('#pid_main').show();
|
$('#pid_main').show();
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier === "BTFL" || semver.ge(CONFIG.flightControllerVersion, "2.9.0")) {
|
if (CONFIG.flightControllerIdentifier === "BTFL" || semver.ge(CONFIG.flightControllerVersion, "2.9.0")) {
|
||||||
$('#pid_filter').show();
|
$('#pid_filter').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_sensor(sensors_detected, 'acc')) {
|
if (have_sensor(CONFIG.activeSensors, 'acc')) {
|
||||||
$('#pid_accel').show();
|
$('#pid_accel').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
var showTitle = false;
|
var showTitle = false;
|
||||||
if (have_sensor(sensors_detected, 'baro') ||
|
if (have_sensor(CONFIG.activeSensors, 'baro') ||
|
||||||
have_sensor(sensors_detected, 'sonar')) {
|
have_sensor(CONFIG.activeSensors, 'sonar')) {
|
||||||
$('#pid_baro').show();
|
$('#pid_baro').show();
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
}
|
}
|
||||||
if (have_sensor(sensors_detected, 'mag')) {
|
if (have_sensor(CONFIG.activeSensors, 'mag')) {
|
||||||
$('#pid_mag').show();
|
$('#pid_mag').show();
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
}
|
}
|
||||||
if (bit_check(BF_CONFIG.features, 7)) { //This will need to be reworked to remove BF_CONFIG reference eventually
|
if (bit_check(BF_CONFIG.features, 7)) { //This will need to be reworked to remove BF_CONFIG reference eventually
|
||||||
$('#pid_gps').show();
|
$('#pid_gps').show();
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showTitle) {
|
if (showTitle) {
|
||||||
|
@ -311,15 +315,29 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
||||||
hideUnusedPids(CONFIG.activeSensors);
|
var showAllButton = $('#showAllPids');
|
||||||
|
var showAllMsg = "Show all PIDs";
|
||||||
|
var hideUnusedMsg = "Hide unused PIDs";
|
||||||
|
|
||||||
|
if (!TABS.pid_tuning.showAllPids) {
|
||||||
|
hideUnusedPids();
|
||||||
|
showAllButton.text(showAllMsg);
|
||||||
|
} else {
|
||||||
|
showAllPids();
|
||||||
|
showAllButton.text(hideUnusedMsg);
|
||||||
|
}
|
||||||
|
|
||||||
$('#showAllPids').on('click', function(){
|
$('#showAllPids').on('click', function(){
|
||||||
if($(this).text() == "Show all PIDs") {
|
if($(this).text() == showAllMsg) {
|
||||||
$('.tab-pid_tuning .pid_tuning').show();
|
showAllPids();
|
||||||
$(this).text('Hide unused PIDs');
|
$(this).text(hideUnusedMsg);
|
||||||
|
|
||||||
|
TABS.pid_tuning.showAllPids = true;
|
||||||
} else {
|
} else {
|
||||||
hideUnusedPids(CONFIG.activeSensors);
|
hideUnusedPids();
|
||||||
$(this).text('Show all PIDs');
|
$(this).text(showAllMsg);
|
||||||
|
|
||||||
|
TABS.pid_tuning.showAllPids = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue