polishing run

10.3.x-maintenance
cTn 2014-08-12 16:05:22 +02:00 committed by Dominic Clifton
parent b77ed6b174
commit 118715ef85
5 changed files with 41 additions and 38 deletions

View File

@ -2,7 +2,7 @@
// TODO: rework box_highlight & update_ui to accept flexible amount of aux channels
TABS.auxiliary_configuration = {};
TABS.auxiliary_configuration.initialize = function(callback) {
TABS.auxiliary_configuration.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'auxiliary_configuration';
googleAnalytics.sendAppView('Auxiliary Configuration');
@ -71,7 +71,7 @@ TABS.auxiliary_configuration.initialize = function(callback) {
}
// UI Hooks
$('a.update').click(function() {
$('a.update').click(function () {
// catch the input changes
var main_needle = 0;
var needle = 0;
@ -82,7 +82,7 @@ TABS.auxiliary_configuration.initialize = function(callback) {
boxCountPerLine = boxCountFor4AuxChannels * 2;
}
$('.boxes input').each(function() {
$('.boxes input').each(function () {
var bitIndex = needle;
if (bit_check(CONFIG.capability, 5) && needle >= boxCountFor4AuxChannels) {
bitIndex += 4; // 0-11 bits for aux 1-4, 16-27 for aux 5-8
@ -119,7 +119,7 @@ TABS.auxiliary_configuration.initialize = function(callback) {
MSP.send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, save_to_eeprom);
function save_to_eeprom() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
GUI.log(chrome.i18n.getMessage('auxiliaryEepromSaved'));
});
}
@ -175,7 +175,7 @@ TABS.auxiliary_configuration.initialize = function(callback) {
GUI.interval_add('aux_data_pull', get_rc_data, 50);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
GUI.interval_add('status_pull', function () {
MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true);
@ -183,6 +183,6 @@ TABS.auxiliary_configuration.initialize = function(callback) {
}
};
TABS.auxiliary_configuration.cleanup = function(callback) {
TABS.auxiliary_configuration.cleanup = function (callback) {
if (callback) callback();
};

View File

@ -5,13 +5,13 @@ TABS.cli = {
'sequenceElements': 0
};
TABS.cli.initialize = function(callback) {
TABS.cli.initialize = function (callback) {
var self = this;
GUI.active_tab_ref = this;
GUI.active_tab = 'cli';
googleAnalytics.sendAppView('CLI Page');
$('#content').load("./tabs/cli.html", function() {
$('#content').load("./tabs/cli.html", function () {
// translate to user-selected language
localize();
@ -23,7 +23,7 @@ TABS.cli.initialize = function(callback) {
bufView[0] = 0x23; // #
serial.send(bufferOut, function(writeInfo) {});
serial.send(bufferOut, function (writeInfo) {});
var textarea = $('.tab-cli textarea');
@ -44,14 +44,17 @@ TABS.cli.initialize = function(callback) {
}
});
textarea.keyup(function(event) {
var keyUp = { 38: true }, keyDown = { 40: true };
textarea.keyup(function (event) {
var keyUp = {38: true},
keyDown = {40: true};
if (event.keyCode in keyUp)
if (event.keyCode in keyUp) {
textarea.val(self.history.prev());
}
if (event.keyCode in keyDown)
if (event.keyCode in keyDown) {
textarea.val(self.history.next());
}
});
// give input element user focus
@ -160,7 +163,7 @@ TABS.cli.read = function (readInfo) {
$('.tab-cli .window .wrapper').css('webkitTransform', 'scale(1)');
};
TABS.cli.cleanup = function(callback) {
TABS.cli.cleanup = function (callback) {
var bufferOut = new ArrayBuffer(5);
var bufView = new Uint8Array(bufferOut);
@ -170,12 +173,12 @@ TABS.cli.cleanup = function(callback) {
bufView[3] = 0x74; // t
bufView[4] = 0x0D; // enter
serial.send(bufferOut, function(writeInfo) {
serial.send(bufferOut, function (writeInfo) {
// we could handle this "nicely", but this will do for now
// (another approach is however much more complicated):
// we can setup an interval asking for data lets say every 200ms, when data arrives, callback will be triggered and tab switched
// we could probably implement this someday
GUI.timeout_add('waiting_for_bootup', function() {
GUI.timeout_add('waiting_for_bootup', function () {
CONFIGURATOR.cliActive = false;
CONFIGURATOR.cliValid = false;

View File

@ -1,11 +1,11 @@
'use strict';
TABS.default = {};
TABS.default.initialize = function(callback) {
TABS.default.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'default';
$('#content').load("./tabs/default.html", function() {
$('#content').load("./tabs/default.html", function () {
//check_usb_permissions(); // temporary enabled in dev branch, should be commented out untill DFU support goes live
// translate to user-selected language
@ -15,11 +15,11 @@ TABS.default.initialize = function(callback) {
$('div.changelog.configurator .wrapper').load('./changelog.html');
// UI Hooks
$('a.firmware_flasher').click(function() {
$('a.firmware_flasher').click(function () {
TABS.firmware_flasher.initialize();
});
$('div.welcome a, div.sponsors a').click(function() {
$('div.welcome a, div.sponsors a').click(function () {
googleAnalytics.sendEvent('ExternalUrls', 'Click', $(this).prop('href'));
});
@ -27,6 +27,6 @@ TABS.default.initialize = function(callback) {
});
};
TABS.default.cleanup = function(callback) {
TABS.default.cleanup = function (callback) {
if (callback) callback();
};

View File

@ -1,7 +1,7 @@
'use strict';
TABS.gps = {};
TABS.gps.initialize = function(callback) {
TABS.gps.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'gps';
googleAnalytics.sendAppView('GPS Page');
@ -53,7 +53,7 @@ TABS.gps.initialize = function(callback) {
GUI.interval_add('gps_pull', get_raw_gps_data, 75, true);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
GUI.interval_add('status_pull', function () {
MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true);
@ -61,6 +61,6 @@ TABS.gps.initialize = function(callback) {
}
};
TABS.gps.cleanup = function(callback) {
TABS.gps.cleanup = function (callback) {
if (callback) callback();
};

View File

@ -3,7 +3,8 @@
TABS.initial_setup = {
yaw_fix: 0.0
};
TABS.initial_setup.initialize = function(callback) {
TABS.initial_setup.initialize = function (callback) {
var self = this;
GUI.active_tab_ref = this;
GUI.active_tab = 'initial_setup';
@ -137,7 +138,6 @@ TABS.initial_setup.initialize = function(callback) {
case 13:
$(".modelMixDiagram").attr("src","./images/motor_order/octox.svg").addClass('modelMixOctoX');
break;
case 4: // BI
case 5: // GIMBAL
case 8: // FLYING_WING
@ -161,7 +161,7 @@ TABS.initial_setup.initialize = function(callback) {
$('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0]));
// UI Hooks
$('a.calibrateAccel').click(function() {
$('a.calibrateAccel').click(function () {
var self = $(this);
if (!self.hasClass('calibrating')) {
@ -170,11 +170,11 @@ TABS.initial_setup.initialize = function(callback) {
// During this period MCU won't be able to process any serial commands because its locked in a for/while loop
// until this operation finishes, sending more commands through data_poll() will result in serial buffer overflow
GUI.interval_pause('initial_setup_data_pull');
MSP.send_message(MSP_codes.MSP_ACC_CALIBRATION, false, false, function() {
MSP.send_message(MSP_codes.MSP_ACC_CALIBRATION, false, false, function () {
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibStarted'));
});
GUI.timeout_add('button_reset', function() {
GUI.timeout_add('button_reset', function () {
GUI.interval_resume('initial_setup_data_pull');
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibEnded'));
@ -184,17 +184,17 @@ TABS.initial_setup.initialize = function(callback) {
}
});
$('a.calibrateMag').click(function() {
$('a.calibrateMag').click(function () {
var self = $(this);
if (!self.hasClass('calibrating')) {
self.addClass('calibrating');
MSP.send_message(MSP_codes.MSP_MAG_CALIBRATION, false, false, function() {
MSP.send_message(MSP_codes.MSP_MAG_CALIBRATION, false, false, function () {
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
});
GUI.timeout_add('button_reset', function() {
GUI.timeout_add('button_reset', function () {
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibEnded'));
self.removeClass('calibrating');
}, 30000);
@ -202,7 +202,7 @@ TABS.initial_setup.initialize = function(callback) {
});
$('a.resetSettings').click(function() {
MSP.send_message(MSP_codes.MSP_RESET_CONF, false, false, function() {
MSP.send_message(MSP_codes.MSP_RESET_CONF, false, false, function () {
GUI.log(chrome.i18n.getMessage('initialSetupSettingsRestored'));
GUI.tab_switch_cleanup(function() {
@ -212,7 +212,7 @@ TABS.initial_setup.initialize = function(callback) {
});
$('a.update').click(function() {
$('a.update').click(function () {
CONFIG.accelerometerTrims[0] = parseInt($('input[name="pitch"]').val());
CONFIG.accelerometerTrims[1] = parseInt($('input[name="roll"]').val());
@ -265,7 +265,7 @@ TABS.initial_setup.initialize = function(callback) {
MSP.send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, save_to_eeprom);
function save_to_eeprom() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved'));
});
}
@ -275,7 +275,7 @@ TABS.initial_setup.initialize = function(callback) {
$('div#interactive_block > a.reset').text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
// reset yaw button hook
$('div#interactive_block > a.reset').click(function() {
$('div#interactive_block > a.reset').click(function () {
self.yaw_fix = SENSOR_DATA.kinematics[2] * - 1.0;
$(this).text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
@ -316,7 +316,7 @@ TABS.initial_setup.initialize = function(callback) {
GUI.interval_add('initial_setup_data_pull', get_analog_data, 50, true);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() {
GUI.interval_add('status_pull', function () {
MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true);
@ -324,6 +324,6 @@ TABS.initial_setup.initialize = function(callback) {
}
};
TABS.initial_setup.cleanup = function(callback) {
TABS.initial_setup.cleanup = function (callback) {
if (callback) callback();
};