save accel settings separately in motors tab

10.3.x-maintenance
cTn 2014-06-25 13:06:55 +02:00
parent d128bd76a5
commit 6e52d3700d
1 changed files with 17 additions and 4 deletions

View File

@ -158,10 +158,27 @@ function tab_initialize_motor_outputs() {
}
});
// set refresh speeds according to configuration saved in storage
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);
// start polling data by triggering refresh rate change event
$('.tab-motor_outputs .rate select:first').change();
} else {
// start polling immediatly (as there is no configuration saved in the storage)
$('.tab-motor_outputs .rate select:first').change();
}
});
$('.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());
// store current/latest refresh rates in the storage
chrome.storage.local.set({'motors_tab_accel_settings': {'rate': rate, 'scale': scale}});
accelHelpers = initGraphHelpers('#accel', samples_accel_i, [-scale, scale]);
// timer initialization
@ -182,10 +199,6 @@ function tab_initialize_motor_outputs() {
}
});
// fire change event to start accel plot
$('.tab-motor_outputs .rate select:first').change();
// if CAP_DYNBALANCE is true
if (bit_check(CONFIG.capability, 2)) {
$('div.motor_testing').show();