1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 12:55:14 +03:00

added MSP support for sensor orientation, some fixes for 3D backup and restore

This commit is contained in:
NightHawk32 2015-12-14 18:06:25 -05:00
parent 1c671f26bf
commit 067999c5e8
5 changed files with 98 additions and 7 deletions

View file

@ -105,6 +105,9 @@ function configuration_backup(callback) {
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
uniqueData.push(MSP_codes.MSP_3D);
}
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
uniqueData.push(MSP_codes.MSP_SENSOR_ALIGNMENT);
}
}
update_unique_data_list();
@ -132,6 +135,9 @@ function configuration_backup(callback) {
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
configuration._3D = jQuery.extend(true, {}, _3D);
}
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
configuration.SENSOR_ALIGNMENT = jQuery.extend(true, {}, SENSOR_ALIGNMENT);
}
save();
}
@ -513,8 +519,9 @@ function configuration_restore(callback) {
appliedMigrationsCount++;
}
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.15.0')) {
// api 1.14 exposes deadband and yaw_deadband
// api 1.15 exposes RCcontrols and sensor alignment
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
@ -527,6 +534,13 @@ function configuration_restore(callback) {
};
}
}
if (configuration.SENSOR_ALIGNMENT == undefined) {
configuration.SENSOR_ALIGNMENT = {
align_gyro: 0,
align_acc: 0,
align_mag: 0
};
}
appliedMigrationsCount++;
}
@ -645,6 +659,9 @@ function configuration_restore(callback) {
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
uniqueData.push(MSP_codes.MSP_SET_3D);
}
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
uniqueData.push(MSP_codes.MSP_SET_SENSOR_ALIGNMENT);
}
}
function load_objects() {
@ -656,6 +673,7 @@ function configuration_restore(callback) {
ARMING_CONFIG = configuration.ARMING_CONFIG;
FC_CONFIG = configuration.FC_CONFIG;
_3D = configuration._3D;
SENSOR_ALIGNMENT = configuration.SENSOR_ALIGNMENT;
}
function send_unique_data_item() {