Merge pull request #1234 from etracer65/add_throttle_limit

Add throttle limit to PID Tuning tab
10.5.x-maintenance
Michael Keller 2018-11-26 21:50:44 +13:00 committed by GitHub
commit 87344cb986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 102 additions and 0 deletions

View File

@ -1440,6 +1440,27 @@
"pidTuningTPABreakPoint": {
"message": "TPA Breakpoint"
},
"pidTuningThrottleLimitType": {
"message": "Throttle Limit"
},
"pidTuningThrottleLimitPercent": {
"message": "Throttle Limit %"
},
"pidTuningThrottleLimitTypeOff": {
"message": "OFF"
},
"pidTuningThrottleLimitTypeScale": {
"message": "SCALE"
},
"pidTuningThrottleLimitTypeClip": {
"message": "CLIP"
},
"pidTuningThrottleLimitTypeTip": {
"message": "Select the type of throttle limiting. <b>OFF</b> disables the feature, <b>SCALE</b> will transform the throttle range from 0 to the selected percentage using the full stick travel, <b>CLIP</b> will set a max throttle percentage and stick travel above that will have no additional effect"
},
"pidTuningThrottleLimitPercentTip": {
"message": "Set the desired throttle limit percentage. Setting to 100% disables the feature."
},
"pidTuningFilter": {
"message": "Filter"
},

View File

@ -8,6 +8,16 @@
text-align: left;
}
.tab-pid_tuning .throttle_limit th {
background-color: #828885;
padding: 4px;
border-left: 0px solid #ccc;
border-bottom: 1px solid #ccc;
font-weight: bold;
color: white;
text-align: left;
}
.tab-pid_tuning .cf tr {
background-color: #DEDEDE;
}
@ -178,6 +188,18 @@
border-top-right-radius: 3px;
}
.tab-pid_tuning .throttle_limit th:nth-child(2) {
border-top-left-radius: 3px;
}
.tab-pid_tuning .throttle_limit th:first-child {
border-top-left-radius: 3px;
}
.tab-pid_tuning .throttle_limit th:last-child {
border-top-right-radius: 3px;
}
.tab-pid_tuning .rc_curve {
float: right;
width: calc(100% - 2px); /* - ( "virtual" margin) */
@ -437,6 +459,11 @@
width: calc(100% - 2px); /* - ( "virtual" margin) */
}
.tab-pid_tuning .throttle_limit {
float: right;
width: calc(100% - 2px); /* - ( "virtual" margin) */
}
.tab-pid_tuning .top-buttons {
float: right;
}

View File

@ -320,6 +320,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
RC_tuning.rcPitchRate = 0;
RC_tuning.RC_PITCH_EXPO = 0;
}
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
RC_tuning.throttleLimitType = data.readU8();
RC_tuning.throttleLimitPercent = data.readU8();
}
break;
case MSPCodes.MSP_PID:
// PID data arrived, we need to scale it and save to appropriate bank / array
@ -1347,6 +1351,10 @@ MspHelper.prototype.crunch = function(code) {
buffer.push8(Math.round(RC_tuning.rcPitchRate * 100));
buffer.push8(Math.round(RC_tuning.RC_PITCH_EXPO * 100));
}
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
buffer.push8(RC_tuning.throttleLimitType);
buffer.push8(RC_tuning.throttleLimitPercent);
}
break;
case MSPCodes.MSP_SET_RX_MAP:
for (var i = 0; i < RC_MAP.length; i++) {

View File

@ -308,6 +308,13 @@ TABS.pid_tuning.initialize = function (callback) {
$('.antigravity table td:first-child').hide();
}
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
$('select[id="throttleLimitType"]').val(RC_tuning.throttleLimitType);
$('.throttle_limit input[name="throttleLimitPercent"]').val(RC_tuning.throttleLimitPercent);
} else {
$('.throttle_limit').hide();
}
$('input[id="gyroNotch1Enabled"]').change(function() {
var checked = $(this).is(':checked');
var hz = FILTER_CONFIG.gyro_notch_hz > 0 ? FILTER_CONFIG.gyro_notch_hz : DEFAULT.gyro_notch_hz;
@ -520,6 +527,12 @@ TABS.pid_tuning.initialize = function (callback) {
ADVANCED_TUNING.antiGravityMode = $('select[id="antiGravityMode"]').val();
}
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
RC_tuning.throttleLimitType = $('select[id="throttleLimitType"]').val();
RC_tuning.throttleLimitPercent = parseInt($('.throttle_limit input[name="throttleLimitPercent"]').val());
}
}
function showAllPids() {

View File

@ -582,6 +582,39 @@
</tbody>
</table>
</div>
<div class="spacer_left topspacer throttle_limit">
<table class="cf">
<thead>
<tr>
<th>
<div>
<div i18n="pidTuningThrottleLimitType" style="float:left;"></div>
<div class="helpicon cf_tip" i18n_title="pidTuningThrottleLimitTypeTip"></div>
</div>
</th>
<th>
<div>
<div i18n="pidTuningThrottleLimitPercent" style="float:left;"></div>
<div class="helpicon cf_tip" i18n_title="pidTuningThrottleLimitPercentTip"></div>
</div>
</th>
</tr>
</thead>
<tbody>
<tr style="height: 35px;">
<td>
<select id="throttleLimitType">
<option i18n="pidTuningThrottleLimitTypeOff" value="0">
<option i18n="pidTuningThrottleLimitTypeScale" value="1">
<option i18n="pidTuningThrottleLimitTypeClip" value="2">
</select>
</td>
<td><input type="number" name="throttleLimitPercent" step="1" min="25" max="100" /></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>