1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-21 15:25:22 +03:00

Added configuration for Dshot beacon activation conditions.

This commit is contained in:
mikeller 2018-06-11 00:55:21 +12:00
parent 7be361ae20
commit 26361bebad
7 changed files with 91 additions and 34 deletions

View file

@ -240,6 +240,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
var dshotBeacon_e = $('.tab-configuration .dshotbeacon');
var dshotBeeperSwitch = $('#dshotBeeperSwitch');
var dshotBeeperBeaconTone = $('select.dshotBeeperBeaconTone');
var dshotBeaconCondition_e = $('tbody.dshotBeaconConditions');
var dshotBeaconSwitch_e = $('tr.dshotBeaconSwitch');
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
for (var i = 1; i <= 5; i++) {
@ -250,27 +252,40 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
dshotBeeper_e.hide();
}
dshotBeeperSwitch.change(function() {
if ($(this).is(':checked')) {
dshotBeacon_e.show();
if (dshotBeeperBeaconTone.val() == 0) {
dshotBeeperBeaconTone.val(1).change();
}
} else {
dshotBeeperBeaconTone.val(0).change();
dshotBeacon_e.hide();
}
});
dshotBeeperBeaconTone.change(function() {
BEEPER_CONFIG.dshotBeaconTone = dshotBeeperBeaconTone.val();
});
dshotBeeperBeaconTone.val(BEEPER_CONFIG.dshotBeaconTone);
dshotBeeperSwitch.prop('checked', BEEPER_CONFIG.dshotBeaconTone !== 0).change();
var template = $('.beepers .beeper-template');
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
dshotBeaconSwitch_e.hide();
BEEPER_CONFIG.dshotBeaconConditions.generateElements(template, dshotBeaconCondition_e);
$('input.condition', dshotBeaconCondition_e).change(function () {
var element = $(this);
BEEPER_CONFIG.dshotBeaconConditions.updateData(element);
});
} else {
dshotBeaconCondition_e.hide();
dshotBeeperSwitch.change(function() {
if ($(this).is(':checked')) {
dshotBeacon_e.show();
if (dshotBeeperBeaconTone.val() == 0) {
dshotBeeperBeaconTone.val(1).change();
}
} else {
dshotBeeperBeaconTone.val(0).change();
dshotBeacon_e.hide();
}
});
dshotBeeperSwitch.prop('checked', BEEPER_CONFIG.dshotBeaconTone !== 0).change();
}
// Analog Beeper
var template = $('.beepers .beeper-template');
var destination = $('.beepers .beeper-configuration');
var beeper_e = $('.tab-configuration .beepers');
@ -890,7 +905,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
});
$('input.beeper', beeper_e).change(function () {
$('input.condition', beeper_e).change(function () {
var element = $(this);
BEEPER_CONFIG.beepers.updateData(element);
});