1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 16:25:22 +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

@ -314,7 +314,7 @@ function configuration_restore(callback) {
GUI.log(chrome.i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
if (!compareVersions(migratedVersion, '0.61.0')) {
// Changing PID controller via UI was added.
@ -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;
}

View file

@ -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,

View file

@ -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));
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.dynamic_THR_PID * 100));
buffer.push(parseInt(RC_tuning.throttle_MID * 100));
buffer.push(parseInt(RC_tuning.throttle_EXPO * 100));
buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint));
buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint));
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.
/*