pretty pretty pretty

10.3.x-maintenance
cTn 2014-08-12 16:20:26 +02:00
parent 2753f354e0
commit 932a58d355
6 changed files with 128 additions and 128 deletions

View File

@ -1,7 +1,7 @@
'use strict';
TABS.logging = {};
TABS.logging.initialize = function(callback) {
TABS.logging.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'logging';
googleAnalytics.sendAppView('Logging');
@ -41,7 +41,7 @@ TABS.logging.initialize = function(callback) {
// UI hooks
$('a.log_file').click(prepare_file);
$('a.logging').click(function() {
$('a.logging').click(function () {
if (GUI.connected_to) {
if (fileEntry != null) {
var clicks = $(this).data('clicks');
@ -53,7 +53,7 @@ TABS.logging.initialize = function(callback) {
log_buffer = [];
requested_properties = [];
$('.properties input:checked').each(function() {
$('.properties input:checked').each(function () {
requested_properties.push($(this).prop('name'));
});
@ -118,7 +118,7 @@ TABS.logging.initialize = function(callback) {
if (GUI.connected_to) {
$('a.connect').click();
} else {
GUI.tab_switch_cleanup(function() {
GUI.tab_switch_cleanup(function () {
CONFIGURATOR.mspPassThrough = false;
$('#tabs > ul li').removeClass('active');
TABS.default.initialize();
@ -127,9 +127,9 @@ TABS.logging.initialize = function(callback) {
});
}
chrome.storage.local.get('logging_file_entry', function(result) {
chrome.storage.local.get('logging_file_entry', function (result) {
if (result.logging_file_entry) {
chrome.fileSystem.restoreEntry(result.logging_file_entry, function(entry) {
chrome.fileSystem.restoreEntry(result.logging_file_entry, function (entry) {
fileEntry = entry;
prepare_writer(true);
});
@ -201,9 +201,10 @@ TABS.logging.initialize = function(callback) {
append_to_file(head);
}
var samples = 0;
var requests = 0;
var log_buffer = [];
var samples = 0,
requests = 0,
log_buffer = [];
function crunch_data() {
var sample = millitime();
@ -255,8 +256,8 @@ TABS.logging.initialize = function(callback) {
}
// IO related methods
var fileEntry = null;
var fileWriter = null;
var fileEntry = null,
fileWriter = null;
function prepare_file() {
// create or load the file
@ -296,29 +297,29 @@ TABS.logging.initialize = function(callback) {
}
function prepare_writer(retaining) {
fileEntry.createWriter(function(writer) {
fileEntry.createWriter(function (writer) {
fileWriter = writer;
fileWriter.onerror = function(e) {
fileWriter.onerror = function (e) {
console.error(e);
// stop logging if the procedure was/is still running
if ($('a.logging').data('clicks')) $('a.logging').click();
};
fileWriter.onwriteend = function() {
fileWriter.onwriteend = function () {
$('.size').text(bytesToSize(fileWriter.length));
};
if (retaining) {
chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
chrome.fileSystem.getDisplayPath(fileEntry, function (path) {
GUI.log(chrome.i18n.getMessage('loggingAutomaticallyRetained', [path]));
});
}
// update log size in UI on fileWriter creation
$('.size').text(bytesToSize(fileWriter.length));
}, function(e) {
}, function (e) {
// File is not readable or does not exist!
console.error(e);
@ -337,6 +338,6 @@ TABS.logging.initialize = function(callback) {
}
};
TABS.logging.cleanup = function(callback) {
TABS.logging.cleanup = function (callback) {
if (callback) callback();
};

View File

@ -1,7 +1,7 @@
'use strict';
TABS.motor_outputs = {};
TABS.motor_outputs.initialize = function(callback) {
TABS.motor_outputs.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'motor_outputs';
googleAnalytics.sendAppView('Motor Outputs Page');
@ -85,17 +85,17 @@ TABS.motor_outputs.initialize = function(callback) {
.scale(helpers.widthScale)
.ticks(5)
.orient("bottom")
.tickFormat(function(d) {return d;});
.tickFormat(function (d) {return d;});
helpers.yAxis = d3.svg.axis()
.scale(helpers.heightScale)
.ticks(5)
.orient("left")
.tickFormat(function(d) {return d;});
.tickFormat(function (d) {return d;});
helpers.line = d3.svg.line()
.x(function(d) { return helpers.widthScale(d[0]); })
.y(function(d) { return helpers.heightScale(d[1]); });
.x(function (d) { return helpers.widthScale(d[0]); })
.y(function (d) { return helpers.heightScale(d[1]); });
return helpers;
}
@ -105,7 +105,7 @@ TABS.motor_outputs.initialize = function(callback) {
if (graphHelpers.dynamicHeightDomain) {
var limits = [];
$.each(data, function(idx, datum) {
$.each(data, function (idx, datum) {
limits.push(datum.min);
limits.push(datum.max);
});
@ -119,7 +119,7 @@ TABS.motor_outputs.initialize = function(callback) {
svg.select(".y.axis").call(graphHelpers.yAxis);
var group = svg.select("g.data");
var lines = group.selectAll("path").data(data, function(d, i) { return i; });
var lines = group.selectAll("path").data(data, function (d, i) {return i;});
var newLines = lines.enter().append("path").attr("class", "line");
lines.attr('d', graphHelpers.line);
}
@ -154,7 +154,7 @@ TABS.motor_outputs.initialize = function(callback) {
y: [],
z: [],
};
$('.plot_control .x, .plot_control .y, .plot_control .z').each(function() {
$('.plot_control .x, .plot_control .y, .plot_control .z').each(function () {
var el = $(this);
if (el.hasClass('x')) {
raw_data_text_ements.x.push(el);
@ -166,7 +166,7 @@ TABS.motor_outputs.initialize = function(callback) {
});
// set refresh speeds according to configuration saved in storage
chrome.storage.local.get('motors_tab_accel_settings', function(result) {
chrome.storage.local.get('motors_tab_accel_settings', function (result) {
if (result.motors_tab_accel_settings) {
$('.tab-motor_outputs select[name="accel_refresh_rate"]').val(result.motors_tab_accel_settings.rate);
$('.tab-motor_outputs select[name="accel_scale"]').val(result.motors_tab_accel_settings.scale);
@ -179,7 +179,7 @@ TABS.motor_outputs.initialize = function(callback) {
}
});
$('.tab-motor_outputs .rate select, .tab-motor_outputs .scale select').change(function() {
$('.tab-motor_outputs .rate select, .tab-motor_outputs .scale select').change(function () {
var rate = parseInt($('.tab-motor_outputs select[name="accel_refresh_rate"]').val(), 10);
var scale = parseFloat($('.tab-motor_outputs select[name="accel_scale"]').val());
@ -224,7 +224,7 @@ TABS.motor_outputs.initialize = function(callback) {
}
});
$('a.reset_accel_max').click(function() {
$('a.reset_accel_max').click(function () {
accel_max_read = [0, 0, 0];
accel_offset_established = false;
});
@ -246,7 +246,7 @@ TABS.motor_outputs.initialize = function(callback) {
$('div.values li:not(:last)').html(MISC.mincommand);
// UI hooks
$('div.sliders input:not(.master)').on('input', function() {
$('div.sliders input:not(.master)').on('input', function () {
var index = $(this).index();
$('div.values li').eq(index).html($(this).val());
@ -264,7 +264,7 @@ TABS.motor_outputs.initialize = function(callback) {
MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer_out);
});
$('div.sliders input.master').on('input', function() {
$('div.sliders input.master').on('input', function () {
var val = $(this).val();
$('div.sliders input:not(:disabled, :last)').val(val);
@ -272,7 +272,7 @@ TABS.motor_outputs.initialize = function(callback) {
$('div.sliders input:not(:last):first').trigger('input');
});
$('div.notice input[type="checkbox"]').change(function() {
$('div.notice input[type="checkbox"]').change(function () {
if ($(this).is(':checked')) {
$('div.sliders input').slice(0, number_of_valid_outputs).prop('disabled', false);
@ -373,6 +373,6 @@ TABS.motor_outputs.initialize = function(callback) {
}
};
TABS.motor_outputs.cleanup = function(callback) {
TABS.motor_outputs.cleanup = function (callback) {
if (callback) callback();
};

View File

@ -1,7 +1,7 @@
'use strict';
TABS.pid_tuning = {};
TABS.pid_tuning.initialize = function(callback) {
TABS.pid_tuning.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'pid_tuning';
googleAnalytics.sendAppView('PID Tuning');
@ -44,7 +44,7 @@ TABS.pid_tuning.initialize = function(callback) {
// Fill in the data from PIDs array
var i = 0;
$('.pid_tuning .ROLL input').each(function() {
$('.pid_tuning .ROLL input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[0][i++].toFixed(1));
@ -59,7 +59,7 @@ TABS.pid_tuning.initialize = function(callback) {
});
i = 0;
$('.pid_tuning .PITCH input').each(function() {
$('.pid_tuning .PITCH input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[1][i++].toFixed(1));
@ -74,7 +74,7 @@ TABS.pid_tuning.initialize = function(callback) {
});
i = 0;
$('.pid_tuning .YAW input').each(function() {
$('.pid_tuning .YAW input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[2][i++].toFixed(1));
@ -89,7 +89,7 @@ TABS.pid_tuning.initialize = function(callback) {
});
i = 0;
$('.pid_tuning .ALT input').each(function() {
$('.pid_tuning .ALT input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[3][i++].toFixed(1));
@ -104,12 +104,12 @@ TABS.pid_tuning.initialize = function(callback) {
});
i = 0;
$('.pid_tuning .Pos input').each(function() {
$('.pid_tuning .Pos input').each(function () {
$(this).val(PIDs[4][i++].toFixed(2));
});
i = 0;
$('.pid_tuning .PosR input').each(function() {
$('.pid_tuning .PosR input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[5][i++].toFixed(1));
@ -124,7 +124,7 @@ TABS.pid_tuning.initialize = function(callback) {
});
i = 0;
$('.pid_tuning .NavR input').each(function() {
$('.pid_tuning .NavR input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[6][i++].toFixed(1));
@ -139,7 +139,7 @@ TABS.pid_tuning.initialize = function(callback) {
});
i = 0;
$('.pid_tuning .LEVEL input').each(function() {
$('.pid_tuning .LEVEL input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[7][i++].toFixed(1));
@ -154,12 +154,12 @@ TABS.pid_tuning.initialize = function(callback) {
});
i = 0;
$('.pid_tuning .MAG input').each(function() {
$('.pid_tuning .MAG input').each(function () {
$(this).val(PIDs[8][i++].toFixed(1));
});
i = 0;
$('.pid_tuning .Vario input').each(function() {
$('.pid_tuning .Vario input').each(function () {
switch (i) {
case 0:
$(this).val(PIDs[9][i++].toFixed(1));
@ -182,74 +182,74 @@ TABS.pid_tuning.initialize = function(callback) {
$('input[name="profile"]').val(CONFIG.profile + 1); // +1 because the range is 0-2
// UI Hooks
$('input[name="profile"]').change(function() {
$('input[name="profile"]').change(function () {
var profile = parseInt($(this).val());
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [profile - 1], false, function() {
MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [profile - 1], false, function () {
GUI.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [profile]));
GUI.tab_switch_cleanup(function() {
GUI.tab_switch_cleanup(function () {
TABS.pid_tuning.initialize();
});
});
});
$('a.refresh').click(function() {
GUI.tab_switch_cleanup(function() {
$('a.refresh').click(function () {
GUI.tab_switch_cleanup(function () {
GUI.log(chrome.i18n.getMessage('pidTuningDataRefreshed'));
TABS.pid_tuning.initialize();
});
});
$('a.update').click(function() {
$('a.update').click(function () {
// Catch all the changes and stuff the inside PIDs array
var i = 0;
$('table.pid_tuning tr.ROLL input').each(function() {
$('table.pid_tuning tr.ROLL input').each(function () {
PIDs[0][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.PITCH input').each(function() {
$('table.pid_tuning tr.PITCH input').each(function () {
PIDs[1][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.YAW input').each(function() {
$('table.pid_tuning tr.YAW input').each(function () {
PIDs[2][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.ALT input').each(function() {
$('table.pid_tuning tr.ALT input').each(function () {
PIDs[3][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.Vario input').each(function() {
$('table.pid_tuning tr.Vario input').each(function () {
PIDs[9][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.Pos input').each(function() {
$('table.pid_tuning tr.Pos input').each(function () {
PIDs[4][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.PosR input').each(function() {
$('table.pid_tuning tr.PosR input').each(function () {
PIDs[5][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.NavR input').each(function() {
$('table.pid_tuning tr.NavR input').each(function () {
PIDs[6][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.LEVEL input').each(function() {
$('table.pid_tuning tr.LEVEL input').each(function () {
PIDs[7][i++] = parseFloat($(this).val());
});
i = 0;
$('table.pid_tuning tr.MAG input').each(function() {
$('table.pid_tuning tr.MAG input').each(function () {
PIDs[8][i++] = parseFloat($(this).val());
});
@ -304,14 +304,14 @@ TABS.pid_tuning.initialize = function(callback) {
}
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('pidTuningEepromSaved'));
});
}
});
// 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);
@ -319,6 +319,6 @@ TABS.pid_tuning.initialize = function(callback) {
}
};
TABS.pid_tuning.cleanup = function(callback) {
TABS.pid_tuning.cleanup = function (callback) {
if (callback) callback();
}

View File

@ -1,7 +1,7 @@
'use strict';
TABS.receiver = {};
TABS.receiver.initialize = function(callback) {
TABS.receiver.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'receiver';
googleAnalytics.sendAppView('Receiver Page');
@ -27,7 +27,7 @@ TABS.receiver.initialize = function(callback) {
$('.tunings .rate input[name="rate"]').val(RC_tuning.RC_RATE.toFixed(2));
$('.tunings .rate input[name="expo"]').val(RC_tuning.RC_EXPO.toFixed(2));
chrome.storage.local.get('rx_refresh_rate', function(result) {
chrome.storage.local.get('rx_refresh_rate', function (result) {
if (typeof result.rx_refresh_rate != 'undefined') {
$('select[name="rx_refresh_rate"]').val(result.rx_refresh_rate).change();
} else {
@ -36,9 +36,9 @@ TABS.receiver.initialize = function(callback) {
});
// generate bars
var bar_names = ['Roll', 'Pitch', 'Yaw', 'Throttle'];
var bar_container = $('.tab-receiver .bars');
var aux_index = 1;
var bar_names = ['Roll', 'Pitch', 'Yaw', 'Throttle'],
bar_container = $('.tab-receiver .bars'),
aux_index = 1;
for (var i = 0; i < RC.active_channels; i++) {
var name;
@ -59,19 +59,19 @@ TABS.receiver.initialize = function(callback) {
}
var meter_array = [];
$('meter', bar_container).each(function() {
$('meter', bar_container).each(function () {
meter_array.push($(this));
});
var meter_values_array = [];
$('.value', bar_container).each(function() {
$('.value', bar_container).each(function () {
meter_values_array.push($(this));
});
// UI Hooks
// curves
$('.tunings .throttle input').change(function() {
setTimeout(function() {
$('.tunings .throttle input').change(function () {
setTimeout(function () {
var mid = parseFloat($('.tunings .throttle input[name="mid"]').val());
var expo = parseFloat($('.tunings .throttle input[name="expo"]').val());
@ -98,8 +98,8 @@ TABS.receiver.initialize = function(callback) {
}, 0); // race condition, that should always trigger after all events are processed
}).change();
$('.tunings .rate input').change(function() {
setTimeout(function() {
$('.tunings .rate input').change(function () {
setTimeout(function () {
var rate = parseFloat($('.tunings .rate input[name="rate"]').val());
var expo = parseFloat($('.tunings .rate input[name="expo"]').val());
@ -118,8 +118,8 @@ TABS.receiver.initialize = function(callback) {
}, 0); // race condition, that should always trigger after all events are processed
}).change();
$('a.refresh').click(function() {
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, function() {
$('a.refresh').click(function () {
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, function () {
GUI.log(chrome.i18n.getMessage('receiverDataRefreshed'));
// fill in data from RC_tuning
@ -135,7 +135,7 @@ TABS.receiver.initialize = function(callback) {
});
});
$('a.update').click(function() {
$('a.update').click(function () {
// catch RC_tuning changes
RC_tuning.throttle_MID = parseFloat($('.tunings .throttle input[name="mid"]').val());
RC_tuning.throttle_EXPO = parseFloat($('.tunings .throttle input[name="expo"]').val());
@ -156,13 +156,13 @@ TABS.receiver.initialize = function(callback) {
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_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('receiverEepromSaved'));
});
}
});
$('select[name="rx_refresh_rate"]').change(function() {
$('select[name="rx_refresh_rate"]').change(function () {
var plot_update_rate = parseInt($(this).val(), 10);
// save update rate
@ -178,12 +178,12 @@ TABS.receiver.initialize = function(callback) {
RX_plot_data[i] = [];
}
var samples = 0;
var svg = d3.select("svg");
var samples = 0,
svg = d3.select("svg"),
RX_plot_e = $('#RX_plot'),
margin = {top: 20, right: 0, bottom: 10, left: 40},
width, height, widthScale, heightScale;
var RX_plot_e = $('#RX_plot');
var margin = {top: 20, right: 0, bottom: 10, left: 40};
var width, height, widthScale, heightScale;
function update_receiver_plot_size() {
width = RX_plot_e.width() - margin.left - margin.right;
height = RX_plot_e.height() - margin.top - margin.bottom;
@ -235,25 +235,25 @@ TABS.receiver.initialize = function(callback) {
var xAxis = d3.svg.axis().
scale(widthScale).
orient("bottom").
tickFormat(function(d) {return d;});
tickFormat(function (d) {return d;});
var yAxis = d3.svg.axis().
scale(heightScale).
orient("left").
tickFormat(function(d) {return d;});
tickFormat(function (d) {return d;});
var line = d3.svg.line().
x(function(d) {return widthScale(d[0]);}).
y(function(d) {return heightScale(d[1]);});
x(function (d) {return widthScale(d[0]);}).
y(function (d) {return heightScale(d[1]);});
svg.select(".x.grid").call(xGrid);
svg.select(".y.grid").call(yGrid);
svg.select(".x.axis").call(xAxis);
svg.select(".y.axis").call(yAxis);
var data = svg.select("g.data");
var lines = data.selectAll("path").data(RX_plot_data, function(d, i) { return i; });
var newLines = lines.enter().append("path").attr("class", "line");
var data = svg.select("g.data"),
lines = data.selectAll("path").data(RX_plot_data, function (d, i) {return i;}),
newLines = lines.enter().append("path").attr("class", "line");
lines.attr('d', line);
samples++;
@ -267,7 +267,7 @@ TABS.receiver.initialize = function(callback) {
});
// 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);
@ -275,6 +275,6 @@ TABS.receiver.initialize = function(callback) {
}
};
TABS.receiver.cleanup = function(callback) {
TABS.receiver.cleanup = function (callback) {
if (callback) callback();
};

View File

@ -1,7 +1,7 @@
'use strict';
TABS.sensors = {};
TABS.sensors.initialize = function(callback) {
TABS.sensors.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'sensors';
googleAnalytics.sendAppView('Sensor Page');
@ -88,17 +88,17 @@ TABS.sensors.initialize = function(callback) {
.scale(helpers.widthScale)
.ticks(5)
.orient("bottom")
.tickFormat(function(d) {return d;});
.tickFormat(function (d) {return d;});
helpers.yAxis = d3.svg.axis()
.scale(helpers.heightScale)
.ticks(5)
.orient("left")
.tickFormat(function(d) {return d;});
.tickFormat(function (d) {return d;});
helpers.line = d3.svg.line()
.x(function(d) { return helpers.widthScale(d[0]); })
.y(function(d) { return helpers.heightScale(d[1]); });
.x(function (d) {return helpers.widthScale(d[0]);})
.y(function (d) {return helpers.heightScale(d[1]);});
return helpers;
}
@ -108,7 +108,7 @@ TABS.sensors.initialize = function(callback) {
if (graphHelpers.dynamicHeightDomain) {
var limits = [];
$.each(data, function(idx, datum) {
$.each(data, function (idx, datum) {
limits.push(datum.min);
limits.push(datum.max);
});
@ -122,7 +122,7 @@ TABS.sensors.initialize = function(callback) {
svg.select(".y.axis").call(graphHelpers.yAxis);
var group = svg.select("g.data");
var lines = group.selectAll("path").data(data, function(d, i) { return i; });
var lines = group.selectAll("path").data(data, function (d, i) {return i;});
var newLines = lines.enter().append("path").attr("class", "line");
lines.attr('d', graphHelpers.line);
}
@ -180,7 +180,7 @@ TABS.sensors.initialize = function(callback) {
checkboxes.eq(2).prop('disabled', true);
}
$('.tab-sensors .info .checkboxes input').change(function() {
$('.tab-sensors .info .checkboxes input').change(function () {
var enable = $(this).prop('checked');
var index = $(this).parent().index();
@ -203,7 +203,7 @@ TABS.sensors.initialize = function(callback) {
}
var checkboxes = [];
$('.tab-sensors .info .checkboxes input').each(function() {
$('.tab-sensors .info .checkboxes input').each(function () {
checkboxes.push($(this).prop('checked'));
});
@ -212,7 +212,7 @@ TABS.sensors.initialize = function(callback) {
chrome.storage.local.set({'graphs_enabled': checkboxes});
});
chrome.storage.local.get('graphs_enabled', function(result) {
chrome.storage.local.get('graphs_enabled', function (result) {
if (result.graphs_enabled) {
var checkboxes = $('.tab-sensors .info .checkboxes input');
for (var i = 0; i < result.graphs_enabled.length; i++) {
@ -227,17 +227,16 @@ TABS.sensors.initialize = function(callback) {
initSensorData();
// Setup variables
var samples_gyro_i = 0;
var samples_accel_i = 0;
var samples_mag_i = 0;
var samples_baro_i = 0;
var samples_debug_i = 0;
var gyro_data = initDataArray(3);
var accel_data = initDataArray(3);
var mag_data = initDataArray(3);
var baro_data = initDataArray(1);
var debug_data = [
var samples_gyro_i = 0,
samples_accel_i = 0,
samples_mag_i = 0,
samples_baro_i = 0,
samples_debug_i = 0,
gyro_data = initDataArray(3),
accel_data = initDataArray(3),
mag_data = initDataArray(3),
baro_data = initDataArray(1),
debug_data = [
initDataArray(1),
initDataArray(1),
initDataArray(1),
@ -260,7 +259,7 @@ TABS.sensors.initialize = function(callback) {
y: [],
z: [],
};
$('.plot_control .x, .plot_control .y, .plot_control .z').each(function() {
$('.plot_control .x, .plot_control .y, .plot_control .z').each(function () {
var el = $(this);
if (el.hasClass('x')) {
raw_data_text_ements.x.push(el);
@ -272,7 +271,7 @@ TABS.sensors.initialize = function(callback) {
});
// set refresh speeds according to configuration saved in storage
chrome.storage.local.get('sensor_settings', function(result) {
chrome.storage.local.get('sensor_settings', function (result) {
if (result.sensor_settings) {
$('.tab-sensors select[name="gyro_refresh_rate"]').val(result.sensor_settings.rates.gyro);
$('.tab-sensors select[name="gyro_scale"]').val(result.sensor_settings.scales.gyro);
@ -294,7 +293,7 @@ TABS.sensors.initialize = function(callback) {
}
});
$('.tab-sensors .rate select, .tab-sensors .scale select').change(function() {
$('.tab-sensors .rate select, .tab-sensors .scale select').change(function () {
// if any of the select fields change value, all of the select values are grabbed
// and timers are re-initialized with the new settings
var rates = {
@ -327,7 +326,7 @@ TABS.sensors.initialize = function(callback) {
// fetch currently enabled plots
var checkboxes = [];
$('.tab-sensors .info .checkboxes input').each(function() {
$('.tab-sensors .info .checkboxes input').each(function () {
checkboxes.push($(this).prop('checked'));
});
@ -406,7 +405,7 @@ TABS.sensors.initialize = function(callback) {
});
// 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);
@ -414,7 +413,7 @@ TABS.sensors.initialize = function(callback) {
});
};
TABS.sensors.cleanup = function(callback) {
TABS.sensors.cleanup = function (callback) {
serial.empty_output_buffer();
if (callback) callback();

View File

@ -7,7 +7,7 @@
'use strict';
TABS.servos = {};
TABS.servos.initialize = function(callback) {
TABS.servos.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'servos';
googleAnalytics.sendAppView('Servos');
@ -111,7 +111,7 @@ TABS.servos.initialize = function(callback) {
$('div.tab-servos table.fields tr:last').data('info', {'obj': obj});
// UI hooks
$('div.tab-servos table.fields tr:last td.channel input').click(function() {
$('div.tab-servos table.fields tr:last td.channel input').click(function () {
if($(this).is(':checked')) {
$(this).parent().parent().find('td.middle input').prop('disabled', true);
$(this).parent().parent().find('.channel input').not($(this)).prop('checked', false);
@ -123,7 +123,7 @@ TABS.servos.initialize = function(callback) {
function servos_update(save_to_eeprom) {
// update bitfields
$('div.tab-servos table.directions tr:not(".main")').each(function() {
$('div.tab-servos table.directions tr:not(".main")').each(function () {
var info = $('select', this).data('info');
var val = parseInt($('select', this).val());
@ -133,7 +133,7 @@ TABS.servos.initialize = function(callback) {
});
// update the rest
$('div.tab-servos table.fields tr:not(".main")').each(function() {
$('div.tab-servos table.fields tr:not(".main")').each(function () {
var info = $(this).data('info');
if ($('.middle input', this).is(':disabled')) {
@ -182,7 +182,7 @@ TABS.servos.initialize = function(callback) {
if (save_to_eeprom) {
// Save changes 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('servosEepromSave'));
});
}
@ -280,14 +280,14 @@ TABS.servos.initialize = function(callback) {
}
// UI hooks for dynamically generated elements
$('table.directions select, table.directions input, table.fields select, table.fields input').change(function() {
$('table.directions select, table.directions input, table.fields select, table.fields input').change(function () {
if ($('div.live input').is(':checked')) {
// apply small delay as there seems to be some funky update business going wrong
GUI.timeout_add('servos_update', servos_update, 10);
}
});
$('a.update').click(function() {
$('a.update').click(function () {
// standard check for supported_models + custom implementation for feature servo_tilt
if (supported_models.indexOf(CONFIG.multiType) != -1 || AUX_CONFIG.indexOf('CAMSTAB') > -1 || AUX_CONFIG.indexOf('CAMTRIG') > -1) {
servos_update(true);
@ -295,7 +295,7 @@ TABS.servos.initialize = function(callback) {
});
// 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);
@ -303,6 +303,6 @@ TABS.servos.initialize = function(callback) {
}
};
TABS.servos.cleanup = function(callback) {
TABS.servos.cleanup = function (callback) {
if (callback) callback();
};