mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 20:35:19 +03:00
Fix 3D support.
Add missing backup and restore functionalty Add missing configuration migration logic Add missing visibility toggling of 3D section when API version < `1.14.0` Add missing logic for issuing the correct sequence of MSP commands issues when API version < `1.14.0` when viewing the configuration tab.
This commit is contained in:
parent
253aca72a4
commit
ec57aa9d1a
2 changed files with 59 additions and 15 deletions
|
@ -96,6 +96,9 @@ function configuration_backup(callback) {
|
||||||
uniqueData.push(MSP_codes.MSP_LOOP_TIME);
|
uniqueData.push(MSP_codes.MSP_LOOP_TIME);
|
||||||
uniqueData.push(MSP_codes.MSP_ARMING_CONFIG);
|
uniqueData.push(MSP_codes.MSP_ARMING_CONFIG);
|
||||||
}
|
}
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||||
|
uniqueData.push(MSP_codes.MSP_3D);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_unique_data_list();
|
update_unique_data_list();
|
||||||
|
@ -120,6 +123,9 @@ function configuration_backup(callback) {
|
||||||
configuration.FC_CONFIG = jQuery.extend(true, {}, FC_CONFIG);
|
configuration.FC_CONFIG = jQuery.extend(true, {}, FC_CONFIG);
|
||||||
configuration.ARMING_CONFIG = jQuery.extend(true, {}, ARMING_CONFIG);
|
configuration.ARMING_CONFIG = jQuery.extend(true, {}, ARMING_CONFIG);
|
||||||
}
|
}
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||||
|
configuration._3D = jQuery.extend(true, {}, _3D);
|
||||||
|
}
|
||||||
|
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -486,6 +492,21 @@ function configuration_restore(callback) {
|
||||||
appliedMigrationsCount++;
|
appliedMigrationsCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.14.0')) {
|
||||||
|
// api 1.14 exposes 3D configuration
|
||||||
|
|
||||||
|
if (configuration._3D == undefined) {
|
||||||
|
configuration._3D = {
|
||||||
|
deadband3d_low: 1406,
|
||||||
|
deadband3d_high: 1514,
|
||||||
|
neutral3d: 1460,
|
||||||
|
deadband3d_throttle: 50
|
||||||
|
};
|
||||||
|
}
|
||||||
|
appliedMigrationsCount++;
|
||||||
|
}
|
||||||
|
|
||||||
if (appliedMigrationsCount > 0) {
|
if (appliedMigrationsCount > 0) {
|
||||||
GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
|
GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
|
||||||
}
|
}
|
||||||
|
@ -593,6 +614,9 @@ function configuration_restore(callback) {
|
||||||
uniqueData.push(MSP_codes.MSP_SET_LOOP_TIME);
|
uniqueData.push(MSP_codes.MSP_SET_LOOP_TIME);
|
||||||
uniqueData.push(MSP_codes.MSP_SET_ARMING_CONFIG);
|
uniqueData.push(MSP_codes.MSP_SET_ARMING_CONFIG);
|
||||||
}
|
}
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||||
|
uniqueData.push(MSP_codes.MSP_SET_3D);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_objects() {
|
function load_objects() {
|
||||||
|
@ -603,6 +627,7 @@ function configuration_restore(callback) {
|
||||||
LED_STRIP = configuration.LED_STRIP;
|
LED_STRIP = configuration.LED_STRIP;
|
||||||
ARMING_CONFIG = configuration.ARMING_CONFIG;
|
ARMING_CONFIG = configuration.ARMING_CONFIG;
|
||||||
FC_CONFIG = configuration.FC_CONFIG;
|
FC_CONFIG = configuration.FC_CONFIG;
|
||||||
|
_3D = configuration._3D;
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_unique_data_item() {
|
function send_unique_data_item() {
|
||||||
|
|
|
@ -15,10 +15,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_serial_config() {
|
function load_serial_config() {
|
||||||
|
var next_callback = load_rc_map;
|
||||||
if (semver.lt(CONFIG.apiVersion, "1.6.0")) {
|
if (semver.lt(CONFIG.apiVersion, "1.6.0")) {
|
||||||
MSP.send_message(MSP_codes.MSP_CF_SERIAL_CONFIG, false, false, load_rc_map);
|
MSP.send_message(MSP_codes.MSP_CF_SERIAL_CONFIG, false, false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
load_rc_map();
|
next_callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,24 +28,38 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_misc() {
|
function load_misc() {
|
||||||
MSP.send_message(MSP_codes.MSP_MISC, false, false, load_3d);
|
MSP.send_message(MSP_codes.MSP_MISC, false, false, load_acc_trim);
|
||||||
}
|
|
||||||
|
|
||||||
function load_3d() {
|
|
||||||
MSP.send_message(MSP_codes.MSP_3D, false, false, load_acc_trim);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_acc_trim() {
|
function load_acc_trim() {
|
||||||
MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false
|
MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_arming_config);
|
||||||
, semver.gte(CONFIG.apiVersion, "1.8.0") ? load_arming_config : load_html);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_arming_config() {
|
function load_arming_config() {
|
||||||
MSP.send_message(MSP_codes.MSP_ARMING_CONFIG, false, false, load_loop_time);
|
var next_callback = load_loop_time;
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||||
|
MSP.send_message(MSP_codes.MSP_ARMING_CONFIG, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_loop_time() {
|
function load_loop_time() {
|
||||||
MSP.send_message(MSP_codes.MSP_LOOP_TIME, false, false, load_html);
|
var next_callback = load_3d;
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||||
|
MSP.send_message(MSP_codes.MSP_LOOP_TIME, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function load_3d() {
|
||||||
|
var next_callback = load_html;
|
||||||
|
if (semver.lt(CONFIG.apiVersion, "1.14.0")) {
|
||||||
|
MSP.send_message(MSP_codes.MSP_3D, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_html() {
|
function load_html() {
|
||||||
|
@ -318,10 +333,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('input[name="multiwiicurrentoutput"]').prop('checked', MISC.multiwiicurrentoutput);
|
$('input[name="multiwiicurrentoutput"]').prop('checked', MISC.multiwiicurrentoutput);
|
||||||
|
|
||||||
//fill 3D
|
//fill 3D
|
||||||
|
if (semver.lt(CONFIG.apiVersion, "1.14.0")) {
|
||||||
|
$('.tab-configuration .3d').hide();
|
||||||
|
} else {
|
||||||
$('input[name="3ddeadbandlow"]').val(_3D.deadband3d_low);
|
$('input[name="3ddeadbandlow"]').val(_3D.deadband3d_low);
|
||||||
$('input[name="3ddeadbandhigh"]').val(_3D.deadband3d_high);
|
$('input[name="3ddeadbandhigh"]').val(_3D.deadband3d_high);
|
||||||
$('input[name="3dneutral"]').val(_3D.neutral3d);
|
$('input[name="3dneutral"]').val(_3D.neutral3d);
|
||||||
$('input[name="3ddeadbandthrottle"]').val(_3D.deadband3d_throttle);
|
$('input[name="3ddeadbandthrottle"]').val(_3D.deadband3d_throttle);
|
||||||
|
}
|
||||||
|
|
||||||
// UI hooks
|
// UI hooks
|
||||||
$('input[name="looptime"]').change(function() {
|
$('input[name="looptime"]').change(function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue