1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

moving send_message routine to MSP object

This commit is contained in:
cTn 2014-06-01 14:10:18 +02:00
parent 46cf844e7e
commit 5abe7473f8
13 changed files with 85 additions and 85 deletions

View file

@ -2,35 +2,35 @@ function configuration_backup() {
// request configuration data (one by one) // request configuration data (one by one)
function get_ident_data() { function get_ident_data() {
send_message(MSP_codes.MSP_IDENT, false, false, get_status_data); MSP.send_message(MSP_codes.MSP_IDENT, false, false, get_status_data);
} }
function get_status_data() { function get_status_data() {
send_message(MSP_codes.MSP_STATUS, false, false, get_pid_data); MSP.send_message(MSP_codes.MSP_STATUS, false, false, get_pid_data);
} }
function get_pid_data() { function get_pid_data() {
send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data); MSP.send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data);
} }
function get_rc_tuning_data() { function get_rc_tuning_data() {
send_message(MSP_codes.MSP_RC_TUNING, false, false, get_box_names_data); MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, get_box_names_data);
} }
function get_box_names_data() { function get_box_names_data() {
send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data); MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data);
} }
function get_box_data() { function get_box_data() {
send_message(MSP_codes.MSP_BOX, false, false, get_acc_trim_data); MSP.send_message(MSP_codes.MSP_BOX, false, false, get_acc_trim_data);
} }
function get_acc_trim_data() { function get_acc_trim_data() {
send_message(MSP_codes.MSP_ACC_TRIM, false, false, get_misc_data); MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, get_misc_data);
} }
function get_misc_data() { function get_misc_data() {
send_message(MSP_codes.MSP_MISC, false, false, backup); MSP.send_message(MSP_codes.MSP_MISC, false, false, backup);
} }
function backup() { function backup() {
@ -222,7 +222,7 @@ function configuration_upload() {
} }
// Send over the PID changes // Send over the PID changes
send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, rc_tuning); MSP.send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, rc_tuning);
function rc_tuning() { function rc_tuning() {
// RC Tuning section // RC Tuning section
@ -236,7 +236,7 @@ function configuration_upload() {
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100); RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
// Send over the RC_tuning changes // Send over the RC_tuning changes
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, aux); MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, aux);
} }
function aux() { function aux() {
@ -250,7 +250,7 @@ function configuration_upload() {
} }
// Send over the AUX changes // Send over the AUX changes
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, trim); MSP.send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, trim);
} }
// Trim section // Trim section
@ -262,7 +262,7 @@ function configuration_upload() {
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]); buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
// Send over the new trims // Send over the new trims
send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out, false, misc); MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out, false, misc);
} }
function misc() { function misc() {
@ -293,9 +293,9 @@ function configuration_upload() {
buffer_out[21] = 0; // vbatlevel_crit (unused) buffer_out[21] = 0; // vbatlevel_crit (unused)
// Send ove the new MISC // Send ove the new MISC
send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, function() { MSP.send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, function() {
// Save changes to EEPROM // Save changes to EEPROM
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('eeprom_saved_ok')); GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
}); });
}); });

View file

