Merge pull request #375 from mikeller/add_throttle_idle_percent_value
Add throttle idle percent value10.3.x-maintenance
commit
109a8030ba
|
@ -644,11 +644,17 @@
|
|||
"configurationMidRcHelp": {
|
||||
"message": "This is the center value <span style=\"font-weight: bold\">for all RC channels</span>. Set this to the value that your transmitter sends when the stick is centered for a channel. To adjust the thrust at throttle mid position, change the 'Trottle MID' value on the PID Tuning tab."
|
||||
},
|
||||
"configurationDigitalIdlePercent": {
|
||||
"message": "Motor Idle Throttle Value (percent)"
|
||||
},
|
||||
"configurationDigitalIdlePercentHelp": {
|
||||
"message": "This is the 'idle' value in percent of maximum throttle that is sent to the ESCs when the craft is armed and the trottle stick is at minimum position. Increase the percent value to gain more idle speed."
|
||||
},
|
||||
"configurationThrottleMinimum": {
|
||||
"message": "Minimum Throttle"
|
||||
"message": "Motor Idle Throttle Value (absolute / percent)"
|
||||
},
|
||||
"configurationThrottleMinimumHelp": {
|
||||
"message": "This is the 'idle' value that is sent to the ESCs when the craft is armed and the trottle stick is at minimum position. Adjust this so the motors run as slow as possible while still running smoothly."
|
||||
"message": "This is the 'idle' value (absolute / as a percentage of the throttle range) that is sent to the ESCs when the craft is armed and the trottle stick is at minimum position. Increase the value or to gain more idle speed."
|
||||
},
|
||||
"configurationThrottleMaximum": {
|
||||
"message": "Maximum Throttle"
|
||||
|
@ -1839,6 +1845,15 @@
|
|||
"configurationPidProcessDenom": {
|
||||
"message": "PID loop frequency"
|
||||
},
|
||||
"configurationPidProcessDenomHelp": {
|
||||
"message": "The maximum frequency for the PID loop is limited by the maximum frequency that updates can be sent by the chosen ESC / motor protocol."
|
||||
},
|
||||
"configurationGyroUse32kHz": {
|
||||
"message": "Use 32 kHz gyro update frequency instead of 8 kHz"
|
||||
},
|
||||
"configurationGyroUse32kHzHelp": {
|
||||
"message": "32 kHz gyro update frequency is only possible if the gyro chip supports it (currently MPU6500, MPU9250, and ICM20689 if connected over SPI). If in doubt, consult the specification for your board."
|
||||
},
|
||||
"configurationAccHardware": {
|
||||
"message": "Accelerometer"
|
||||
},
|
||||
|
|
8
js/fc.js
8
js/fc.js
|
@ -256,7 +256,9 @@ var FC = {
|
|||
pid_process_denom: 0,
|
||||
use_unsyncedPwm: 0,
|
||||
fast_pwm_protocol: 0,
|
||||
motor_pwm_rate: 0
|
||||
motor_pwm_rate: 0,
|
||||
digitalIdlePercent: 0,
|
||||
gyroUse32kHz: 0
|
||||
};
|
||||
|
||||
FILTER_CONFIG = {
|
||||
|
@ -283,7 +285,9 @@ var FC = {
|
|||
toleranceBandReduction: 0,
|
||||
itermThrottleGain: 0,
|
||||
pidMaxVelocity: 0,
|
||||
pidMaxVelocityYaw: 0
|
||||
pidMaxVelocityYaw: 0,
|
||||
levelAngleLimit: 0,
|
||||
levelSensitivity: 0
|
||||
};
|
||||
|
||||
SENSOR_CONFIG = {
|
||||
|
|
|
@ -617,6 +617,13 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
PID_ADVANCED_CONFIG.use_unsyncedPwm = data.readU8();
|
||||
PID_ADVANCED_CONFIG.fast_pwm_protocol = data.readU8();
|
||||
PID_ADVANCED_CONFIG.motor_pwm_rate = data.readU16();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
PID_ADVANCED_CONFIG.digitalIdlePercent = data.readU16() / 100;
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.25.0")) {
|
||||
PID_ADVANCED_CONFIG.gyroUse32kHz = data.readU8();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_FILTER_CONFIG:
|
||||
FILTER_CONFIG.gyro_soft_lpf_hz = data.readU8();
|
||||
|
@ -651,6 +658,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
ADVANCED_TUNING.pidMaxVelocity = data.readU16();
|
||||
ADVANCED_TUNING.pidMaxVelocityYaw = data.readU16();
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
ADVANCED_TUNING.levelAngleLimit = data.readU8();
|
||||
ADVANCED_TUNING.levelSensitivity = data.readU8();
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SENSOR_CONFIG:
|
||||
SENSOR_CONFIG.acc_hardware = data.readU8();
|
||||
|
@ -1130,6 +1141,13 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(PID_ADVANCED_CONFIG.use_unsyncedPwm)
|
||||
.push8(PID_ADVANCED_CONFIG.fast_pwm_protocol)
|
||||
.push16(PID_ADVANCED_CONFIG.motor_pwm_rate);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
buffer.push16(PID_ADVANCED_CONFIG.digitalIdlePercent * 100);
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.25.0")) {
|
||||
buffer.push8(PID_ADVANCED_CONFIG.gyroUse32kHz);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SET_FILTER_CONFIG:
|
||||
buffer.push8(FILTER_CONFIG.gyro_soft_lpf_hz)
|
||||
|
@ -1160,6 +1178,10 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(ADVANCED_TUNING.itermThrottleGain)
|
||||
.push16(ADVANCED_TUNING.pidMaxVelocity)
|
||||
.push16(ADVANCED_TUNING.pidMaxVelocityYaw);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
buffer.push8(ADVANCED_TUNING.levelAngleLimit)
|
||||
.push8(ADVANCED_TUNING.levelSensitivity);
|
||||
}
|
||||
}
|
||||
// only supports 1 version pre bf 3.0
|
||||
else {
|
||||
|
|
|
@ -90,16 +90,28 @@
|
|||
<div class="helpicon cf_tip" i18n_title="configurationMidRcHelp"></div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<div class="number digitalIdlePercent">
|
||||
<label>
|
||||
<div class="numberspacer">
|
||||
<input type="number" name="digitalIdlePercent" min="0.00" max="20.00" step="0.01"/>
|
||||
</div>
|
||||
<span i18n="configurationDigitalIdlePercent"></span>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationDigitalIdlePercentHelp"></div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number minthrottle">
|
||||
<label>
|
||||
<div class="numberspacer">
|
||||
<input type="number" name="minthrottle" min="0" max="2000" />
|
||||
</div>
|
||||
<div class="numberspacer">
|
||||
<input type="number" name="idlePercent" min="0.00" max="20.00" step="0.01"/>
|
||||
</div>
|
||||
<span i18n="configurationThrottleMinimum"></span>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationThrottleMinimumHelp"></div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<div class="number maxthrottle">
|
||||
<label>
|
||||
<div class="numberspacer">
|
||||
<input type="number" name="maxthrottle" min="0" max="2000" />
|
||||
|
@ -107,7 +119,7 @@
|
|||
<span i18n="configurationThrottleMaximum"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<div class="number mincommand">
|
||||
<label>
|
||||
<div class="numberspacer">
|
||||
<input type="number" name="mincommand" min="0" max="2000" />
|
||||
|
@ -252,6 +264,14 @@
|
|||
<p i18n="configurationLoopTimeHelp"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="select gyroUse32kHz">
|
||||
<div style="float: left; height: 20px; margin-right: 15px; margin-left: 3px;">
|
||||
<input type="checkbox" id="gyroUse32kHz" class="toggle" />
|
||||
</div>
|
||||
<label for="gyroUse32kHz"> <span class="freelabel" i18n="configurationGyroUse32kHz"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationGyroUse32kHzHelp"></div>
|
||||
</div>
|
||||
<div class="select">
|
||||
<label>
|
||||
<select class="gyroSyncDenom">
|
||||
|
@ -266,6 +286,7 @@
|
|||
<!-- list generated here -->
|
||||
</select>
|
||||
<span i18n="configurationPidProcessDenom"></span>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationPidProcessDenomHelp"></div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="hardwareSelection">
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
TABS.configuration = {};
|
||||
TABS.configuration = {
|
||||
DSHOT_PROTOCOL_MIN_VALUE: 5
|
||||
};
|
||||
|
||||
TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||
var self = this;
|
||||
|
@ -156,7 +158,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
// select current mixer configuration
|
||||
mixer_list_e.val(BF_CONFIG.mixerConfiguration).change();
|
||||
|
||||
var radioGroups = [];
|
||||
var features_e = $('.tab-configuration .features');
|
||||
|
||||
BF_CONFIG.features.generateElements(features_e);
|
||||
|
@ -175,13 +176,10 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
'CW 270° flip'
|
||||
];
|
||||
|
||||
|
||||
|
||||
var orientation_gyro_e = $('select.gyroalign');
|
||||
var orientation_acc_e = $('select.accalign');
|
||||
var orientation_mag_e = $('select.magalign');
|
||||
|
||||
|
||||
if (semver.lt(CONFIG.apiVersion, "1.15.0")) {
|
||||
$('.tab-configuration .sensoralignment').hide();
|
||||
} else {
|
||||
|
@ -196,7 +194,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
// ESC protocols
|
||||
|
||||
var escprotocols = [
|
||||
'PWM',
|
||||
'ONESHOT125',
|
||||
|
@ -221,79 +218,97 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol+1);
|
||||
|
||||
esc_protocol_e.change(function () {
|
||||
if ($(this).val() - 1 >= self.DSHOT_PROTOCOL_MIN_VALUE) {
|
||||
$('div.minthrottle').hide();
|
||||
$('div.maxthrottle').hide();
|
||||
$('div.mincommand').hide();
|
||||
|
||||
$('div.digitalIdlePercent').show();
|
||||
} else {
|
||||
$('div.minthrottle').show();
|
||||
$('div.maxthrottle').show();
|
||||
$('div.mincommand').show();
|
||||
|
||||
$('div.digitalIdlePercent').hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
$('input[id="unsyncedPWMSwitch"]').prop('checked', PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0);
|
||||
$('input[name="unsyncedpwmfreq"]').val(PID_ADVANCED_CONFIG.motor_pwm_rate);
|
||||
if (PID_ADVANCED_CONFIG.use_unsyncedPwm) {
|
||||
$('div.unsyncedpwmfreq').show();
|
||||
}
|
||||
else {
|
||||
$('div.unsyncedpwmfreq').hide();
|
||||
}
|
||||
$('input[name="digitalIdlePercent"]').val(PID_ADVANCED_CONFIG.digitalIdlePercent);
|
||||
|
||||
// Gyro and PID update
|
||||
var gyroFreq = [
|
||||
"8KHz",
|
||||
"4KHz",
|
||||
"2.67KHz",
|
||||
"2KHz",
|
||||
"1.6KHz",
|
||||
"1.33KHz",
|
||||
"1.14KHz",
|
||||
"1KHz"
|
||||
];
|
||||
|
||||
var gyroUse32kHz_e = $('input[id="gyroUse32kHz"]');
|
||||
var gyro_select_e = $('select.gyroSyncDenom');
|
||||
var pid_select_e = $('select.pidProcessDenom');
|
||||
|
||||
for (var i = 0; i < gyroFreq.length; i++) {
|
||||
gyro_select_e.append('<option value="'+(i+1)+'">'+gyroFreq[i]+'</option>');
|
||||
var updateGyroDenom = function (gyroBaseFreq) {
|
||||
var originalGyroDenom = gyro_select_e.val();
|
||||
|
||||
gyro_select_e.empty();
|
||||
|
||||
for (var i = 1; i <= 8; i++) {
|
||||
gyro_select_e.append('<option value="' + i + '">' + ((gyroBaseFreq / i * 100).toFixed(0) / 100) + ' kHz</option>');
|
||||
}
|
||||
|
||||
gyro_select_e.val(originalGyroDenom);
|
||||
|
||||
gyro_select_e.change();
|
||||
};
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.25.0")) {
|
||||
gyroUse32kHz_e.prop('checked', PID_ADVANCED_CONFIG.gyroUse32kHz !== 0);
|
||||
|
||||
gyroUse32kHz_e.change(function () {
|
||||
var gyroBaseFreq;
|
||||
if ($(this).is(':checked')) {
|
||||
gyroBaseFreq = 32;
|
||||
} else {
|
||||
gyroBaseFreq = 8;
|
||||
}
|
||||
|
||||
updateGyroDenom(gyroBaseFreq);
|
||||
}).change();
|
||||
} else {
|
||||
$('div.gyroUse32kHz').hide();
|
||||
|
||||
updateGyroDenom(8);
|
||||
}
|
||||
|
||||
gyro_select_e.val(PID_ADVANCED_CONFIG.gyro_sync_denom);
|
||||
|
||||
var gyroDenom = PID_ADVANCED_CONFIG.gyro_sync_denom;
|
||||
var pidFreq = [
|
||||
8 / (gyroDenom * 1),
|
||||
8 / (gyroDenom * 2),
|
||||
8 / (gyroDenom * 3),
|
||||
8 / (gyroDenom * 4),
|
||||
8 / (gyroDenom * 5),
|
||||
8 / (gyroDenom * 6),
|
||||
8 / (gyroDenom * 7),
|
||||
8 / (gyroDenom * 8)
|
||||
];
|
||||
gyro_select_e.change(function () {
|
||||
var originalPidDenom = pid_select_e.val();
|
||||
|
||||
var pidBaseFreq = 8;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.25.0") && gyroUse32kHz_e.is(':checked')) {
|
||||
pidBaseFreq = 32;
|
||||
}
|
||||
|
||||
pidBaseFreq = pidBaseFreq / parseInt($(this).val());
|
||||
|
||||
pid_select_e.empty();
|
||||
|
||||
for (var i = 1; i <= 8; i++) {
|
||||
pid_select_e.append('<option value="' + i + '">' + ((pidBaseFreq / i * 100).toFixed(0) / 100) + ' kHz</option>');
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
for (var i = 9; i <= 16; i++) {
|
||||
pid_select_e.append('<option value="' + i + '">' + ((pidBaseFreq / i * 100).toFixed(0) / 100) + ' kHz</option>');
|
||||
}
|
||||
}
|
||||
|
||||
pid_select_e.val(originalPidDenom);
|
||||
}).change();
|
||||
|
||||
var pid_select_e = $('select.pidProcessDenom');
|
||||
for (var i = 0; i < pidFreq.length; i++) {
|
||||
var pidF = (1000 * pidFreq[i] / 10); // Could be done better
|
||||
pidF = pidF.toFixed(0);
|
||||
pid_select_e.append('<option value="'+(i+1)+'">'+(pidF / 100).toString()+'KHz</option>');
|
||||
}
|
||||
pid_select_e.val(PID_ADVANCED_CONFIG.pid_process_denom);
|
||||
|
||||
$('select.gyroSyncDenom').change(function() {
|
||||
var gyroDenom = $('select.gyroSyncDenom').val();
|
||||
var newPidFreq = [
|
||||
8 / (gyroDenom * 1),
|
||||
8 / (gyroDenom * 2),
|
||||
8 / (gyroDenom * 3),
|
||||
8 / (gyroDenom * 4),
|
||||
8 / (gyroDenom * 5),
|
||||
8 / (gyroDenom * 6),
|
||||
8 / (gyroDenom * 7),
|
||||
8 / (gyroDenom * 8)
|
||||
];
|
||||
for (var i=0; i<newPidFreq.length;i++) {
|
||||
var pidF = (1000 * newPidFreq[i] / 10); // Could be done better
|
||||
pidF = pidF.toFixed(0);
|
||||
$('select.pidProcessDenom option[value="'+(i+1)+'"]').text((pidF / 100).toString()+'KHz');}
|
||||
|
||||
});
|
||||
|
||||
$('input[id="accHardwareSwitch"]').prop('checked', SENSOR_CONFIG.acc_hardware !== 1);
|
||||
$('input[id="baroHardwareSwitch"]').prop('checked', SENSOR_CONFIG.baro_hardware !== 1);
|
||||
$('input[id="magHardwareSwitch"]').prop('checked', SENSOR_CONFIG.mag_hardware !== 1);
|
||||
|
||||
|
||||
// Only show these sections for supported FW
|
||||
if (semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||
$('.selectProtocol').hide();
|
||||
|
@ -311,8 +326,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$('.miscSettings').hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// generate GPS
|
||||
var gpsProtocols = [
|
||||
'NMEA',
|
||||
|
@ -439,10 +452,30 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
// fill throttle
|
||||
$('input[name="midrc"]').val(MISC.midrc);
|
||||
$('input[name="minthrottle"]').val(MISC.minthrottle);
|
||||
var minThrottle_e = $('input[name="minthrottle"]');
|
||||
minThrottle_e.val(MISC.minthrottle);
|
||||
$('input[name="maxthrottle"]').val(MISC.maxthrottle);
|
||||
$('input[name="mincommand"]').val(MISC.mincommand);
|
||||
|
||||
var idlePercent_e = $('input[name="idlePercent"]');
|
||||
idlePercent_e.change(function () {
|
||||
if (esc_protocol_e.val() - 1 < self.DSHOT_PROTOCOL_MIN_VALUE) {
|
||||
var idlePercent = parseFloat($(this).val())
|
||||
var minCommand = parseInt($('input[name="mincommand"]').val());
|
||||
var maxThrottle = parseInt($('input[name="maxthrottle"]').val());
|
||||
|
||||
minThrottle_e.val(Math.trunc(minCommand + (maxThrottle - minCommand) * idlePercent / 100));
|
||||
}
|
||||
});
|
||||
|
||||
minThrottle_e.change(function () {
|
||||
var minThrottle = parseInt($(this).val());
|
||||
var minCommand = parseInt($('input[name="mincommand"]').val());
|
||||
var maxThrottle = parseInt($('input[name="maxthrottle"]').val());
|
||||
|
||||
idlePercent_e.val(Math.trunc((minThrottle - minCommand) / (maxThrottle - minCommand) * 10000) / 100);
|
||||
}).change();
|
||||
|
||||
// fill battery
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||
var batteryMeterTypes = [
|
||||
|
@ -614,7 +647,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
} else {
|
||||
$('div.unsyncedpwmfreq').hide();
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
|
||||
$('a.save').click(function () {
|
||||
// gather data that doesn't have automatic change event bound
|
||||
|
@ -662,6 +695,10 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
PID_ADVANCED_CONFIG.motor_pwm_rate = parseInt($('input[name="unsyncedpwmfreq"]').val());
|
||||
PID_ADVANCED_CONFIG.gyro_sync_denom = parseInt(gyro_select_e.val());
|
||||
PID_ADVANCED_CONFIG.pid_process_denom = parseInt(pid_select_e.val());
|
||||
PID_ADVANCED_CONFIG.digitalIdlePercent = parseFloat($('input[name="digitalIdlePercent"]').val());
|
||||
if (semver.gte(CONFIG.apiVersion, "1.25.0")) {
|
||||
PID_ADVANCED_CONFIG.gyroUse32kHz = $('input[id="gyroUse32kHz"]').is(':checked') ? 1 : 0;
|
||||
}
|
||||
|
||||
function save_serial_config() {
|
||||
if (semver.lt(CONFIG.apiVersion, "1.6.0")) {
|
||||
|
@ -732,7 +769,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
var next_callback = save_name;
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||
SENSOR_CONFIG.acc_hardware = $('input[id="accHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||
SENSOR_CONFIG.baro_hardware = $('input[id="baroHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||
SENSOR_CONFIG.mag_hardware = $('input[id="magHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||
MSP.send_message(MSPCodes.MSP_SET_SENSOR_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_CONFIG), false, next_callback);
|
||||
|
|
Loading…
Reference in New Issue