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

Adding Dynamic Idle

This commit is contained in:
Asizon 2020-03-04 10:36:32 +01:00
parent aef32bb63e
commit 6aaababb1d
5 changed files with 53 additions and 8 deletions

View file

@ -1227,6 +1227,12 @@
"configurationDigitalIdlePercentHelp": { "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." "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."
}, },
"configurationIdleMinRpm": {
"message": "Dynamic Idle Value [rpm]"
},
"configurationIdleMinRpmHelp": {
"message": "PIDPROFILE Value, visit this <a href=\"https://github.com/betaflight/betaflight/wiki/Tuning-Dynamic-Idle\"target=\"_blank\">page</a> "
},
"configurationMotorPoles": { "configurationMotorPoles": {
"message": "Motor poles", "message": "Motor poles",
"description": "One of the fields of the ESC/Motor configuration" "description": "One of the fields of the ESC/Motor configuration"

View file

@ -460,6 +460,7 @@ var FC = {
integratedYawRelax: 0, integratedYawRelax: 0,
motorOutputLimit: 0, motorOutputLimit: 0,
autoProfileCellCount: 0, autoProfileCellCount: 0,
idleMinRpm: 0,
}; };
ADVANCED_TUNING_ACTIVE = { ...ADVANCED_TUNING }; ADVANCED_TUNING_ACTIVE = { ...ADVANCED_TUNING };

View file

@ -1146,6 +1146,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
if(semver.gte(CONFIG.apiVersion, "1.43.0")) { if(semver.gte(CONFIG.apiVersion, "1.43.0")) {
ADVANCED_TUNING.motorOutputLimit = data.readU8(); ADVANCED_TUNING.motorOutputLimit = data.readU8();
ADVANCED_TUNING.autoProfileCellCount = data.readU8(); ADVANCED_TUNING.autoProfileCellCount = data.readU8();
ADVANCED_TUNING.idleMinRpm = data.readU8();
} }
} }
} }
@ -2079,7 +2080,8 @@ MspHelper.prototype.crunch = function(code) {
if (semver.gte(CONFIG.apiVersion, "1.43.0")) { if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
buffer.push8(ADVANCED_TUNING.motorOutputLimit) buffer.push8(ADVANCED_TUNING.motorOutputLimit)
.push8(ADVANCED_TUNING.autoProfileCellCount); .push8(ADVANCED_TUNING.autoProfileCellCount)
.push8(ADVANCED_TUNING.idleMinRpm);
} }
} }
} }

View file

@ -181,7 +181,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
function load_rx_config() { function load_rx_config() {
var next_callback = load_html; var next_callback = load_profile_features;
if (semver.gte(CONFIG.apiVersion, "1.31.0")) { if (semver.gte(CONFIG.apiVersion, "1.31.0")) {
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, next_callback); MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, next_callback);
} else { } else {
@ -189,6 +189,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
} }
function load_profile_features() {
var next_callback = load_html;
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
MSP.send_message(MSPCodes.MSP_PID_ADVANCED, false, false, next_callback);
} else {
next_callback();
}
}
function load_html() { function load_html() {
$('#content').load("./tabs/configuration.html", process_html); $('#content').load("./tabs/configuration.html", process_html);
} }
@ -516,9 +525,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('input[name="motorPoles"]').val(MOTOR_CONFIG.motor_poles); $('input[name="motorPoles"]').val(MOTOR_CONFIG.motor_poles);
} }
function hideMotorPoles() { if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
let motorPolesVisible = $("input[id='dshotBidir']").is(':checked') || $("input[name='ESC_SENSOR']").is(':checked'); $('input[name="idleMinRpm"]').val(ADVANCED_TUNING.idleMinRpm);
$('div.motorPoles').toggle(motorPolesVisible); }
function hideRpmFeatures() {
let rpmFeaturesVisible = $("input[id='dshotBidir']").is(':checked') || $("input[name='ESC_SENSOR']").is(':checked');
$('div.motorPoles').toggle(rpmFeaturesVisible);
$('div.idleMinRpm').toggle(rpmFeaturesVisible);
} }
$('#escProtocolTooltip').toggle(semver.lt(CONFIG.apiVersion, "1.42.0")); $('#escProtocolTooltip').toggle(semver.lt(CONFIG.apiVersion, "1.42.0"));
@ -548,9 +562,10 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('div.checkboxDshotBidir').toggle(semver.gte(CONFIG.apiVersion, "1.42.0") && digitalProtocol); $('div.checkboxDshotBidir').toggle(semver.gte(CONFIG.apiVersion, "1.42.0") && digitalProtocol);
$('div.motorPoles').toggle(semver.gte(CONFIG.apiVersion, "1.42.0")); $('div.motorPoles').toggle(semver.gte(CONFIG.apiVersion, "1.42.0"));
$('div.idleMinRpm').toggle(semver.gte(CONFIG.apiVersion, "1.43.0"));
//trigger change dshotBidir and ESC_SENSOR to show/hide Motor Poles tab //trigger change dshotBidir and ESC_SENSOR to show/hide Motor Poles tab
$("input[id='dshotBidir']").change(hideMotorPoles).change(); $("input[id='dshotBidir']").change(hideRpmFeatures).change();
$("input[name='ESC_SENSOR']").change(hideMotorPoles); $("input[name='ESC_SENSOR']").change(hideRpmFeatures);
//trigger change unsyncedPWMSwitch to show/hide Motor PWM freq input //trigger change unsyncedPWMSwitch to show/hide Motor PWM freq input
$("input[id='unsyncedPWMSwitch']").change(); $("input[id='unsyncedPWMSwitch']").change();
@ -1167,6 +1182,9 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
if(semver.gte(CONFIG.apiVersion, "1.42.0")) { if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
MOTOR_CONFIG.motor_poles = parseInt($('input[name="motorPoles"]').val()); MOTOR_CONFIG.motor_poles = parseInt($('input[name="motorPoles"]').val());
} }
if(semver.gte(CONFIG.apiVersion, "1.43.0")) {
ADVANCED_TUNING.idleMinRpm = parseInt($('input[name="idleMinRpm"]').val());
}
if(self.SHOW_OLD_BATTERY_CONFIG) { if(self.SHOW_OLD_BATTERY_CONFIG) {
MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val()); MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val());
@ -1343,7 +1361,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
function save_rx_config() { function save_rx_config() {
var next_callback = save_to_eeprom; var next_callback = save_profile_features;
if (semver.gte(CONFIG.apiVersion, "1.20.0")) { if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, next_callback); MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, next_callback);
} else { } else {
@ -1351,6 +1369,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
} }
function save_profile_features() {
var next_callback = save_to_eeprom;
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
MSP.send_message(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED), false, next_callback);
} else {
next_callback();
}
}
function save_to_eeprom() { function save_to_eeprom() {
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot); MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
} }

View file

@ -209,6 +209,15 @@
</label> </label>
<div class="helpicon cf_tip" i18n_title="configurationDigitalIdlePercentHelp"></div> <div class="helpicon cf_tip" i18n_title="configurationDigitalIdlePercentHelp"></div>
</div> </div>
<div class="number idleMinRpm">
<label>
<div class="numberspacer">
<input type="number" name="idleMinRpm" min="0" max="100" step="1"/>
</div>
<span i18n="configurationIdleMinRpm"></span>
</label>
<div class="helpicon cf_tip" i18n_title="configurationIdleMinRpmHelp"></div>
</div>
<div class="number minthrottle"> <div class="number minthrottle">
<label> <label>
<div class="numberspacer"> <div class="numberspacer">