mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 12:25:13 +03:00
fix firmware version, moved compass calibrate (#323)
This commit is contained in:
parent
8243e36d0e
commit
b669fa4d16
6 changed files with 147 additions and 108 deletions
|
@ -983,6 +983,10 @@ var mspHelper = (function (gui) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP_CALIBRATION_DATA:
|
case MSPCodes.MSP_CALIBRATION_DATA:
|
||||||
|
if (semver.lte(CONFIG.flightControllerVersion, "1.8.0")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var callibrations = data.getUint8(0);
|
var callibrations = data.getUint8(0);
|
||||||
CALIBRATION_DATA.acc.Pos0 = (1 & (callibrations >> 0));
|
CALIBRATION_DATA.acc.Pos0 = (1 & (callibrations >> 0));
|
||||||
CALIBRATION_DATA.acc.Pos1 = (1 & (callibrations >> 1));
|
CALIBRATION_DATA.acc.Pos1 = (1 & (callibrations >> 1));
|
||||||
|
@ -2278,7 +2282,7 @@ var mspHelper = (function (gui) {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.loadCalibrationData = function (callback) {
|
self.loadCalibrationData = function (callback) {
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) {
|
||||||
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, callback);
|
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, callback);
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
@ -2286,7 +2290,7 @@ var mspHelper = (function (gui) {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.saveCalibrationData = function (callback) {
|
self.saveCalibrationData = function (callback) {
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) {
|
||||||
MSP.send_message(MSPCodes.MSP_SET_CALIBRATION_DATA, mspHelper.crunch(MSPCodes.MSP_SET_CALIBRATION_DATA), false, callback);
|
MSP.send_message(MSPCodes.MSP_SET_CALIBRATION_DATA, mspHelper.crunch(MSPCodes.MSP_SET_CALIBRATION_DATA), false, callback);
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttonarea {
|
.buttonarea {
|
||||||
min-height: 100px;
|
/*min-height: 100px; */
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<div class="steptitle">Step 6</div>
|
<div class="steptitle">Step 6</div>
|
||||||
<div class="indicator"></div>
|
<div class="indicator"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="gui_box grey">
|
<div class="gui_box grey" id="accPosAll">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" data-i18n="calibrationHead2"></div>
|
<div class="spacer_box_title" data-i18n="calibrationHead2"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="content_toolbar">
|
<div class="content_toolbar">
|
||||||
<div class="btn save_btn">
|
<div class="btn save_btn">
|
||||||
<a class="save" href="#" data-i18n="configurationButtonSave"></a>
|
<a id="calibrateButtonSave" class="save" href="#" data-i18n="configurationButtonSave"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -52,7 +52,7 @@ TABS.calibration.initialize = function (callback) {
|
||||||
GUI.active_tab = 'calibration';
|
GUI.active_tab = 'calibration';
|
||||||
googleAnalytics.sendAppView('Calibration');
|
googleAnalytics.sendAppView('Calibration');
|
||||||
}
|
}
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) {
|
||||||
loadChainer.setChain([
|
loadChainer.setChain([
|
||||||
mspHelper.loadStatus,
|
mspHelper.loadStatus,
|
||||||
mspHelper.loadCalibrationData
|
mspHelper.loadCalibrationData
|
||||||
|
@ -63,14 +63,38 @@ TABS.calibration.initialize = function (callback) {
|
||||||
saveChainer.setChain([
|
saveChainer.setChain([
|
||||||
mspHelper.saveCalibrationData
|
mspHelper.saveCalibrationData
|
||||||
]);
|
]);
|
||||||
saveChainer.setExitPoint(loadChainer.execute);
|
saveChainer.setExitPoint(reboot);
|
||||||
|
|
||||||
|
MSP.send_message(MSPCodes.MSP_IDENT, false, false, loadHtml);
|
||||||
|
} else {
|
||||||
|
loadChainer.setChain([
|
||||||
|
mspHelper.loadStatus
|
||||||
|
]);
|
||||||
|
loadChainer.setExitPoint(loadHtml);
|
||||||
|
loadChainer.execute();
|
||||||
|
|
||||||
|
saveChainer.setExitPoint(reboot);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reboot() {
|
||||||
|
//noinspection JSUnresolvedVariable
|
||||||
|
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||||
|
|
||||||
|
GUI.tab_switch_cleanup(function() {
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function reinitialize() {
|
||||||
|
//noinspection JSUnresolvedVariable
|
||||||
|
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||||
|
GUI.handleReconnect($('.tab_calibration a'));
|
||||||
|
}
|
||||||
|
|
||||||
function loadHtml() {
|
function loadHtml() {
|
||||||
$('#content').load("./tabs/calibration.html", processHtml);
|
$('#content').load("./tabs/calibration.html", processHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_IDENT, false, false, loadHtml);
|
|
||||||
|
|
||||||
function updateCalibrationSteps() {
|
function updateCalibrationSteps() {
|
||||||
for (var i = 0; i < 6; i++) {
|
for (var i = 0; i < 6; i++) {
|
||||||
var $element = $('[data-step="' + (i + 1) + '"]');
|
var $element = $('[data-step="' + (i + 1) + '"]');
|
||||||
|
@ -107,47 +131,33 @@ TABS.calibration.initialize = function (callback) {
|
||||||
updateSensorData();
|
updateSensorData();
|
||||||
}
|
}
|
||||||
|
|
||||||
function processHtml() {
|
//For 1.8.0
|
||||||
|
function calibrate() {
|
||||||
|
var self = $(this);
|
||||||
|
|
||||||
if (SENSOR_CONFIG.magnetometer === 0) {
|
if (!self.hasClass('disabled')) {
|
||||||
//Comment for test
|
self.addClass('disabled');
|
||||||
$('#mag_btn, #mag-calibrated-data').css('pointer-events', 'none').css('opacity', '0.4');
|
MSP.send_message(MSPCodes.MSP_ACC_CALIBRATION, false, false, function () {
|
||||||
}
|
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibStarted'));
|
||||||
|
|
||||||
$('#mag_btn').on('click', function () {
|
|
||||||
MSP.send_message(MSPCodes.MSP_MAG_CALIBRATION, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var button = $(this);
|
helper.timeout.add('button_reset', function () {
|
||||||
|
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibEnded'));
|
||||||
|
|
||||||
$(button).addClass('disabled');
|
self.removeClass('disabled');
|
||||||
|
|
||||||
modalProcessing = new jBox('Modal', {
|
if (!bit_check(CONFIG.armingFlags & 0xff00, 13)) {
|
||||||
width: 400,
|
for (var i = 0; i < 6; i++) {
|
||||||
height: 100,
|
CALIBRATION_DATA.acc['Pos' + i] = 1;
|
||||||
animation: false,
|
}
|
||||||
closeOnClick: false,
|
updateCalibrationSteps();
|
||||||
closeOnEsc: false,
|
|
||||||
content: $('#modal-compass-processing')
|
|
||||||
}).open();
|
|
||||||
|
|
||||||
var countdown = 30;
|
|
||||||
helper.interval.add('compass_calibration_interval', function () {
|
|
||||||
countdown--;
|
|
||||||
$('#modal-compass-countdown').text(countdown);
|
|
||||||
if (countdown === 0) {
|
|
||||||
$(button).removeClass('disabled');
|
|
||||||
|
|
||||||
modalProcessing.close();
|
|
||||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibEnded'));
|
|
||||||
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, updateSensorData);
|
|
||||||
helper.interval.remove('compass_calibration_interval');
|
|
||||||
}
|
}
|
||||||
}, 1000);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#calibrate-start-button').click(function () {
|
}, 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function calibrateNew() {
|
||||||
var newStep = null,
|
var newStep = null,
|
||||||
$button = $(this);
|
$button = $(this);
|
||||||
|
|
||||||
|
@ -197,7 +207,62 @@ TABS.calibration.initialize = function (callback) {
|
||||||
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibEnded'));
|
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibEnded'));
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function processHtml() {
|
||||||
|
$('#calibrateButtonSave').on('click', function () {
|
||||||
|
saveChainer.execute();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (semver.lte(CONFIG.flightControllerVersion, "1.8.0")) {
|
||||||
|
$('#accPosAll, #mag-calibrated-data').hide();
|
||||||
|
|
||||||
|
var accIsCalibrate = +(!bit_check(CONFIG.armingFlags & 0xff00, 13));
|
||||||
|
for (var i = 0; i < 6; i++) {
|
||||||
|
CALIBRATION_DATA.acc['Pos' + i] = accIsCalibrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCalibrationSteps();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SENSOR_CONFIG.magnetometer === 0) {
|
||||||
|
//Comment for test
|
||||||
|
$('#mag_btn, #mag-calibrated-data').css('pointer-events', 'none').css('opacity', '0.4');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#mag_btn').on('click', function () {
|
||||||
|
MSP.send_message(MSPCodes.MSP_MAG_CALIBRATION, false, false, function () {
|
||||||
|
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
|
||||||
|
});
|
||||||
|
|
||||||
|
var button = $(this);
|
||||||
|
|
||||||
|
$(button).addClass('disabled');
|
||||||
|
|
||||||
|
modalProcessing = new jBox('Modal', {
|
||||||
|
width: 400,
|
||||||
|
height: 100,
|
||||||
|
animation: false,
|
||||||
|
closeOnClick: false,
|
||||||
|
closeOnEsc: false,
|
||||||
|
content: $('#modal-compass-processing')
|
||||||
|
}).open();
|
||||||
|
|
||||||
|
var countdown = 30;
|
||||||
|
helper.interval.add('compass_calibration_interval', function () {
|
||||||
|
countdown--;
|
||||||
|
$('#modal-compass-countdown').text(countdown);
|
||||||
|
if (countdown === 0) {
|
||||||
|
$(button).removeClass('disabled');
|
||||||
|
|
||||||
|
modalProcessing.close();
|
||||||
|
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibEnded'));
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, updateSensorData);
|
||||||
|
}
|
||||||
|
helper.interval.remove('compass_calibration_interval');
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#modal-start-button').click(function () {
|
$('#modal-start-button').click(function () {
|
||||||
|
@ -211,7 +276,13 @@ TABS.calibration.initialize = function (callback) {
|
||||||
|
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) {
|
||||||
|
$('#calibrate-start-button').on('click', calibrateNew);
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, updateSensorData);
|
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, updateSensorData);
|
||||||
|
} else {
|
||||||
|
$('#calibrate-start-button').on('click', calibrate);
|
||||||
|
}
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,27 +8,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cf_column fourth buttonarea">
|
<div class="cf_column fourth buttonarea">
|
||||||
<div class="spacer_right">
|
<div class="spacer_right">
|
||||||
<div class="default_btn">
|
|
||||||
<div id="mag_calib_rest">
|
|
||||||
<a class="calibrateMag" href="#" data-i18n="initialSetupButtonCalibrateMag"></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="mag_calib_running">
|
|
||||||
<div class="data-loading-setup">
|
|
||||||
<p>Calibrating...</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="default_btn">
|
<div class="default_btn">
|
||||||
<a class="resetSettings" href="#" data-i18n="initialSetupButtonReset"></a>
|
<a class="resetSettings" href="#" data-i18n="initialSetupButtonReset"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="threefourth_right setupinfo">
|
<div class="threefourth_right setupinfo">
|
||||||
|
|
||||||
<div class="cell_setup">
|
|
||||||
<span data-i18n="initialSetupCalibrateMagText"></span>
|
|
||||||
</div>
|
|
||||||
<div class="cell_setup">
|
<div class="cell_setup">
|
||||||
<span data-i18n="initialSetupResetText"></span>
|
<span data-i18n="initialSetupResetText"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,27 +54,6 @@ TABS.setup.initialize = function (callback) {
|
||||||
|
|
||||||
self.initializeInstruments();
|
self.initializeInstruments();
|
||||||
|
|
||||||
$('a.calibrateMag').click(function () {
|
|
||||||
var self = $(this);
|
|
||||||
|
|
||||||
if (!self.hasClass('calibrating') && !self.hasClass('disabled')) {
|
|
||||||
self.addClass('calibrating');
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_MAG_CALIBRATION, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
|
|
||||||
$('#mag_calib_running').show();
|
|
||||||
$('#mag_calib_rest').hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
helper.timeout.add('button_reset', function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibEnded'));
|
|
||||||
self.removeClass('calibrating');
|
|
||||||
$('#mag_calib_running').hide();
|
|
||||||
$('#mag_calib_rest').show();
|
|
||||||
}, 30000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('a.resetSettings').click(function () {
|
$('a.resetSettings').click(function () {
|
||||||
MSP.send_message(MSPCodes.MSP_RESET_CONF, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_RESET_CONF, false, false, function () {
|
||||||
GUI.log(chrome.i18n.getMessage('initialSetupSettingsRestored'));
|
GUI.log(chrome.i18n.getMessage('initialSetupSettingsRestored'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue