mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-26 01:35:23 +03:00
Merge pull request #1664 from iNavFlight/MrD_Fix-calibrate-accelerometer-button-for-new-flashed-FCs
Fix calibration button
This commit is contained in:
commit
858c0affd7
2 changed files with 24 additions and 14 deletions
18
js/fc.js
18
js/fc.js
|
@ -763,6 +763,24 @@ var FC = {
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
},
|
},
|
||||||
|
getAccelerometerCalibrated: function () {
|
||||||
|
var calibrated = true;
|
||||||
|
var flagNames = FC.getArmingFlags();
|
||||||
|
|
||||||
|
if (CALIBRATION_DATA.accGain.X === 4096 && CALIBRATION_DATA.accGain.Y === 4096 && CALIBRATION_DATA.accGain.Z === 4096 &&
|
||||||
|
CALIBRATION_DATA.accZero.X === 0 && CALIBRATION_DATA.accZero.Y === 0 && CALIBRATION_DATA.accZero.Z === 0
|
||||||
|
) {
|
||||||
|
calibrated = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((calibrated) && flagNames.hasOwnProperty(13)) {
|
||||||
|
if (bit_check(CONFIG.armingFlags, 13)) {
|
||||||
|
calibrated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return calibrated;
|
||||||
|
},
|
||||||
getUserControlMode: function () {
|
getUserControlMode: function () {
|
||||||
return [
|
return [
|
||||||
"Attitude",
|
"Attitude",
|
||||||
|
|
|
@ -176,24 +176,16 @@ TABS.calibration.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupCalibrationButton(callback) {
|
function setupCalibrationButton(callback) {
|
||||||
let showCalibrate = false;
|
if (FC.getAccelerometerCalibrated()) {
|
||||||
var flagNames = FC.getArmingFlags();
|
|
||||||
if (flagNames.hasOwnProperty(13)) {
|
|
||||||
if (bit_check(CONFIG.armingFlags, 13)) {
|
|
||||||
showCalibrate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showCalibrate) {
|
|
||||||
$('#calibrate-start-button').html(chrome.i18n.getMessage("AccBtn"));
|
|
||||||
$('#calibrate-start-button').prop("title", chrome.i18n.getMessage("AccBtn"));
|
|
||||||
$('#calibrate-start-button').addClass("calibrate");
|
|
||||||
$('#calibrate-start-button').removeClass("resetCalibration");
|
|
||||||
} else {
|
|
||||||
$('#calibrate-start-button').html(chrome.i18n.getMessage("AccResetBtn"));
|
$('#calibrate-start-button').html(chrome.i18n.getMessage("AccResetBtn"));
|
||||||
$('#calibrate-start-button').prop("title", chrome.i18n.getMessage("AccResetBtn"));
|
$('#calibrate-start-button').prop("title", chrome.i18n.getMessage("AccResetBtn"));
|
||||||
$('#calibrate-start-button').removeClass("calibrate");
|
$('#calibrate-start-button').removeClass("calibrate");
|
||||||
$('#calibrate-start-button').addClass("resetCalibration");
|
$('#calibrate-start-button').addClass("resetCalibration");
|
||||||
|
} else {
|
||||||
|
$('#calibrate-start-button').html(chrome.i18n.getMessage("AccBtn"));
|
||||||
|
$('#calibrate-start-button').prop("title", chrome.i18n.getMessage("AccBtn"));
|
||||||
|
$('#calibrate-start-button').addClass("calibrate");
|
||||||
|
$('#calibrate-start-button').removeClass("resetCalibration");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue