mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-24 16:55:22 +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;
|
||||
},
|
||||
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 () {
|
||||
return [
|
||||
"Attitude",
|
||||
|
|
|
@ -176,24 +176,16 @@ TABS.calibration.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function setupCalibrationButton(callback) {
|
||||
let showCalibrate = false;
|
||||
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 {
|
||||
if (FC.getAccelerometerCalibrated()) {
|
||||
$('#calibrate-start-button').html(chrome.i18n.getMessage("AccResetBtn"));
|
||||
$('#calibrate-start-button').prop("title", chrome.i18n.getMessage("AccResetBtn"));
|
||||
$('#calibrate-start-button').removeClass("calibrate");
|
||||
$('#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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue