Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Motor Output Limit and Profile Cell Count #1901

Merged
merged 1 commit into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3278,6 +3278,21 @@
"pidTuningLevelHelp": {
"message": "The values below change the behaviour of the ANGLE and HORIZON flight modes. Different PID controllers handle the values differently. Please check the documentation."
},
"pidTuningMotorOutputLimit": {
"message": "Motor Output Limit"
},
"pidTuningMotorLimit": {
"message": "Attenuation %"
},
"pidTuningMotorLimitHelp": {
"message": "Attenuates motor commands by the set percentage. Reduces ESC current and motor heat when using higher cell count batteries, e.g. for similar performance from a 6S battery on a 4S build, try 66%; for a 4S battery on a 3S build, try 75%."
},
"pidTuningCellCount": {
"message": "Cell Count"
},
"pidTuningCellCountHelp": {
"message": "Automatically activates the first profile that has a cell count equal to the connected battery."
},
"pidTuningNonProfileFilterSettings": {
"message": "Profile independent Filter Settings"
},
Expand Down
2 changes: 2 additions & 0 deletions src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ var FC = {
dMinAdvance: 0,
useIntegratedYaw: 0,
integratedYawRelax: 0,
motorOutputLimit: 0,
autoProfileCellCount: 0,
};
ADVANCED_TUNING_ACTIVE = { ...ADVANCED_TUNING };

Expand Down
10 changes: 10 additions & 0 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,11 @@ MspHelper.prototype.process_data = function(dataHandler) {

if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
ADVANCED_TUNING.itermRelaxCutoff = data.readU8();

if(semver.gte(CONFIG.apiVersion, "1.43.0")) {
ADVANCED_TUNING.motorOutputLimit = data.readU8();
ADVANCED_TUNING.autoProfileCellCount = data.readU8();
}
}
}
}
Expand Down Expand Up @@ -2071,6 +2076,11 @@ MspHelper.prototype.crunch = function(code) {

if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
buffer.push8(ADVANCED_TUNING.itermRelaxCutoff);

if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
buffer.push8(ADVANCED_TUNING.motorOutputLimit)
.push8(ADVANCED_TUNING.autoProfileCellCount);
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/js/tabs/pid_tuning.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,13 @@ TABS.pid_tuning.initialize = function (callback) {
$('.rpmFilter').hide();
}

if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
$('.pid_tuning input[name="motorLimit"]').val(ADVANCED_TUNING.motorOutputLimit);
$('.pid_tuning input[name="cellCount"]').val(ADVANCED_TUNING.autoProfileCellCount);
} else {
$('.motorOutputLimit').hide();
}

$('input[id="useIntegratedYaw"]').change(function() {
var checked = $(this).is(':checked');
$('#pidTuningIntegratedYawCaution').toggle(checked);
Expand Down Expand Up @@ -767,6 +774,8 @@ TABS.pid_tuning.initialize = function (callback) {

if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
FILTER_CONFIG.dyn_notch_max_hz = parseInt($('.pid_filter input[name="dynamicNotchMaxHz"]').val());
ADVANCED_TUNING.motorOutputLimit = parseInt($('.pid_tuning input[name="motorLimit"]').val());
ADVANCED_TUNING.autoProfileCellCount = parseInt($('.pid_tuning input[name="cellCount"]').val());
}
}

Expand Down
35 changes: 35 additions & 0 deletions src/tabs/pid_tuning.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,41 @@
</tr>
</table>
</div>
<div class="gui_box grey topspacer pid_tuning">
<table class="pid_tuning motorOutputLimit">
<tr>
<th colspan="3">
<div class="pid_mode">
<div i18n="pidTuningMotorOutputLimit" style="float:left;"></div>
</div>
</th>
</tr>
</table>
<table class="pid_titlebar motorOutputLimit">
<tr>
<th class="third"></th>
<th class="third" style="width: 33%;">
<div>
<div i18n="pidTuningMotorLimit" style="float:left;"></div>
<div class="helpicon cf_tip" i18n_title="pidTuningMotorLimitHelp"></div>
</div>
</th>
<th class="third" style="width: 33%;">
<div>
<div i18n="pidTuningCellCount" style="float:left;"></div>
<div class="helpicon cf_tip" i18n_title="pidTuningCellCountHelp"></div>
</div>
</th>
</tr>
</table>
<table class="motorOutputLimit">
<tr>
<td class="third"></td>
<td class="third"><input type="number" name="motorLimit" step="1" min="1" max="100" /></td>
<td class="third"><input type="number" name="cellCount" step="1" min="-1" max="8" /></td>
</tr>
</table>
</div>
</div>

<div class="cf_column">
Expand Down