mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-26 09:45:23 +03:00
Merge pull request #839 from iNavFlight/dzikuvx-outputs-tab-configuration
Move outputs configuration to outputs tab
This commit is contained in:
commit
de4b5c85ba
7 changed files with 219 additions and 186 deletions
|
@ -3222,6 +3222,9 @@
|
||||||
"antigravityCutoff": {
|
"antigravityCutoff": {
|
||||||
"message": "Antigravity Cutoff Frequency"
|
"message": "Antigravity Cutoff Frequency"
|
||||||
},
|
},
|
||||||
|
"ouptputsConfiguration": {
|
||||||
|
"message": "Configuration"
|
||||||
|
},
|
||||||
"vtxDisclaimer": {
|
"vtxDisclaimer": {
|
||||||
"message": "Use only bands, channels and power levels that are legal in a place you fly! Always refer to VTX user manual and local regulations!"
|
"message": "Use only bands, channels and power levels that are legal in a place you fly! Always refer to VTX user manual and local regulations!"
|
||||||
}
|
}
|
||||||
|
|
2
js/fc.js
2
js/fc.js
|
@ -871,7 +871,7 @@ var FC = {
|
||||||
},
|
},
|
||||||
7: {
|
7: {
|
||||||
name: "DSHOT600",
|
name: "DSHOT600",
|
||||||
message: "escProtocolNotAdvised",
|
message: null,
|
||||||
defaultRate: 16000,
|
defaultRate: 16000,
|
||||||
rates: {
|
rates: {
|
||||||
16000: "16kHz"
|
16000: "16kHz"
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
|
|
||||||
.config-section .number,
|
.config-section .number,
|
||||||
.config-section .select,
|
.config-section .select,
|
||||||
|
.config-section .checkbox,
|
||||||
.tab-configuration .number,
|
.tab-configuration .number,
|
||||||
.tab-configuration .select,
|
.tab-configuration .select,
|
||||||
.tab-configuration .radio,
|
.tab-configuration .radio,
|
||||||
|
@ -90,6 +91,7 @@ hr {
|
||||||
|
|
||||||
.config-section .number:last-child,
|
.config-section .number:last-child,
|
||||||
.config-section .select:last-child,
|
.config-section .select:last-child,
|
||||||
|
.config-section .checkbox:last-child,
|
||||||
.tab-configuration .number:last-child,
|
.tab-configuration .number:last-child,
|
||||||
.tab-configuration .select:last-child,
|
.tab-configuration .select:last-child,
|
||||||
.tab-configuration .radio:last-child,
|
.tab-configuration .radio:last-child,
|
||||||
|
|
|
@ -261,81 +261,6 @@
|
||||||
<!--Right column begins here-->
|
<!--Right column begins here-->
|
||||||
|
|
||||||
<div class="rightWrapper">
|
<div class="rightWrapper">
|
||||||
<div class="config-section gui_box grey">
|
|
||||||
<div class="gui_box_titlebar">
|
|
||||||
<div class="spacer_box_title" data-i18n="configurationEscFeatures"></div>
|
|
||||||
</div>
|
|
||||||
<div class="spacer_box">
|
|
||||||
<div class="features esc-priority"></div>
|
|
||||||
<!--list of generated features goes here-->
|
|
||||||
<div id="esc-protocols">
|
|
||||||
<div id="esc-protocol-warning" class="warning-box"></div>
|
|
||||||
<div class="select">
|
|
||||||
<select name="esc-protocol" id="esc-protocol"></select>
|
|
||||||
<label for="esc-protocol">
|
|
||||||
<span data-i18n="escProtocol"></span>
|
|
||||||
</label>
|
|
||||||
<div class="helpicon cf_tip" data-i18n_title="escProtocolHelp"></div>
|
|
||||||
</div>
|
|
||||||
<div class="select hide-for-shot">
|
|
||||||
<select name="esc-rate" id="esc-rate"></select>
|
|
||||||
<label for="esc-rate">
|
|
||||||
<span data-i18n="escRefreshRate"></span>
|
|
||||||
</label>
|
|
||||||
<div class="helpicon cf_tip" data-i18n_title="escRefreshRatelHelp"></div>
|
|
||||||
</div>
|
|
||||||
<div class="clear-both"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="servo-rate-container">
|
|
||||||
<div class="select">
|
|
||||||
<select name="servo-rate" id="servo-rate"></select>
|
|
||||||
<label for="servo-rate">
|
|
||||||
<span data-i18n="servoRefreshRate"></span>
|
|
||||||
</label>
|
|
||||||
<div class="helpicon cf_tip" data-i18n_title="servoRefreshRatelHelp"></div>
|
|
||||||
</div>
|
|
||||||
<div class="clear-both"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="features esc"></div>
|
|
||||||
<!--list of generated features goes here-->
|
|
||||||
|
|
||||||
<div class="number disarmdelay" style="display: none; margin-bottom: 5px;">
|
|
||||||
<input type="number" id="autodisarmdelay" name="autodisarmdelay" min="0" max="60" />
|
|
||||||
<label for="autodisarmdelay">
|
|
||||||
<span data-i18n="configurationAutoDisarmDelay"></span>
|
|
||||||
</label>
|
|
||||||
<div class="helpicon cf_tip" data-i18n_title="configurationAutoDisarmDelayHelp"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
<div class="number hide-for-shot">
|
|
||||||
<input type="number" id="minthrottle" name="minthrottle" min="0" max="2000" />
|
|
||||||
<label for="minthrottle">
|
|
||||||
<span data-i18n="configurationThrottleMinimum"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="number midthrottle_wrapper hide-for-shot">
|
|
||||||
<input type="number" id="midthrottle" name="midthrottle" min="1200" max="1700" />
|
|
||||||
<label for="midthrottle">
|
|
||||||
<span data-i18n="configurationThrottleMid"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="number hide-for-shot">
|
|
||||||
<input type="number" id="maxthrottle" name="maxthrottle" min="0" max="2000" />
|
|
||||||
<label for="maxthrottle">
|
|
||||||
<span data-i18n="configurationThrottleMaximum"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="number hide-for-shot">
|
|
||||||
<input type="number" id="mincommand" name="mincommand" min="0" max="2000" />
|
|
||||||
<label for="mincommand">
|
|
||||||
<span data-i18n="configurationThrottleMinimumCommand"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-section gui_box grey">
|
<div class="config-section gui_box grey">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" data-i18n="configurationSystem"></div>
|
<div class="spacer_box_title" data-i18n="configurationSystem"></div>
|
||||||
|
|
|
@ -41,10 +41,10 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
mspHelper.loadSensorConfig,
|
mspHelper.loadSensorConfig,
|
||||||
mspHelper.loadVTXConfig,
|
mspHelper.loadVTXConfig,
|
||||||
mspHelper.loadMixerConfig,
|
mspHelper.loadMixerConfig,
|
||||||
loadCraftName
|
loadCraftName,
|
||||||
|
mspHelper.loadMiscV2
|
||||||
];
|
];
|
||||||
|
|
||||||
loadChain.push(mspHelper.loadMiscV2);
|
|
||||||
loadChainer.setChain(loadChain);
|
loadChainer.setChain(loadChain);
|
||||||
loadChainer.setExitPoint(load_html);
|
loadChainer.setExitPoint(load_html);
|
||||||
loadChainer.execute();
|
loadChainer.execute();
|
||||||
|
@ -64,11 +64,10 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
mspHelper.saveSensorConfig,
|
mspHelper.saveSensorConfig,
|
||||||
mspHelper.saveVTXConfig,
|
mspHelper.saveVTXConfig,
|
||||||
saveCraftName,
|
saveCraftName,
|
||||||
|
mspHelper.saveMiscV2,
|
||||||
|
mspHelper.saveToEeprom
|
||||||
];
|
];
|
||||||
|
|
||||||
saveChain.push(mspHelper.saveMiscV2);
|
|
||||||
saveChain.push(mspHelper.saveToEeprom);
|
|
||||||
|
|
||||||
saveChainer.setChain(saveChain);
|
saveChainer.setChain(saveChain);
|
||||||
saveChainer.setExitPoint(reboot);
|
saveChainer.setExitPoint(reboot);
|
||||||
|
|
||||||
|
@ -383,25 +382,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
// fill magnetometer
|
// fill magnetometer
|
||||||
$('#mag_declination').val(MISC.mag_declination);
|
$('#mag_declination').val(MISC.mag_declination);
|
||||||
|
|
||||||
//fill motor disarm params and FC loop time
|
|
||||||
$('input[name="autodisarmdelay"]').val(ARMING_CONFIG.auto_disarm_delay);
|
|
||||||
$('div.disarm').show();
|
|
||||||
if (bit_check(BF_CONFIG.features, 4)) { //MOTOR_STOP
|
|
||||||
$('div.disarmdelay').show();
|
|
||||||
} else {
|
|
||||||
$('div.disarmdelay').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
// fill throttle
|
|
||||||
$('#minthrottle').val(MISC.minthrottle);
|
|
||||||
// midrc was removed in 2.0, but the firmware still excepts
|
|
||||||
// the MSP frame with it for backwards compatibility, so we
|
|
||||||
// just hide it from the UI.
|
|
||||||
let midThrottleWrapper = $('.midthrottle_wrapper');
|
|
||||||
midThrottleWrapper.hide();
|
|
||||||
$('#maxthrottle').val(MISC.maxthrottle);
|
|
||||||
$('#mincommand').val(MISC.mincommand);
|
|
||||||
|
|
||||||
// fill battery voltage
|
// fill battery voltage
|
||||||
$('#voltagesource').val(MISC.voltage_source);
|
$('#voltagesource').val(MISC.voltage_source);
|
||||||
$('#cells').val(MISC.battery_cells);
|
$('#cells').val(MISC.battery_cells);
|
||||||
|
@ -421,90 +401,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('#battery_capacity_critical').val(MISC.battery_capacity_critical * 100 / MISC.battery_capacity);
|
$('#battery_capacity_critical').val(MISC.battery_capacity_critical * 100 / MISC.battery_capacity);
|
||||||
$('#battery_capacity_unit').val(MISC.battery_capacity_unit);
|
$('#battery_capacity_unit').val(MISC.battery_capacity_unit);
|
||||||
|
|
||||||
var escProtocols = FC.getEscProtocols();
|
|
||||||
var servoRates = FC.getServoRates();
|
|
||||||
|
|
||||||
function buildMotorRates() {
|
|
||||||
var protocolData = escProtocols[ADVANCED_CONFIG.motorPwmProtocol];
|
|
||||||
|
|
||||||
$escRate.find('option').remove();
|
|
||||||
|
|
||||||
for (var i in protocolData.rates) {
|
|
||||||
if (protocolData.rates.hasOwnProperty(i)) {
|
|
||||||
$escRate.append('<option value="' + i + '">' + protocolData.rates[i] + '</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If rate from FC is not on the list, add a new entry
|
|
||||||
*/
|
|
||||||
if ($escRate.find('[value="' + ADVANCED_CONFIG.motorPwmRate + '"]').length == 0) {
|
|
||||||
$escRate.append('<option value="' + ADVANCED_CONFIG.motorPwmRate + '">' + ADVANCED_CONFIG.motorPwmRate + 'Hz</option>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ADVANCED_CONFIG.motorPwmProtocol >= 5) {
|
|
||||||
//DSHOT/SERIALSHOT protocols, simplify UI
|
|
||||||
$('.hide-for-shot').addClass('is-hidden');
|
|
||||||
} else {
|
|
||||||
$('.hide-for-shot').removeClass('is-hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protocolData.message !== null) {
|
|
||||||
$('#esc-protocol-warning').html(chrome.i18n.getMessage(protocolData.message));
|
|
||||||
$('#esc-protocol-warning').show();
|
|
||||||
} else {
|
|
||||||
$('#esc-protocol-warning').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var $escProtocol = $('#esc-protocol');
|
|
||||||
var $escRate = $('#esc-rate');
|
|
||||||
for (i in escProtocols) {
|
|
||||||
if (escProtocols.hasOwnProperty(i)) {
|
|
||||||
var protocolData = escProtocols[i];
|
|
||||||
$escProtocol.append('<option value="' + i + '">' + protocolData.name + '</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$escProtocol.val(ADVANCED_CONFIG.motorPwmProtocol);
|
|
||||||
buildMotorRates();
|
|
||||||
$escRate.val(ADVANCED_CONFIG.motorPwmRate);
|
|
||||||
|
|
||||||
$escProtocol.change(function () {
|
|
||||||
ADVANCED_CONFIG.motorPwmProtocol = $(this).val();
|
|
||||||
buildMotorRates();
|
|
||||||
ADVANCED_CONFIG.motorPwmRate = escProtocols[ADVANCED_CONFIG.motorPwmProtocol].defaultRate;
|
|
||||||
$escRate.val(ADVANCED_CONFIG.motorPwmRate);
|
|
||||||
});
|
|
||||||
|
|
||||||
$escRate.change(function () {
|
|
||||||
ADVANCED_CONFIG.motorPwmRate = $(this).val();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#esc-protocols").show();
|
|
||||||
|
|
||||||
var $servoRate = $('#servo-rate');
|
|
||||||
|
|
||||||
for (i in servoRates) {
|
|
||||||
if (servoRates.hasOwnProperty(i)) {
|
|
||||||
$servoRate.append('<option value="' + i + '">' + servoRates[i] + '</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* If rate from FC is not on the list, add a new entry
|
|
||||||
*/
|
|
||||||
if ($servoRate.find('[value="' + ADVANCED_CONFIG.servoPwmRate + '"]').length == 0) {
|
|
||||||
$servoRate.append('<option value="' + ADVANCED_CONFIG.servoPwmRate + '">' + ADVANCED_CONFIG.servoPwmRate + 'Hz</option>');
|
|
||||||
}
|
|
||||||
|
|
||||||
$servoRate.val(ADVANCED_CONFIG.servoPwmRate);
|
|
||||||
$servoRate.change(function () {
|
|
||||||
ADVANCED_CONFIG.servoPwmRate = $(this).val();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#servo-rate-container').show();
|
|
||||||
|
|
||||||
var $looptime = $("#looptime");
|
var $looptime = $("#looptime");
|
||||||
|
|
||||||
var $gyroLpf = $("#gyro-lpf"),
|
var $gyroLpf = $("#gyro-lpf"),
|
||||||
|
|
|
@ -1,6 +1,79 @@
|
||||||
<div class="tab-motors toolbar_fixed_bottom">
|
<div class="tab-motors toolbar_fixed_bottom">
|
||||||
<div class="content_wrapper">
|
<div class="content_wrapper">
|
||||||
<div class="tab_title" i18n="tabMotorTesting">Motors</div>
|
<div class="tab_title" i18n="tabMotorTesting"></div>
|
||||||
|
|
||||||
|
<div class="gui_box grey config-section">
|
||||||
|
<div class="gui_box_titlebar">
|
||||||
|
<div class="spacer_box_title" data-i18n="ouptputsConfiguration"></div>
|
||||||
|
</div>
|
||||||
|
<div class="spacer">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" data-bit="28" class="feature toggle" name="PWM_OUTPUT_ENABLE" title="PWM_OUTPUT_ENABLE" id="feature-28">
|
||||||
|
<label for="feature-28">
|
||||||
|
<span data-i18n="featurePWM_OUTPUT_ENABLE"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" data-i18n_title="featurePWM_OUTPUT_ENABLETip"></div>
|
||||||
|
</div>
|
||||||
|
<!--list of generated features goes here-->
|
||||||
|
<div id="esc-protocols">
|
||||||
|
<div id="esc-protocol-warning" class="warning-box"></div>
|
||||||
|
<div class="select">
|
||||||
|
<select name="esc-protocol" id="esc-protocol"></select>
|
||||||
|
<label for="esc-protocol">
|
||||||
|
<span data-i18n="escProtocol"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" data-i18n_title="escProtocolHelp"></div>
|
||||||
|
</div>
|
||||||
|
<div class="select hide-for-shot">
|
||||||
|
<select name="esc-rate" id="esc-rate"></select>
|
||||||
|
<label for="esc-rate">
|
||||||
|
<span data-i18n="escRefreshRate"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" data-i18n_title="escRefreshRatelHelp"></div>
|
||||||
|
</div>
|
||||||
|
<div class="clear-both"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="servo-rate-container">
|
||||||
|
<div class="select">
|
||||||
|
<select name="servo-rate" id="servo-rate"></select>
|
||||||
|
<label for="servo-rate">
|
||||||
|
<span data-i18n="servoRefreshRate"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" data-i18n_title="servoRefreshRatelHelp"></div>
|
||||||
|
</div>
|
||||||
|
<div class="clear-both"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" data-bit="4" class="feature toggle" name="MOTOR_STOP" title="MOTOR_STOP" id="feature-4">
|
||||||
|
<label for="feature-4">
|
||||||
|
<span data-i18n="featureMOTOR_STOP"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" data-i18n_title="featureMOTOR_STOPTip"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<div class="number hide-for-shot">
|
||||||
|
<input type="number" data-simple-bind="MISC.minthrottle" id="minthrottle" name="minthrottle" min="0" max="2000" />
|
||||||
|
<label for="minthrottle">
|
||||||
|
<span data-i18n="configurationThrottleMinimum"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="number hide-for-shot">
|
||||||
|
<input type="number" data-simple-bind="MISC.maxthrottle" id="maxthrottle" name="maxthrottle" min="0" max="2000" />
|
||||||
|
<label for="maxthrottle">
|
||||||
|
<span data-i18n="configurationThrottleMaximum"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="number hide-for-shot">
|
||||||
|
<input type="number" data-simple-bind="MISC.mincommand" id="mincommand" name="mincommand" min="0" max="2000" />
|
||||||
|
<label for="mincommand">
|
||||||
|
<span data-i18n="configurationThrottleMinimumCommand"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="gui_box grey">
|
<div class="gui_box grey">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" data-i18n="motors"></div>
|
<div class="spacer_box_title" data-i18n="motors"></div>
|
||||||
|
@ -101,6 +174,7 @@
|
||||||
<div class="content_toolbar">
|
<div class="content_toolbar">
|
||||||
<div class="btn save_btn">
|
<div class="btn save_btn">
|
||||||
<a class="update" href="#" data-i18n="servosButtonSave"></a>
|
<a class="update" href="#" data-i18n="servosButtonSave"></a>
|
||||||
|
<a class="save" href="#" data-i18n="configurationButtonSave"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
135
tabs/motors.js
135
tabs/motors.js
|
@ -23,7 +23,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
var loadChainer = new MSPChainerClass();
|
var loadChainer = new MSPChainerClass();
|
||||||
|
|
||||||
loadChainer.setChain([
|
loadChainer.setChain([
|
||||||
mspHelper.loadMisc,
|
mspHelper.loadMiscV2,
|
||||||
mspHelper.loadBfConfig,
|
mspHelper.loadBfConfig,
|
||||||
mspHelper.load3dConfig,
|
mspHelper.load3dConfig,
|
||||||
mspHelper.loadMotors,
|
mspHelper.loadMotors,
|
||||||
|
@ -34,6 +34,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
mspHelper.loadServoConfiguration,
|
mspHelper.loadServoConfiguration,
|
||||||
mspHelper.loadOutputMapping,
|
mspHelper.loadOutputMapping,
|
||||||
mspHelper.loadRcData,
|
mspHelper.loadRcData,
|
||||||
|
mspHelper.loadAdvancedConfig,
|
||||||
]);
|
]);
|
||||||
loadChainer.setExitPoint(load_html);
|
loadChainer.setExitPoint(load_html);
|
||||||
loadChainer.execute();
|
loadChainer.execute();
|
||||||
|
@ -43,6 +44,9 @@ TABS.motors.initialize = function (callback) {
|
||||||
|
|
||||||
saveChainer.setChain([
|
saveChainer.setChain([
|
||||||
mspHelper.sendServoConfigurations,
|
mspHelper.sendServoConfigurations,
|
||||||
|
mspHelper.saveAdvancedConfig,
|
||||||
|
mspHelper.saveBfConfig,
|
||||||
|
mspHelper.saveMiscV2,
|
||||||
mspHelper.saveToEeprom
|
mspHelper.saveToEeprom
|
||||||
]);
|
]);
|
||||||
saveChainer.setExitPoint(function () {
|
saveChainer.setExitPoint(function () {
|
||||||
|
@ -57,9 +61,124 @@ TABS.motors.initialize = function (callback) {
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
process_motors();
|
process_motors();
|
||||||
process_servos();
|
process_servos();
|
||||||
|
processConfiguration();
|
||||||
finalize();
|
finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processConfiguration() {
|
||||||
|
let escProtocols = FC.getEscProtocols();
|
||||||
|
let servoRates = FC.getServoRates();
|
||||||
|
|
||||||
|
function buildMotorRates() {
|
||||||
|
var protocolData = escProtocols[ADVANCED_CONFIG.motorPwmProtocol];
|
||||||
|
|
||||||
|
$escRate.find('option').remove();
|
||||||
|
|
||||||
|
for (var i in protocolData.rates) {
|
||||||
|
if (protocolData.rates.hasOwnProperty(i)) {
|
||||||
|
$escRate.append('<option value="' + i + '">' + protocolData.rates[i] + '</option>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If rate from FC is not on the list, add a new entry
|
||||||
|
*/
|
||||||
|
if ($escRate.find('[value="' + ADVANCED_CONFIG.motorPwmRate + '"]').length == 0) {
|
||||||
|
$escRate.append('<option value="' + ADVANCED_CONFIG.motorPwmRate + '">' + ADVANCED_CONFIG.motorPwmRate + 'Hz</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ADVANCED_CONFIG.motorPwmProtocol >= 5) {
|
||||||
|
//DSHOT/SERIALSHOT protocols, simplify UI
|
||||||
|
$('.hide-for-shot').addClass('is-hidden');
|
||||||
|
} else {
|
||||||
|
$('.hide-for-shot').removeClass('is-hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protocolData.message !== null) {
|
||||||
|
$('#esc-protocol-warning').html(chrome.i18n.getMessage(protocolData.message));
|
||||||
|
$('#esc-protocol-warning').show();
|
||||||
|
} else {
|
||||||
|
$('#esc-protocol-warning').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let $escProtocol = $('#esc-protocol');
|
||||||
|
let $escRate = $('#esc-rate');
|
||||||
|
for (i in escProtocols) {
|
||||||
|
if (escProtocols.hasOwnProperty(i)) {
|
||||||
|
var protocolData = escProtocols[i];
|
||||||
|
$escProtocol.append('<option value="' + i + '">' + protocolData.name + '</option>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$escProtocol.val(ADVANCED_CONFIG.motorPwmProtocol);
|
||||||
|
buildMotorRates();
|
||||||
|
$escRate.val(ADVANCED_CONFIG.motorPwmRate);
|
||||||
|
|
||||||
|
$escProtocol.change(function () {
|
||||||
|
ADVANCED_CONFIG.motorPwmProtocol = $(this).val();
|
||||||
|
buildMotorRates();
|
||||||
|
ADVANCED_CONFIG.motorPwmRate = escProtocols[ADVANCED_CONFIG.motorPwmProtocol].defaultRate;
|
||||||
|
$escRate.val(ADVANCED_CONFIG.motorPwmRate);
|
||||||
|
});
|
||||||
|
|
||||||
|
$escRate.change(function () {
|
||||||
|
ADVANCED_CONFIG.motorPwmRate = $(this).val();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#esc-protocols").show();
|
||||||
|
|
||||||
|
let $servoRate = $('#servo-rate');
|
||||||
|
|
||||||
|
for (i in servoRates) {
|
||||||
|
if (servoRates.hasOwnProperty(i)) {
|
||||||
|
$servoRate.append('<option value="' + i + '">' + servoRates[i] + '</option>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* If rate from FC is not on the list, add a new entry
|
||||||
|
*/
|
||||||
|
if ($servoRate.find('[value="' + ADVANCED_CONFIG.servoPwmRate + '"]').length == 0) {
|
||||||
|
$servoRate.append('<option value="' + ADVANCED_CONFIG.servoPwmRate + '">' + ADVANCED_CONFIG.servoPwmRate + 'Hz</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
$servoRate.val(ADVANCED_CONFIG.servoPwmRate);
|
||||||
|
$servoRate.change(function () {
|
||||||
|
ADVANCED_CONFIG.servoPwmRate = $(this).val();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#servo-rate-container').show();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set all features ON/OFF
|
||||||
|
*/
|
||||||
|
let features = FC.getFeatures();
|
||||||
|
for (let i in features) {
|
||||||
|
if (features.hasOwnProperty(i)) {
|
||||||
|
let $html = $(".feature[data-bit='" +features[i].bit + "']");
|
||||||
|
if ($html.length) {
|
||||||
|
$html.prop('checked', bit_check(BF_CONFIG.features, features[i].bit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('input[type="checkbox"].feature').change(function () {
|
||||||
|
|
||||||
|
let element = $(this),
|
||||||
|
index = element.data('bit'),
|
||||||
|
state = element.is(':checked');
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
BF_CONFIG.features = bit_set(BF_CONFIG.features, index);
|
||||||
|
} else {
|
||||||
|
BF_CONFIG.features = bit_clear(BF_CONFIG.features, index);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
GUI.simpleBind();
|
||||||
|
}
|
||||||
|
|
||||||
function update_arm_status() {
|
function update_arm_status() {
|
||||||
self.armed = FC.isModeEnabled('ARM');
|
self.armed = FC.isModeEnabled('ARM');
|
||||||
}
|
}
|
||||||
|
@ -230,6 +349,20 @@ TABS.motors.initialize = function (callback) {
|
||||||
$('a.update').click(function () {
|
$('a.update').click(function () {
|
||||||
servos_update();
|
servos_update();
|
||||||
});
|
});
|
||||||
|
$('a.save').click(function () {
|
||||||
|
saveChainer.setExitPoint(function () {
|
||||||
|
//noinspection JSUnresolvedVariable
|
||||||
|
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||||
|
|
||||||
|
GUI.tab_switch_cleanup(function () {
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||||
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
GUI.handleReconnect($('.tab_motors a'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
servos_update();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue