mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
yaw offset can now be remembered while switching tabs
This commit is contained in:
parent
e49f4ea5ff
commit
c1ef5aeead
1 changed files with 11 additions and 7 deletions
|
@ -1,5 +1,8 @@
|
|||
tabs.initial_setup = {};
|
||||
tabs.initial_setup = {
|
||||
yaw_fix: 0.0
|
||||
};
|
||||
tabs.initial_setup.initialize = function(callback) {
|
||||
var self = this;
|
||||
GUI.active_tab_ref = this;
|
||||
GUI.active_tab = 'initial_setup';
|
||||
ga_tracker.sendAppView('Initial Setup');
|
||||
|
@ -22,8 +25,6 @@ tabs.initial_setup.initialize = function(callback) {
|
|||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
var yaw_fix = 0.0;
|
||||
|
||||
// Fill in misc stuff
|
||||
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
||||
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
||||
|
@ -218,12 +219,15 @@ tabs.initial_setup.initialize = function(callback) {
|
|||
}
|
||||
});
|
||||
|
||||
// display current yaw fix value (important during tab re-initialization)
|
||||
$('div#interactive_block > a.reset').text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
|
||||
|
||||
// reset yaw button hook
|
||||
$('div#interactive_block > a.reset').click(function() {
|
||||
yaw_fix = SENSOR_DATA.kinematics[2] * - 1.0;
|
||||
$(this).text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [yaw_fix]));
|
||||
self.yaw_fix = SENSOR_DATA.kinematics[2] * - 1.0;
|
||||
$(this).text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
|
||||
|
||||
console.log('YAW reset to 0 deg, fix: ' + yaw_fix + ' deg');
|
||||
console.log('YAW reset to 0 deg, fix: ' + self.yaw_fix + ' deg');
|
||||
});
|
||||
|
||||
$('#content .backup').click(configuration_backup);
|
||||
|
@ -249,7 +253,7 @@ tabs.initial_setup.initialize = function(callback) {
|
|||
// Update cube
|
||||
var cube = $('div#cube');
|
||||
|
||||
cube.css('-webkit-transform', 'rotateY(' + ((SENSOR_DATA.kinematics[2] * -1.0) - yaw_fix) + 'deg)');
|
||||
cube.css('-webkit-transform', 'rotateY(' + ((SENSOR_DATA.kinematics[2] * -1.0) - self.yaw_fix) + 'deg)');
|
||||
$('#cubePITCH', cube).css('-webkit-transform', 'rotateX(' + SENSOR_DATA.kinematics[1] + 'deg)');
|
||||
$('#cubeROLL', cube).css('-webkit-transform', 'rotateZ(' + SENSOR_DATA.kinematics[0] + 'deg)');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue