1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

new UI population / JS execution order

(blink bugfix for several tabs)
This commit is contained in:
cTn 2014-02-14 22:17:51 +01:00
parent d4dbb880d6
commit ce351d7521
10 changed files with 588 additions and 597 deletions

View file

@ -1,11 +1,10 @@
function tab_initialize_auxiliary_configuration() { function tab_initialize_auxiliary_configuration() {
ga_tracker.sendAppView('Auxiliary Configuration'); ga_tracker.sendAppView('Auxiliary Configuration');
$('#content').load("./tabs/auxiliary_configuration.html", function() {
GUI.active_tab = 'auxiliary_configuration'; GUI.active_tab = 'auxiliary_configuration';
send_message(MSP_codes.MSP_BOXNAMES, MSP_codes.MSP_BOXNAMES, false, function() { send_message(MSP_codes.MSP_BOXNAMES, MSP_codes.MSP_BOXNAMES, false, function() {
send_message(MSP_codes.MSP_BOX, MSP_codes.MSP_BOX, false, function() { send_message(MSP_codes.MSP_BOX, MSP_codes.MSP_BOX, false, function() {
$('#content').load("./tabs/auxiliary_configuration.html", function() {
// generate table from the supplied AUX names and AUX data // generate table from the supplied AUX names and AUX data
for (var i = 0; i < AUX_CONFIG.length; i++) { for (var i = 0; i < AUX_CONFIG.length; i++) {
$('.boxes > tbody:last').append( $('.boxes > tbody:last').append(

View file

@ -23,13 +23,12 @@ cli_history = new CliHistory();
function tab_initialize_cli() { function tab_initialize_cli() {
ga_tracker.sendAppView('CLI Page'); ga_tracker.sendAppView('CLI Page');
$('#content').load("./tabs/cli.html", function() {
GUI.active_tab = 'cli'; GUI.active_tab = 'cli';
// remove any active interval for delayed command // remove any active interval for delayed command
MSP.callbacks_cleanup(); MSP.callbacks_cleanup();
$('#content').load("./tabs/cli.html", function() {
CLI_active = true; CLI_active = true;
// Enter CLI mode // Enter CLI mode

View file

@ -1,7 +1,7 @@
function tab_initialize_default() { function tab_initialize_default() {
$('#content').load("./tabs/default.html", function() {
GUI.active_tab = 'default'; GUI.active_tab = 'default';
$('#content').load("./tabs/default.html", function() {
// load changelog content // load changelog content
$('div.changelog.configurator .wrapper').load('./changelog.html'); $('div.changelog.configurator .wrapper').load('./changelog.html');

View file

@ -1,9 +1,8 @@
function tab_initialize_gps () { function tab_initialize_gps () {
ga_tracker.sendAppView('GPS Page'); ga_tracker.sendAppView('GPS Page');
$('#content').load("./tabs/gps.html", function() {
GUI.active_tab = 'gps'; GUI.active_tab = 'gps';
$('#content').load("./tabs/gps.html", function() {
// enable data pulling // enable data pulling
GUI.interval_add('gps_pull', function() { GUI.interval_add('gps_pull', function() {
// Update GPS data // Update GPS data

View file

@ -1,12 +1,10 @@
function tab_initialize_initial_setup() { function tab_initialize_initial_setup() {
ga_tracker.sendAppView('Initial Setup'); ga_tracker.sendAppView('Initial Setup');
$('#content').load("./tabs/initial_setup.html", function() {
GUI.active_tab = 'initial_setup'; GUI.active_tab = 'initial_setup';
send_message(MSP_codes.MSP_IDENT, MSP_codes.MSP_IDENT, false, function() {
send_message(MSP_codes.MSP_ACC_TRIM, MSP_codes.MSP_ACC_TRIM, false, function() { send_message(MSP_codes.MSP_ACC_TRIM, MSP_codes.MSP_ACC_TRIM, false, function() {
send_message(MSP_codes.MSP_MISC, MSP_codes.MSP_MISC, false, function() { send_message(MSP_codes.MSP_MISC, MSP_codes.MSP_MISC, false, function() {
$('#content').load("./tabs/initial_setup.html", function() {
var yaw_fix = 0.0; var yaw_fix = 0.0;
// Fill in misc stuff // Fill in misc stuff
@ -245,5 +243,4 @@ function tab_initialize_initial_setup() {
}); });
}); });
}); });
});
} }

View file

@ -1,15 +1,14 @@
function tab_initialize_motor_outputs() { function tab_initialize_motor_outputs() {
ga_tracker.sendAppView('Motor Outputs Page'); ga_tracker.sendAppView('Motor Outputs Page');
$('#content').load("./tabs/motor_outputs.html", function() {
GUI.active_tab = 'motor_outputs'; GUI.active_tab = 'motor_outputs';
send_message(MSP_codes.MSP_MISC, MSP_codes.MSP_MISC, false, function() {
$('#content').load("./tabs/motor_outputs.html", function() {
// if CAP_DYNBALANCE is true // if CAP_DYNBALANCE is true
if (bit_check(CONFIG.capability, 2)) { if (bit_check(CONFIG.capability, 2)) {
$('div.motor_testing').show(); $('div.motor_testing').show();
} }
send_message(MSP_codes.MSP_MISC, MSP_codes.MSP_MISC, false, function() {
$('input.min').val(MISC.minthrottle); $('input.min').val(MISC.minthrottle);
$('input.max').val(MISC.maxthrottle); $('input.max').val(MISC.maxthrottle);
@ -18,7 +17,6 @@ function tab_initialize_motor_outputs() {
$('div.sliders input').prop('max', MISC.maxthrottle); $('div.sliders input').prop('max', MISC.maxthrottle);
$('div.sliders input').val(MISC.minthrottle); $('div.sliders input').val(MISC.minthrottle);
$('div.values li:not(:last)').html(MISC.minthrottle); $('div.values li:not(:last)').html(MISC.minthrottle);
});
// UI hooks // UI hooks
$('div.sliders input:not(.master)').change(function() { $('div.sliders input:not(.master)').change(function() {
@ -106,4 +104,5 @@ function tab_initialize_motor_outputs() {
}); });
}, 50, true); }, 50, true);
}); });
});
} }

View file

@ -1,11 +1,10 @@
function tab_initialize_pid_tuning() { function tab_initialize_pid_tuning() {
ga_tracker.sendAppView('PID Tuning'); ga_tracker.sendAppView('PID Tuning');
$('#content').load("./tabs/pid_tuning.html", function() {
GUI.active_tab = 'pid_tuning'; GUI.active_tab = 'pid_tuning';
send_message(MSP_codes.MSP_PID, MSP_codes.MSP_PID, false, function() { send_message(MSP_codes.MSP_PID, MSP_codes.MSP_PID, false, function() {
send_message(MSP_codes.MSP_RC_TUNING, MSP_codes.MSP_RC_TUNING, false, function() { send_message(MSP_codes.MSP_RC_TUNING, MSP_codes.MSP_RC_TUNING, false, function() {
$('#content').load("./tabs/pid_tuning.html", function() {
// Fill in the data from PIDs array // Fill in the data from PIDs array
var i = 0; var i = 0;
$('.pid_tuning .ROLL input').each(function() { $('.pid_tuning .ROLL input').each(function() {

View file

@ -1,10 +1,10 @@
function tab_initialize_receiver() { function tab_initialize_receiver() {
ga_tracker.sendAppView('Receiver Page'); ga_tracker.sendAppView('Receiver Page');
$('#content').load("./tabs/receiver.html", function() {
GUI.active_tab = 'receiver'; GUI.active_tab = 'receiver';
send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC, false, function() {
send_message(MSP_codes.MSP_RC_TUNING, MSP_codes.MSP_RC_TUNING, false, function() { send_message(MSP_codes.MSP_RC_TUNING, MSP_codes.MSP_RC_TUNING, false, function() {
$('#content').load("./tabs/receiver.html", function() {
// fill in data from RC_tuning // fill in data from RC_tuning
$('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2)); $('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2));
$('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2)); $('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2));
@ -221,4 +221,5 @@ function tab_initialize_receiver() {
}, 50, true); }, 50, true);
}); });
}); });
});
} }

View file

@ -1,9 +1,8 @@
function tab_initialize_sensors() { function tab_initialize_sensors() {
ga_tracker.sendAppView('Sensor Page'); ga_tracker.sendAppView('Sensor Page');
$('#content').load("./tabs/sensors.html", function() {
GUI.active_tab = 'sensors'; GUI.active_tab = 'sensors';
$('#content').load("./tabs/sensors.html", function() {
// Setup variables // Setup variables
samples_gyro_i = 300; samples_gyro_i = 300;
samples_accel_i = 300; samples_accel_i = 300;

View file

@ -7,20 +7,19 @@
function tab_initialize_servos() { function tab_initialize_servos() {
ga_tracker.sendAppView('Servos'); ga_tracker.sendAppView('Servos');
$('#content').load("./tabs/servos.html", function() {
GUI.active_tab = 'servos'; GUI.active_tab = 'servos';
var model = $('div.tab-servos strong.model');
var supported_models = [1, 4, 5, 8, 14, 20, 21];
// request current Servos Config // request current Servos Config
send_message(MSP_codes.MSP_IDENT, MSP_codes.MSP_IDENT, false, function() { send_message(MSP_codes.MSP_IDENT, MSP_codes.MSP_IDENT, false, function() {
send_message(MSP_codes.MSP_SERVO_CONF, MSP_codes.MSP_SERVO_CONF, false, function() { send_message(MSP_codes.MSP_SERVO_CONF, MSP_codes.MSP_SERVO_CONF, false, function() {
send_message(MSP_codes.MSP_BOXNAMES, MSP_codes.MSP_BOXNAMES, false, function() { send_message(MSP_codes.MSP_BOXNAMES, MSP_codes.MSP_BOXNAMES, false, function() {
$('#content').load("./tabs/servos.html", function() {
// drop previous table // drop previous table
$('div.tab-servos table.fields tr:not(:first)').remove(); $('div.tab-servos table.fields tr:not(:first)').remove();
var model = $('div.tab-servos strong.model');
var supported_models = [1, 4, 5, 8, 14, 20, 21];
switch (CONFIG.multiType) { switch (CONFIG.multiType) {
case 1: // TRI case 1: // TRI
// looking ok so far // looking ok so far
@ -92,7 +91,7 @@ function tab_initialize_servos() {
break; break;
default: default:
model.html('Doesn\'t support servos'); model.html("This model doesn't support servos");
// implementation of feature servo_tilt // implementation of feature servo_tilt
if (AUX_CONFIG.indexOf('CAMSTAB') > -1 || AUX_CONFIG.indexOf('CAMTRIG') > -1) { if (AUX_CONFIG.indexOf('CAMSTAB') > -1 || AUX_CONFIG.indexOf('CAMTRIG') > -1) {
@ -113,9 +112,6 @@ function tab_initialize_servos() {
GUI.timeout_add('servos_update', servos_update, 10); 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 // standard check for supported_models + custom implementation for feature servo_tilt
@ -129,6 +125,9 @@ function tab_initialize_servos() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS); send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
}, 50); }, 50);
}); });
});
});
});
} }
function servos_update(save_to_eeprom) { function servos_update(save_to_eeprom) {