mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 12:25:13 +03:00
Support independent configuration of pitch and roll rates. Cleanup of
tpa breakpoint configuration support.
This commit is contained in:
parent
dd7efa9e54
commit
4b2704e784
6 changed files with 92 additions and 25 deletions
|
@ -567,6 +567,12 @@
|
|||
"pidTuningRollPitchRate": {
|
||||
"message": "ROLL & PITCH rate"
|
||||
},
|
||||
"pidTuningRollRate": {
|
||||
"message": "ROLL rate"
|
||||
},
|
||||
"pidTuningPitchRate": {
|
||||
"message": "PITCH rate"
|
||||
},
|
||||
"pidTuningYawRate": {
|
||||
"message": "YAW rate"
|
||||
},
|
||||
|
|
|
@ -330,6 +330,30 @@ function configuration_restore(callback) {
|
|||
appliedMigrationsCount++;
|
||||
}
|
||||
|
||||
if (!compareVersions(migratedVersion, '0.63.0')) {
|
||||
|
||||
// Serial configuation redesigned. Until a migration is written just reset the serial port configuration
|
||||
configuration.SERIAL_CONFIG = {
|
||||
ports: []
|
||||
};
|
||||
|
||||
for (var profileIndex = 0; profileIndex < 3; profileIndex++) {
|
||||
var RC = configuration.profiles[profileIndex].RC;
|
||||
// TPA breakpoint was added
|
||||
if (!RC.dynamic_THR_breakpoint) {
|
||||
RC.dynamic_THR_breakpoint = 1500; // firmware default
|
||||
}
|
||||
|
||||
// Roll and pitch rates were split
|
||||
RC.roll_rate = RC.roll_pitch_rate;
|
||||
RC.pitch_rate = RC.roll_pitch_rate;
|
||||
}
|
||||
|
||||
migratedVersion = '0.63.0';
|
||||
GUI.log(chrome.i18n.getMessage('configMigratedTo', [migratedVersion]));
|
||||
appliedMigrationsCount++;
|
||||
}
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,9 @@ var RC = {
|
|||
var RC_tuning = {
|
||||
RC_RATE: 0,
|
||||
RC_EXPO: 0,
|
||||
roll_pitch_rate: 0,
|
||||
roll_pitch_rate: 0, // pre 1.7 api only
|
||||
roll_rate: 0,
|
||||
pitch_rate: 0,
|
||||
yaw_rate: 0,
|
||||
dynamic_THR_PID: 0,
|
||||
throttle_MID: 0,
|
||||
|
|
31
js/msp.js
31
js/msp.js
|
@ -288,14 +288,22 @@ var MSP = {
|
|||
ANALOG.amperage = data.getInt16(5, 1) / 100; // A
|
||||
break;
|
||||
case MSP_codes.MSP_RC_TUNING:
|
||||
RC_tuning.RC_RATE = parseFloat((data.getUint8(0) / 100).toFixed(2));
|
||||
RC_tuning.RC_EXPO = parseFloat((data.getUint8(1) / 100).toFixed(2));
|
||||
RC_tuning.roll_pitch_rate = parseFloat((data.getUint8(2) / 100).toFixed(2));
|
||||
RC_tuning.yaw_rate = parseFloat((data.getUint8(3) / 100).toFixed(2));
|
||||
RC_tuning.dynamic_THR_PID = parseFloat((data.getUint8(4) / 100).toFixed(2));
|
||||
RC_tuning.throttle_MID = parseFloat((data.getUint8(5) / 100).toFixed(2));
|
||||
RC_tuning.throttle_EXPO = parseFloat((data.getUint8(6) / 100).toFixed(2));
|
||||
RC_tuning.dynamic_THR_breakpoint = parseInt(data.getUint16(7, 1));
|
||||
var offset = 0;
|
||||
RC_tuning.RC_RATE = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
|
||||
RC_tuning.RC_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
|
||||
if (CONFIG.apiVersion < 1.7) {
|
||||
RC_tuning.roll_pitch_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
|
||||
} else {
|
||||
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));
|
||||
if (CONFIG.apiVersion >= 1.7) {
|
||||
RC_tuning.dynamic_THR_breakpoint = data.getUint16(offset++, 1);
|
||||
}
|
||||
break;
|
||||
case MSP_codes.MSP_PID:
|
||||
// PID data arrived, we need to scale it and save to appropriate bank / array
|
||||
|
@ -913,13 +921,20 @@ MSP.crunch = function (code) {
|
|||
case MSP_codes.MSP_SET_RC_TUNING:
|
||||
buffer.push(parseInt(RC_tuning.RC_RATE * 100));
|
||||
buffer.push(parseInt(RC_tuning.RC_EXPO * 100));
|
||||
if (CONFIG.apiVersion < 1.7) {
|
||||
buffer.push(parseInt(RC_tuning.roll_pitch_rate * 100));
|
||||
} else {
|
||||
buffer.push(parseInt(RC_tuning.roll_rate * 100));
|
||||
buffer.push(parseInt(RC_tuning.pitch_rate * 100));
|
||||
}
|
||||
buffer.push(parseInt(RC_tuning.yaw_rate * 100));
|
||||
buffer.push(parseInt(RC_tuning.dynamic_THR_PID * 100));
|
||||
buffer.push(parseInt(RC_tuning.throttle_MID * 100));
|
||||
buffer.push(parseInt(RC_tuning.throttle_EXPO * 100));
|
||||
if (CONFIG.apiVersion >= 1.7) {
|
||||
buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint));
|
||||
buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint));
|
||||
}
|
||||
break;
|
||||
// Disabled, cleanflight does not use MSP_SET_BOX.
|
||||
/*
|
||||
|
|
|
@ -79,18 +79,26 @@
|
|||
</tr>
|
||||
</table>
|
||||
<table class="rate-tpa">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="pidTuningRollPitchRate"></th>
|
||||
<th class="roll-pitch" i18n="pidTuningRollPitchRate"></th>
|
||||
<th class="roll" i18n="pidTuningRollRate"></th>
|
||||
<th class="pitch" i18n="pidTuningPitchRate"></th>
|
||||
<th i18n="pidTuningYawRate"></th>
|
||||
<th i18n="pidTuningTPA"></th>
|
||||
<th i18n="pidTuningTPABreakPoint" class="tpa"></th>
|
||||
<th class="tpa-breakpoint" i18n="pidTuningTPABreakPoint"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="number" name="roll-pitch" step="0.01" min="0" max="2.55"/></td>
|
||||
<td class="roll-pitch" ><input type="number" name="roll-pitch" step="0.01" min="0" max="2.55"/></td>
|
||||
<td class="roll" ><input type="number" name="roll" step="0.01" min="0" max="2.55"/></td>
|
||||
<td class="pitch" ><input type="number" name="pitch" step="0.01" min="0" max="2.55"/></td>
|
||||
<td><input type="number" name="yaw" step="0.01" min="0" max="2.55"/></td>
|
||||
<td><input type="number" name="tpa" step="0.01" min="0" max="2.55"/></td>
|
||||
<td><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td>
|
||||
<td class="tpa-breakpoint"><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<div class="clear-both"></div>
|
||||
|
|
|
@ -173,6 +173,8 @@ 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));
|
||||
$('.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);
|
||||
|
@ -232,6 +234,8 @@ 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.dynamic_THR_PID = parseFloat($('.rate-tpa input[name="tpa"]').val());
|
||||
RC_tuning.dynamic_THR_breakpoint = parseInt($('.rate-tpa input[name="tpa-breakpoint"]').val());
|
||||
|
@ -271,6 +275,14 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
pidController_e.prop('disabled', true);
|
||||
}
|
||||
|
||||
if (CONFIG.apiVersion < 1.7) {
|
||||
$('.rate-tpa .tpa-breakpoint').hide();
|
||||
$('.rate-tpa .roll').hide();
|
||||
$('.rate-tpa .pitch').hide();
|
||||
} else {
|
||||
$('.rate-tpa .roll-pitch').hide();
|
||||
}
|
||||
|
||||
// Fill in currently selected profile
|
||||
|
||||
profile_e.val(CONFIG.profile);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue