1
0
Fork 0
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:
Dominic Clifton 2015-03-11 21:56:02 +00:00
parent dd7efa9e54
commit 4b2704e784
6 changed files with 92 additions and 25 deletions

View file

@ -567,6 +567,12 @@
"pidTuningRollPitchRate": { "pidTuningRollPitchRate": {
"message": "ROLL & PITCH rate" "message": "ROLL & PITCH rate"
}, },
"pidTuningRollRate": {
"message": "ROLL rate"
},
"pidTuningPitchRate": {
"message": "PITCH rate"
},
"pidTuningYawRate": { "pidTuningYawRate": {
"message": "YAW rate" "message": "YAW rate"
}, },

View file

@ -330,6 +330,30 @@ function configuration_restore(callback) {
appliedMigrationsCount++; 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])); GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
return true; return true;
} }

View file

@ -65,7 +65,9 @@ var RC = {
var RC_tuning = { var RC_tuning = {
RC_RATE: 0, RC_RATE: 0,
RC_EXPO: 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, yaw_rate: 0,
dynamic_THR_PID: 0, dynamic_THR_PID: 0,
throttle_MID: 0, throttle_MID: 0,

View file

@ -288,14 +288,22 @@ var MSP = {
ANALOG.amperage = data.getInt16(5, 1) / 100; // A ANALOG.amperage = data.getInt16(5, 1) / 100; // A
break; break;
case MSP_codes.MSP_RC_TUNING: case MSP_codes.MSP_RC_TUNING:
RC_tuning.RC_RATE = parseFloat((data.getUint8(0) / 100).toFixed(2)); var offset = 0;
RC_tuning.RC_EXPO = parseFloat((data.getUint8(1) / 100).toFixed(2)); RC_tuning.RC_RATE = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.roll_pitch_rate = parseFloat((data.getUint8(2) / 100).toFixed(2)); RC_tuning.RC_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.yaw_rate = parseFloat((data.getUint8(3) / 100).toFixed(2)); if (CONFIG.apiVersion < 1.7) {
RC_tuning.dynamic_THR_PID = parseFloat((data.getUint8(4) / 100).toFixed(2)); RC_tuning.roll_pitch_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.throttle_MID = parseFloat((data.getUint8(5) / 100).toFixed(2)); } else {
RC_tuning.throttle_EXPO = parseFloat((data.getUint8(6) / 100).toFixed(2)); RC_tuning.roll_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.dynamic_THR_breakpoint = parseInt(data.getUint16(7, 1)); 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; break;
case MSP_codes.MSP_PID: case MSP_codes.MSP_PID:
// PID data arrived, we need to scale it and save to appropriate bank / array // 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: case MSP_codes.MSP_SET_RC_TUNING:
buffer.push(parseInt(RC_tuning.RC_RATE * 100)); buffer.push(parseInt(RC_tuning.RC_RATE * 100));
buffer.push(parseInt(RC_tuning.RC_EXPO * 100)); buffer.push(parseInt(RC_tuning.RC_EXPO * 100));
buffer.push(parseInt(RC_tuning.roll_pitch_rate * 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.yaw_rate * 100));
buffer.push(parseInt(RC_tuning.dynamic_THR_PID * 100)); buffer.push(parseInt(RC_tuning.dynamic_THR_PID * 100));
buffer.push(parseInt(RC_tuning.throttle_MID * 100)); buffer.push(parseInt(RC_tuning.throttle_MID * 100));
buffer.push(parseInt(RC_tuning.throttle_EXPO * 100)); buffer.push(parseInt(RC_tuning.throttle_EXPO * 100));
buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint)); if (CONFIG.apiVersion >= 1.7) {
buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint)); buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint));
buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint));
}
break; break;
// Disabled, cleanflight does not use MSP_SET_BOX. // Disabled, cleanflight does not use MSP_SET_BOX.
/* /*

View file

@ -79,18 +79,26 @@
</tr> </tr>
</table> </table>
<table class="rate-tpa"> <table class="rate-tpa">
<tr> <thead>
<th i18n="pidTuningRollPitchRate"></th> <tr>
<th i18n="pidTuningYawRate"></th> <th class="roll-pitch" i18n="pidTuningRollPitchRate"></th>
<th i18n="pidTuningTPA"></th> <th class="roll" i18n="pidTuningRollRate"></th>
<th i18n="pidTuningTPABreakPoint" class="tpa"></th> <th class="pitch" i18n="pidTuningPitchRate"></th>
</tr> <th i18n="pidTuningYawRate"></th>
<tr> <th i18n="pidTuningTPA"></th>
<td><input type="number" name="roll-pitch" step="0.01" min="0" max="2.55"/></td> <th class="tpa-breakpoint" i18n="pidTuningTPABreakPoint"></th>
<td><input type="number" name="yaw" step="0.01" min="0" max="2.55"/></td> </tr>
<td><input type="number" name="tpa" step="0.01" min="0" max="2.55"/></td> </thead>
<td><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td> <tbody>
</tr> <tr>
<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 class="tpa-breakpoint"><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td>
</tr>
</tbody>
</table> </table>
</form> </form>
<div class="clear-both"></div> <div class="clear-both"></div>

View file

@ -173,6 +173,8 @@ TABS.pid_tuning.initialize = function (callback) {
// Fill in data from RC_tuning object // 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-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="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"]').val(RC_tuning.dynamic_THR_PID.toFixed(2));
$('.rate-tpa input[name="tpa-breakpoint"]').val(RC_tuning.dynamic_THR_breakpoint); $('.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 // catch RC_tuning changes
RC_tuning.roll_pitch_rate = parseFloat($('.rate-tpa input[name="roll-pitch"]').val()); 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.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_PID = parseFloat($('.rate-tpa input[name="tpa"]').val());
RC_tuning.dynamic_THR_breakpoint = parseInt($('.rate-tpa input[name="tpa-breakpoint"]').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); 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 // Fill in currently selected profile
profile_e.val(CONFIG.profile); profile_e.val(CONFIG.profile);