Skip to content

Commit

Permalink
Merge pull request #267 from mikeller/move_rc_interpolation
Browse files Browse the repository at this point in the history
Moved RC interpolation settings into receiver tab.
  • Loading branch information
borisbstyle authored Sep 9, 2016
2 parents 8017002 + bd93134 commit 30a8261
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 88 deletions.
19 changes: 11 additions & 8 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -802,28 +802,31 @@
"pidTuningPidSettings": {
"message": "PID Controller Settings"
},
"pidTuningRcInterpolationHelp": {
"receiverRcInterpolation": {
"message": "RC Interpolation"
},
"receiverRcInterpolationHelp": {
"message": "RC TX/RX systems are not as fast as PID loops. That means that PID loop has gaps in the information stream from RC systems. This option enables interpolation of the RC input during the times when no RC frames are received. The option also offers cleaner P and D behaviour as there are no ramps in control input."
},
"pidTuningRcInterpolationIntervalHelp": {
"receiverRcInterpolationIntervalHelp": {
"message": "Interpolation interval for manual RC interpolation mode in milliseconds"
},
"pidTuningRcInterpolation": {
"receiverRcInterpolation": {
"message": "RC Interpolation"
},
"pidTuningRcInterpolationOff": {
"receiverRcInterpolationOff": {
"message": "Off"
},
"pidTuningRcInterpolationDefault": {
"receiverRcInterpolationDefault": {
"message": "Preset"
},
"pidTuningRcInterpolationAuto": {
"receiverRcInterpolationAuto": {
"message": "Auto"
},
"pidTuningRcInterpolationManual": {
"receiverRcInterpolationManual": {
"message": "Manual"
},
"pidTuningRcInterpolationInterval": {
"receiverRcInterpolationInterval": {
"message": "RC Interpolating Interval (ms)"
},
"pidTuningPtermSetpoint": {
Expand Down
10 changes: 5 additions & 5 deletions tabs/pid_tuning.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,25 @@
border-right: 0px solid #ccc;
}

.tab-pid_tuning .compensation td {
.tab-pid_tuning .pidTuningFeatures td {
padding: 5px;
}

.tab-pid_tuning .compensation td:first-child {
.tab-pid_tuning .pidTuningFeatures td:first-child {
width: 20%;
padding-bottom: 6px;
padding-top: 5px;
}

.tab-pid_tuning .compensation td:last-child {
.tab-pid_tuning .pidTuningFeatures td:last-child {
width: 80%;
}

.tab-pid_tuning .compensation td {
.tab-pid_tuning .pidTuningFeatures td {
width: 20%;
}

.tab-pid_tuning .compensation .slider input {
.tab-pid_tuning .pidTuningFeatures .slider input {
-webkit-appearance: slider-horizontal
}

Expand Down
33 changes: 2 additions & 31 deletions tabs/pid_tuning.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,45 +240,16 @@
</tr>
</table>
</div>
<div class="gui_box grey topspacer">
<div class="gui_box grey topspacer pidTuningFeatures">
<table class="pid_titlebar new_rates">
<tr>
<th i18n="pidTuningNonProfilePidSettings"></th>
</tr>
</table>
<table class="compensation">
<table class="pidTuningFeatures new_rates">
<tbody class="features pidTuning">
<!-- table generated here -->
</tbody>
<tr class="rcInterpolation">
<td>
<select name="rcInterpolation-select">
<option value="0" i18n="pidTuningRcInterpolationOff"/>
<option value="1" i18n="pidTuningRcInterpolationDefault"/>
<option value="2" i18n="pidTuningRcInterpolationAuto"/>
<option value="3" i18n="pidTuningRcInterpolationManual"/>
</select>
</td>
<td colspan=2>
<div>
<label>
<span i18n="pidTuningRcInterpolation"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningRcInterpolationHelp"></div>
</div>
</td>
</tr>
<tr class="rcInterpolationInterval">
<td><input type="number" class="nonProfile" name="rcInterpolationInterval-number" step="1" min="1" max="50"/></td>
<td colspan=2>
<div>
<label>
<span i18n="pidTuningRcInterpolationInterval"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningRcInterpolationIntervalHelp"></div>
</div>
</td>
</tr>
</table>
</div>
<div class="gui_box grey topspacer">
Expand Down
42 changes: 4 additions & 38 deletions tabs/pid_tuning.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ TABS.pid_tuning.initialize = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
return MSP.promise(MSPCodes.MSP_PID_ADVANCED);
}
}).then(function() {
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
return MSP.promise(MSPCodes.MSP_RX_CONFIG);
}
}).then(function() {
return MSP.promise(MSPCodes.MSP_RC_TUNING);
}).then(function() {
Expand Down Expand Up @@ -256,17 +252,11 @@ TABS.pid_tuning.initialize = function (callback) {
$('.pid_filter input[name="dTermNotchFrequency"]').val(FILTER_CONFIG.dterm_notch_hz);
$('.pid_filter input[name="dTermNotchCutoff"]').val(FILTER_CONFIG.dterm_notch_cutoff);

$('select[name="rcInterpolation-select"]').val(RX_CONFIG.rcInterpolation);

$('input[name="rcInterpolationInterval-number"]').val(RX_CONFIG.rcInterpolationInterval);

$('input[name="ptermSetpoint-number"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100);
$('input[name="ptermSetpoint-range"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100);

$('input[name="dtermSetpoint-number"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
$('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);

self.updateRcInterpolationParameters();
} else {
$('.pid_filter .newFilter').hide();
}
Expand Down Expand Up @@ -363,9 +353,6 @@ TABS.pid_tuning.initialize = function (callback) {
}

if (semver.gte(CONFIG.flightControllerVersion, '3.0.0')) {
RX_CONFIG.rcInterpolation = parseInt($('select[name="rcInterpolation-select"]').val());
RX_CONFIG.rcInterpolationInterval = parseInt($('input[name="rcInterpolationInterval-number"]').val());

ADVANCED_TUNING.ptermSetpointWeight = parseInt($('input[name="ptermSetpoint-number"]').val() * 100);
ADVANCED_TUNING.dtermSetpointWeight = parseInt($('input[name="dtermSetpoint-number"]').val() * 100);

Expand Down Expand Up @@ -454,7 +441,7 @@ TABS.pid_tuning.initialize = function (callback) {
}

var useLegacyCurve = false;
if (CONFIG.flightControllerIdentifier !== "BTFL" || semver.lt(CONFIG.flightControllerVersion, "2.8.0")) {
if (!semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
useLegacyCurve = true;
}

Expand All @@ -476,8 +463,10 @@ TABS.pid_tuning.initialize = function (callback) {
}

function process_html() {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0") && !semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
BF_CONFIG.features.generateElements($('.tab-pid_tuning .features'));
} else {
$('.tab-pid_tuning .pidTuningFeatures').hide();
}

// translate to user-selected language
Expand Down Expand Up @@ -604,9 +593,6 @@ TABS.pid_tuning.initialize = function (callback) {
} else {
$('.tab-pid_tuning .rate_profile').hide();

$('#pid-tuning .rcInterpolation').hide();
$('#pid-tuning .rcInterpolationInterval').hide();

$('#pid-tuning .ptermSetpoint').hide();
$('#pid-tuning .dtermSetpoint').hide();
}
Expand Down Expand Up @@ -826,12 +812,6 @@ TABS.pid_tuning.initialize = function (callback) {
self.updatePidControllerParameters();
});

if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
$('select[name="rcInterpolation-select"]').change(function () {
self.updateRcInterpolationParameters();
});
}

// update == save.
$('a.update').click(function () {
form_to_pid_and_rc();
Expand All @@ -855,10 +835,6 @@ TABS.pid_tuning.initialize = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
return MSP.promise(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED));
}
}).then(function () {
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
return MSP.promise(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG));
}
}).then(function () {
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
return MSP.promise(MSPCodes.MSP_SET_FILTER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FILTER_CONFIG));
Expand Down Expand Up @@ -1034,13 +1010,3 @@ TABS.pid_tuning.updatePidControllerParameters = function () {
}
}
}

TABS.pid_tuning.updateRcInterpolationParameters = function () {
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
if ($('select[name="rcInterpolation-select"]').val() === '3') {
$('#pid-tuning .rcInterpolationInterval').show();
} else {
$('#pid-tuning .rcInterpolationInterval').hide();
}
}
}
24 changes: 23 additions & 1 deletion tabs/receiver.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
float: right;
position: relative;
margin: 0px 0px 20px 0;
width: 100%
width: 100%;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
background-color: #DEDEDE;
Expand Down Expand Up @@ -304,6 +304,28 @@
width: calc(100% - 10px);
}

.tab-receiver .rcInterpolation td {
padding: 5px;
}

.tab-receiver .rcInterpolation td:first-child {
width: 20%;
padding-bottom: 6px;
padding-top: 5px;
}

.tab-receiver .rcInterpolation td:last-child {
width: 80%;
}

.tab-receiver .rcInterpolation td {
width: 20%;
}

.tab-receiver .rcInterpolation .slider input {
-webkit-appearance: slider-horizontal
}

.tab-receiver .curves {
float: left;
margin-right: 10px;
Expand Down
38 changes: 37 additions & 1 deletion tabs/receiver.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,43 @@
</tr>
</table>
</div>
<div class="gui_box grey topspacer">
<div class="gui_box grey tunings topspacer rcInterpolation">
<table class="rcInterpolation" width="100%">
<tr>
<th colspan=2 i18n="receiverRcInterpolation"></th>
</tr>
<tr class="rcInterpolation">
<td>
<select name="rcInterpolation-select">
<option value="0" i18n="receiverRcInterpolationOff"/>
<option value="1" i18n="receiverRcInterpolationDefault"/>
<option value="2" i18n="receiverRcInterpolationAuto"/>
<option value="3" i18n="receiverRcInterpolationManual"/>
</select>
</td>
<td>
<div>
<label>
<span i18n="receiverRcInterpolation"></span>
</label>
<div class="helpicon cf_tip" i18n_title="receiverRcInterpolationHelp"></div>
</div>
</td>
</tr>
<tr class="rcInterpolationInterval">
<td><input type="number" class="nonProfile" name="rcInterpolationInterval-number" step="1" min="1" max="50"/></td>
<td>
<div>
<label>
<span i18n="receiverRcInterpolationInterval"></span>
</label>
<div class="helpicon cf_tip" i18n_title="receiverRcInterpolationIntervalHelp"></div>
</div>
</td>
</tr>
</table>
</div>
<div class="gui_box grey tunings topspacer">
<table class="pid_titlebar" style="width: 100%;">
<thead>
<tr>
Expand Down
Loading

0 comments on commit 30a8261

Please sign in to comment.