@ -249,7 +249,7 @@ GUI_control.prototype.tab_switch_cleanup = function(callback) {
buffer_out.push(highByte(MISC.mincommand)); buffer_out.push(highByte(MISC.mincommand));
} }
send_message(MSP_codes.MSP_SET_MOTOR, buffer_out, false, function() { MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer_out, false, function() {
if (callback) callback(); if (callback) callback();
}); });
} else { } else {

View file

@ -386,16 +386,16 @@ MSP.process_data = function(code, message_buffer, message_length) {
// With new flight software settings in place, we have to re-pull // With new flight software settings in place, we have to re-pull
// latest values // latest values
send_message(MSP_codes.MSP_IDENT); MSP.send_message(MSP_codes.MSP_IDENT);
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
send_message(MSP_codes.MSP_PID); MSP.send_message(MSP_codes.MSP_PID);
send_message(MSP_codes.MSP_RC_TUNING); MSP.send_message(MSP_codes.MSP_RC_TUNING);
send_message(MSP_codes.MSP_BOXNAMES); MSP.send_message(MSP_codes.MSP_BOXNAMES);
send_message(MSP_codes.MSP_BOX); MSP.send_message(MSP_codes.MSP_BOX);
// baseflight specific // baseflight specific
send_message(MSP_codes.MSP_UID); MSP.send_message(MSP_codes.MSP_UID);
send_message(MSP_codes.MSP_ACC_TRIM); MSP.send_message(MSP_codes.MSP_ACC_TRIM);
break; break;
case MSP_codes.MSP_SELECT_SETTING: case MSP_codes.MSP_SELECT_SETTING:
console.log('Profile selected'); console.log('Profile selected');
@ -466,7 +466,7 @@ MSP.process_data = function(code, message_buffer, message_length) {
} }
}; };
function send_message(code, data, callback_sent, callback_msp) { MSP.send_message = function(code, data, callback_sent, callback_msp) {
var bufferOut; var bufferOut;
var bufView; var bufView;

View file

@ -137,9 +137,9 @@ function onOpen(openInfo) {
}, 10000); }, 10000);
// request configuration data // request configuration data
send_message(MSP_codes.MSP_UID, false, false, function() { MSP.send_message(MSP_codes.MSP_UID, false, false, function() {
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)])); GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
send_message(MSP_codes.MSP_IDENT, false, false, function() { MSP.send_message(MSP_codes.MSP_IDENT, false, false, function() {
GUI.timeout_remove('connecting'); // kill connecting timer GUI.timeout_remove('connecting'); // kill connecting timer
GUI.log(chrome.i18n.getMessage('firmwareVersion', [CONFIG.version])); GUI.log(chrome.i18n.getMessage('firmwareVersion', [CONFIG.version]));

View file

@ -2,10 +2,10 @@ function tab_initialize_auxiliary_configuration() {
ga_tracker.sendAppView('Auxiliary Configuration'); ga_tracker.sendAppView('Auxiliary Configuration');
GUI.active_tab = 'auxiliary_configuration'; GUI.active_tab = 'auxiliary_configuration';
send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data); MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_box_data);
function get_box_data() { function get_box_data() {
send_message(MSP_codes.MSP_BOX, false, false, load_html); MSP.send_message(MSP_codes.MSP_BOX, false, false, load_html);
} }
function load_html() { function load_html() {
@ -94,10 +94,10 @@ function tab_initialize_auxiliary_configuration() {
AUX_val_buffer_out[needle++] = highByte(AUX_CONFIG_values[i]); AUX_val_buffer_out[needle++] = highByte(AUX_CONFIG_values[i]);
} }
send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, save_to_eeprom); MSP.send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, save_to_eeprom);
function save_to_eeprom() { function save_to_eeprom() {
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')); GUI.log(chrome.i18n.getMessage('auxiliaryEepromSaved'));
var element = $('a.update'); var element = $('a.update');
@ -112,7 +112,7 @@ function tab_initialize_auxiliary_configuration() {
// data pulling functions used inside interval timer // data pulling functions used inside interval timer
function get_rc_data() { function get_rc_data() {
send_message(MSP_codes.MSP_RC, false, false, update_ui); MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
} }
function update_ui() { function update_ui() {
@ -139,7 +139,7 @@ function tab_initialize_auxiliary_configuration() {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
} }
} }

View file

@ -2,7 +2,7 @@ function tab_initialize_gps () {
ga_tracker.sendAppView('GPS Page'); ga_tracker.sendAppView('GPS Page');
GUI.active_tab = 'gps'; GUI.active_tab = 'gps';
send_message(MSP_codes.MSP_RAW_GPS, false, false, load_html); MSP.send_message(MSP_codes.MSP_RAW_GPS, false, false, load_html);
function load_html() { function load_html() {
$('#content').load("./tabs/gps.html", process_html); $('#content').load("./tabs/gps.html", process_html);
@ -13,11 +13,11 @@ function tab_initialize_gps () {
localize(); localize();
function get_raw_gps_data() { function get_raw_gps_data() {
send_message(MSP_codes.MSP_RAW_GPS, false, false, get_gpsvinfo_data); MSP.send_message(MSP_codes.MSP_RAW_GPS, false, false, get_gpsvinfo_data);
} }
function get_gpsvinfo_data() { function get_gpsvinfo_data() {
send_message(MSP_codes.MSP_GPSSVINFO, false, false, update_ui); MSP.send_message(MSP_codes.MSP_GPSSVINFO, false, false, update_ui);
} }
function update_ui() { function update_ui() {
@ -50,7 +50,7 @@ function tab_initialize_gps () {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
} }
} }

View file

@ -2,14 +2,14 @@ function tab_initialize_initial_setup() {
ga_tracker.sendAppView('Initial Setup'); ga_tracker.sendAppView('Initial Setup');
GUI.active_tab = 'initial_setup'; GUI.active_tab = 'initial_setup';
send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_ident); MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_ident);
function load_ident() { function load_ident() {
send_message(MSP_codes.MSP_IDENT, false, false, load_misc_data); MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_misc_data);
} }
function load_misc_data() { function load_misc_data() {
send_message(MSP_codes.MSP_MISC, false, false, load_html); MSP.send_message(MSP_codes.MSP_MISC, false, false, load_html);
} }
function load_html() { function load_html() {
@ -114,7 +114,7 @@ function tab_initialize_initial_setup() {
// During this period MCU won't be able to process any serial commands because its locked in a for/while loop // 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 // until this operation finishes, sending more commands through data_poll() will result in serial buffer overflow
GUI.interval_pause('initial_setup_data_pull'); GUI.interval_pause('initial_setup_data_pull');
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.log(chrome.i18n.getMessage('initialSetupAccelCalibStarted'));
}); });
@ -134,7 +134,7 @@ function tab_initialize_initial_setup() {
if (!self.hasClass('calibrating')) { if (!self.hasClass('calibrating')) {
self.addClass('calibrating'); self.addClass('calibrating');
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.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
}); });
@ -146,7 +146,7 @@ function tab_initialize_initial_setup() {
}); });
$('a.resetSettings').click(function() { $('a.resetSettings').click(function() {
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.log(chrome.i18n.getMessage('initialSetupSettingsRestored'));
GUI.tab_switch_cleanup(function() { GUI.tab_switch_cleanup(function() {
@ -167,7 +167,7 @@ function tab_initialize_initial_setup() {
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]); buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
// Send over the new trims // Send over the new trims
send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out); MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out);
MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val()) * 10; MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val()) * 10;
MISC.vbatmaxcellvoltage = parseFloat($('input[name="maxcellvoltage"]').val()) * 10; MISC.vbatmaxcellvoltage = parseFloat($('input[name="maxcellvoltage"]').val()) * 10;
@ -206,10 +206,10 @@ function tab_initialize_initial_setup() {
buffer_out[21] = 0; // vbatlevel_crit (unused) buffer_out[21] = 0; // vbatlevel_crit (unused)
// Send over new misc // Send over new misc
send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, save_to_eeprom); MSP.send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, save_to_eeprom);
function save_to_eeprom() { function save_to_eeprom() {
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')); GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved'));
var element = $('a.update'); var element = $('a.update');
@ -234,11 +234,11 @@ function tab_initialize_initial_setup() {
// data pulling functions used inside interval timer // data pulling functions used inside interval timer
function get_analog_data() { function get_analog_data() {
send_message(MSP_codes.MSP_ANALOG, false, false, get_attitude_data); MSP.send_message(MSP_codes.MSP_ANALOG, false, false, get_attitude_data);
} }
function get_attitude_data() { function get_attitude_data() {
send_message(MSP_codes.MSP_ATTITUDE, false, false, update_ui); MSP.send_message(MSP_codes.MSP_ATTITUDE, false, false, update_ui);
} }
function update_ui() { function update_ui() {
@ -260,7 +260,7 @@ function tab_initialize_initial_setup() {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
} }
} }

View file

@ -4,10 +4,10 @@ function tab_initialize_logging() {
var requested_properties = []; var requested_properties = [];
send_message(MSP_codes.MSP_RC, false, false, get_motor_data); MSP.send_message(MSP_codes.MSP_RC, false, false, get_motor_data);
function get_motor_data() { function get_motor_data() {
send_message(MSP_codes.MSP_MOTOR, false, false, load_html); MSP.send_message(MSP_codes.MSP_MOTOR, false, false, load_html);
} }
function load_html() { function load_html() {
@ -45,13 +45,13 @@ function tab_initialize_logging() {
// request new // request new
for (var i = 0; i < requested_properties.length; i++) { for (var i = 0; i < requested_properties.length; i++) {
send_message(MSP_codes[requested_properties[i]]); MSP.send_message(MSP_codes[requested_properties[i]]);
/* this approach could be used if we want to utilize request time compensation /* this approach could be used if we want to utilize request time compensation
if (i < requested_properties.length -1) { if (i < requested_properties.length -1) {
send_message(requested_properties[i]); MSP.send_message(requested_properties[i]);
} else { } else {
send_message(requested_properties[i], false, false, poll_data); MSP.send_message(requested_properties[i], false, false, poll_data);
} }
*/ */
} }

View file

@ -2,10 +2,10 @@ function tab_initialize_motor_outputs() {
ga_tracker.sendAppView('Motor Outputs Page'); ga_tracker.sendAppView('Motor Outputs Page');
GUI.active_tab = 'motor_outputs'; GUI.active_tab = 'motor_outputs';
send_message(MSP_codes.MSP_MISC, false, false, get_motor_data); MSP.send_message(MSP_codes.MSP_MISC, false, false, get_motor_data);
function get_motor_data() { function get_motor_data() {
send_message(MSP_codes.MSP_MOTOR, false, false, load_html); MSP.send_message(MSP_codes.MSP_MOTOR, false, false, load_html);
} }
function load_html() { function load_html() {
@ -48,7 +48,7 @@ function tab_initialize_motor_outputs() {
buffer_out.push(highByte(val)); buffer_out.push(highByte(val));
} }
send_message(MSP_codes.MSP_SET_MOTOR, buffer_out); MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer_out);
}); });
$('div.sliders input.master').on('input', function() { $('div.sliders input.master').on('input', function() {
@ -80,11 +80,11 @@ function tab_initialize_motor_outputs() {
// data pulling functions used inside interval timer // data pulling functions used inside interval timer
function get_motor_data() { function get_motor_data() {
send_message(MSP_codes.MSP_MOTOR, false, false, get_servo_data); MSP.send_message(MSP_codes.MSP_MOTOR, false, false, get_servo_data);
} }
function get_servo_data() { function get_servo_data() {
send_message(MSP_codes.MSP_SERVO, false, false, update_ui); MSP.send_message(MSP_codes.MSP_SERVO, false, false, update_ui);
} }
function update_ui() { function update_ui() {
@ -114,7 +114,7 @@ function tab_initialize_motor_outputs() {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
} }
} }

View file

@ -3,18 +3,18 @@ function tab_initialize_pid_tuning() {
GUI.active_tab = 'pid_tuning'; GUI.active_tab = 'pid_tuning';
// requesting MSP_STATUS manually because it contains CONFIG.profile // requesting MSP_STATUS manually because it contains CONFIG.profile
send_message(MSP_codes.MSP_STATUS, false, false, get_pid_names); MSP.send_message(MSP_codes.MSP_STATUS, false, false, get_pid_names);
function get_pid_names() { function get_pid_names() {
send_message(MSP_codes.MSP_PIDNAMES, false, false, get_pid_data); MSP.send_message(MSP_codes.MSP_PIDNAMES, false, false, get_pid_data);
} }
function get_pid_data() { function get_pid_data() {
send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data); MSP.send_message(MSP_codes.MSP_PID, false, false, get_rc_tuning_data);
} }
function get_rc_tuning_data() { function get_rc_tuning_data() {
send_message(MSP_codes.MSP_RC_TUNING, false, false, load_html); MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, load_html);
} }
function load_html() { function load_html() {
@ -180,7 +180,7 @@ function tab_initialize_pid_tuning() {
// UI Hooks // UI Hooks
$('input[name="profile"]').change(function() { $('input[name="profile"]').change(function() {
var profile = parseInt($(this).val()); var profile = parseInt($(this).val());
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.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [profile]));
GUI.tab_switch_cleanup(tab_initialize_pid_tuning); GUI.tab_switch_cleanup(tab_initialize_pid_tuning);
@ -276,7 +276,7 @@ function tab_initialize_pid_tuning() {
} }
// Send over the PID changes // Send over the PID changes
send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, send_rc_tuning_changes); MSP.send_message(MSP_codes.MSP_SET_PID, PID_buffer_out, false, send_rc_tuning_changes);
function send_rc_tuning_changes() { function send_rc_tuning_changes() {
// catch RC_tuning changes // catch RC_tuning changes
@ -294,11 +294,11 @@ function tab_initialize_pid_tuning() {
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100); RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100);
// Send over the RC_tuning changes // Send over the RC_tuning changes
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom); MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom);
} }
function save_to_eeprom() { function save_to_eeprom() {
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')); GUI.log(chrome.i18n.getMessage('pidTuningEepromSaved'));
var element = $('a.update'); var element = $('a.update');
@ -313,7 +313,7 @@ function tab_initialize_pid_tuning() {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
} }
} }

View file

@ -2,10 +2,10 @@ function tab_initialize_receiver() {
ga_tracker.sendAppView('Receiver Page'); ga_tracker.sendAppView('Receiver Page');
GUI.active_tab = 'receiver'; GUI.active_tab = 'receiver';
send_message(MSP_codes.MSP_RC_TUNING, false, false, get_rc_data); MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, get_rc_data);
function get_rc_data() { function get_rc_data() {
send_message(MSP_codes.MSP_RC, false, false, load_html); MSP.send_message(MSP_codes.MSP_RC, false, false, load_html);
} }
function load_html() { function load_html() {
@ -115,7 +115,7 @@ function tab_initialize_receiver() {
}).change(); }).change();
$('a.refresh').click(function() { $('a.refresh').click(function() {
send_message(MSP_codes.MSP_RC_TUNING, false, false, function() { MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, function() {
GUI.log(chrome.i18n.getMessage('receiverDataRefreshed')); GUI.log(chrome.i18n.getMessage('receiverDataRefreshed'));
// fill in data from RC_tuning // fill in data from RC_tuning
@ -149,10 +149,10 @@ function tab_initialize_receiver() {
RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100, 10); RC_tuning_buffer_out[6] = parseInt(RC_tuning.throttle_EXPO * 100, 10);
// Send over the RC_tuning changes // Send over the RC_tuning changes
send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom); MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, RC_tuning_buffer_out, false, save_to_eeprom);
function save_to_eeprom() { function save_to_eeprom() {
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')); GUI.log(chrome.i18n.getMessage('receiverEepromSaved'));
var element = $('a.update'); var element = $('a.update');
@ -172,7 +172,7 @@ function tab_initialize_receiver() {
chrome.storage.local.set({'rx_refresh_rate': plot_update_rate}); chrome.storage.local.set({'rx_refresh_rate': plot_update_rate});
function get_rc_data() { function get_rc_data() {
send_message(MSP_codes.MSP_RC, false, false, update_ui); MSP.send_message(MSP_codes.MSP_RC, false, false, update_ui);
} }
// setup plot // setup plot
@ -271,7 +271,7 @@ function tab_initialize_receiver() {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
} }
} }

View file

@ -333,19 +333,19 @@ function tab_initialize_sensors() {
// data pulling timers // data pulling timers
if (checkboxes[0] || checkboxes[1] || checkboxes[2]) { if (checkboxes[0] || checkboxes[1] || checkboxes[2]) {
GUI.interval_add('IMU_pull', function imu_data_pull() { GUI.interval_add('IMU_pull', function imu_data_pull() {
send_message(MSP_codes.MSP_RAW_IMU, false, false, update_imu_graphs); MSP.send_message(MSP_codes.MSP_RAW_IMU, false, false, update_imu_graphs);
}, fastest, true); }, fastest, true);
} }
if (checkboxes[3]) { if (checkboxes[3]) {
GUI.interval_add('altitude_pull', function altitude_data_pull() { GUI.interval_add('altitude_pull', function altitude_data_pull() {
send_message(MSP_codes.MSP_ALTITUDE, false, false, update_altitude_graph); MSP.send_message(MSP_codes.MSP_ALTITUDE, false, false, update_altitude_graph);
}, rates.baro, true); }, rates.baro, true);
} }
if (checkboxes[4]) { if (checkboxes[4]) {
GUI.interval_add('debug_pull', function debug_data_pull() { GUI.interval_add('debug_pull', function debug_data_pull() {
send_message(MSP_codes.MSP_DEBUG, false, false, update_debug_graphs); MSP.send_message(MSP_codes.MSP_DEBUG, false, false, update_debug_graphs);
}, rates.debug, true); }, rates.debug, true);
} }
@ -403,7 +403,7 @@ function tab_initialize_sensors() {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
}); });
} }

View file

@ -9,14 +9,14 @@ function tab_initialize_servos() {
ga_tracker.sendAppView('Servos'); ga_tracker.sendAppView('Servos');
GUI.active_tab = 'servos'; GUI.active_tab = 'servos';
send_message(MSP_codes.MSP_IDENT, false, false, get_servo_conf_data); MSP.send_message(MSP_codes.MSP_IDENT, false, false, get_servo_conf_data);
function get_servo_conf_data() { function get_servo_conf_data() {
send_message(MSP_codes.MSP_SERVO_CONF, false, false, get_boxnames_data); MSP.send_message(MSP_codes.MSP_SERVO_CONF, false, false, get_boxnames_data);
} }
function get_boxnames_data() { function get_boxnames_data() {
send_message(MSP_codes.MSP_BOXNAMES, false, false, load_html); MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, load_html);
} }
function load_html() { function load_html() {
@ -175,11 +175,11 @@ function tab_initialize_servos() {
buffer_out[needle++] = lowByte(SERVO_CONFIG[i].rate); buffer_out[needle++] = lowByte(SERVO_CONFIG[i].rate);
} }
send_message(MSP_codes.MSP_SET_SERVO_CONF, buffer_out); MSP.send_message(MSP_codes.MSP_SET_SERVO_CONF, buffer_out);
if (save_to_eeprom) { if (save_to_eeprom) {
// Save changes to EEPROM // Save changes to EEPROM
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')); GUI.log(chrome.i18n.getMessage('servosEepromSave'));
var element = $('a.update'); var element = $('a.update');
@ -300,7 +300,7 @@ function tab_initialize_servos() {
// status data pulled via separate timer with static speed // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function() { GUI.interval_add('status_pull', function() {
send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true); }, 250, true);
} }
} }