1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 00:05:19 +03:00

rates in dps for iNav > 1.1.0, see iNavFlight#204

This commit is contained in:
Pawel 2016-05-15 18:20:21 +02:00
parent 61ebb7a455
commit e9d2563dad
5 changed files with 216 additions and 142 deletions

View file

@ -37,6 +37,13 @@ var FAILSAFE_CONFIG;
var RXFAIL_CONFIG;
var FC = {
isRatesInDps: function () {
if (typeof CONFIG != "undefined" && CONFIG.flightControllerIdentifier == "INAV" && semver.gt(CONFIG.flightControllerVersion, "1.1.0")) {
return true;
} else {
return false;
}
},
resetState: function() {
CONFIG = {
apiVersion: "0.0.0",

View file

@ -351,12 +351,19 @@ var MSP = {
RC_tuning.roll_pitch_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.pitch_rate = 0;
RC_tuning.roll_rate = 0;
RC_tuning.yaw_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
} else if (FC.isRatesInDps()) {
RC_tuning.roll_pitch_rate = 0;
RC_tuning.roll_rate = parseFloat((data.getUint8(offset++) * 10));
RC_tuning.pitch_rate = parseFloat((data.getUint8(offset++) * 10));
RC_tuning.yaw_rate = parseFloat((data.getUint8(offset++) * 10));
} else {
RC_tuning.roll_pitch_rate = 0;
RC_tuning.roll_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.pitch_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
}
RC_tuning.yaw_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
}
RC_tuning.dynamic_THR_PID = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.throttle_MID = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.throttle_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
@ -1168,11 +1175,17 @@ MSP.crunch = function (code) {
buffer.push(Math.round(RC_tuning.RC_EXPO * 100));
if (semver.lt(CONFIG.apiVersion, "1.7.0")) {
buffer.push(Math.round(RC_tuning.roll_pitch_rate * 100));
buffer.push(Math.round(RC_tuning.yaw_rate * 100));
} else if (FC.isRatesInDps()) {
buffer.push(Math.round(RC_tuning.roll_rate / 10));
buffer.push(Math.round(RC_tuning.pitch_rate / 10));
buffer.push(Math.round(RC_tuning.yaw_rate / 10));
} else {
buffer.push(Math.round(RC_tuning.roll_rate * 100));
buffer.push(Math.round(RC_tuning.pitch_rate * 100));
}
buffer.push(Math.round(RC_tuning.yaw_rate * 100));
}
buffer.push(Math.round(RC_tuning.dynamic_THR_PID * 100));
buffer.push(Math.round(RC_tuning.throttle_MID * 100));
buffer.push(Math.round(RC_tuning.throttle_EXPO * 100));
@ -1688,5 +1701,3 @@ MSP.SDCARD_STATE_FATAL = 1;
MSP.SDCARD_STATE_CARD_INIT = 2;
MSP.SDCARD_STATE_FS_INIT = 3;
MSP.SDCARD_STATE_READY = 4;

View file

@ -1,3 +1,25 @@
.rate-tpa.rate-tpa--inav input[type="number"] {
margin: 4px;
width: auto;
border: 1px solid silver;
border-radius: 3px;
display: inline-block;
}
.rate-tpa.rate-tpa--inav td {
background-color: #DEDEDE;
width: auto;
border-bottom: 1px solid #ccc;
}
.tab-pid_tuning .rate-tpa.rate-tpa--inav th:first-child {
border-top-left-radius: 0;
}
.tab-pid_tuning .rate-tpa.rate-tpa--inav .roll {
border-bottom-left-radius: 0;
}
.tab-pid_tuning .rate-tpa th {
background-color: #828885;
padding: 4px;

View file

@ -154,7 +154,29 @@
</div>
<div class="cf_column half">
<div class="spacer_left">
<table class="rate-tpa cf">
<table class="rate-tpa rate-tpa--inav">
<tbody>
<tr>
<th class="roll" i18n="pidTuningRollRate"></th>
<td class="roll">
<input type="number" name="roll" step="10" min="60" max="1800" /> degrees per second
</td>
</tr>
<tr>
<th class="pitch" i18n="pidTuningPitchRate"></th>
<td class="pitch">
<input type="number" name="pitch" step="10" min="60" max="1800" /> degrees per second
</td>
</tr>
<tr>
<th class="yaw" i18n="pidTuningYawRate"></th>
<td class="yaw">
<input type="number" name="yaw" step="10" min="20" max="1800" /> degrees per second
</td>
</tr>
</tbody>
</table>
<table class="rate-tpa rate-tpa--no-dps cf">
<thead>
<tr>
<th class="roll-pitch" i18n="pidTuningRollPitchRate"></th>

View file

@ -173,9 +173,17 @@ TABS.pid_tuning.initialize = function (callback) {
// Fill in data from RC_tuning object
$('.rate-tpa input[name="roll-pitch"]').val(RC_tuning.roll_pitch_rate.toFixed(2));
if (FC.isRatesInDps()) {
$('.rate-tpa input[name="roll"]').val(RC_tuning.roll_rate);
$('.rate-tpa input[name="pitch"]').val(RC_tuning.pitch_rate);
$('.rate-tpa input[name="yaw"]').val(RC_tuning.yaw_rate);
} else {
$('.rate-tpa input[name="roll"]').val(RC_tuning.roll_rate.toFixed(2));
$('.rate-tpa input[name="pitch"]').val(RC_tuning.pitch_rate.toFixed(2));
$('.rate-tpa input[name="yaw"]').val(RC_tuning.yaw_rate.toFixed(2));
}
$('.rate-tpa input[name="tpa"]').val(RC_tuning.dynamic_THR_PID.toFixed(2));
$('.rate-tpa input[name="tpa-breakpoint"]').val(RC_tuning.dynamic_THR_breakpoint);
}
@ -234,9 +242,9 @@ TABS.pid_tuning.initialize = function (callback) {
// catch RC_tuning changes
RC_tuning.roll_pitch_rate = parseFloat($('.rate-tpa input[name="roll-pitch"]').val());
RC_tuning.roll_rate = parseFloat($('.rate-tpa input[name="roll"]').val());
RC_tuning.pitch_rate = parseFloat($('.rate-tpa input[name="pitch"]').val());
RC_tuning.yaw_rate = parseFloat($('.rate-tpa input[name="yaw"]').val());
RC_tuning.roll_rate = parseFloat($('.rate-tpa input[name="roll"]:visible').val());
RC_tuning.pitch_rate = parseFloat($('.rate-tpa input[name="pitch"]:visible').val());
RC_tuning.yaw_rate = parseFloat($('.rate-tpa input[name="yaw"]:visible').val());
RC_tuning.dynamic_THR_PID = parseFloat($('.rate-tpa input[name="tpa"]').val());
RC_tuning.dynamic_THR_breakpoint = parseInt($('.rate-tpa input[name="tpa-breakpoint"]').val());
}
@ -336,8 +344,12 @@ TABS.pid_tuning.initialize = function (callback) {
$('.rate-tpa .tpa-breakpoint').hide();
$('.rate-tpa .roll').hide();
$('.rate-tpa .pitch').hide();
$('.rate-tpa--inav').hide();
} else if (FC.isRatesInDps()) {
$('.rate-tpa--no-dps').hide();
} else {
$('.rate-tpa .roll-pitch').hide();
$('.rate-tpa--inav').hide();
}
// UI Hooks