var connectionId = -1; var connection_delay = 0; // delay which defines "when" will the configurator request configurator data after connection was established var configuration_received = false; var MSP_codes = { MSP_IDENT: 100, MSP_STATUS: 101, MSP_RAW_IMU: 102, MSP_SERVO: 103, MSP_MOTOR: 104, MSP_RC: 105, MSP_RAW_GPS: 106, MSP_COMP_GPS: 107, MSP_ATTITUDE: 108, MSP_ALTITUDE: 109, MSP_BAT: 110, MSP_RC_TUNING: 111, MSP_PID: 112, MSP_BOX: 113, MSP_MISC: 114, MSP_MOTOR_PINS: 115, MSP_BOXNAMES: 116, MSP_PIDNAMES: 117, MSP_SET_RAW_RC: 200, MSP_SET_RAW_GPS: 201, MSP_SET_PID: 202, MSP_SET_BOX: 203, MSP_SET_RC_TUNING: 204, MSP_ACC_CALIBRATION: 205, MSP_MAG_CALIBRATION: 206, MSP_SET_MISC: 207, MSP_RESET_CONF: 208, MSP_SELECT_SETTING: 210, MSP_BIND: 240, MSP_EEPROM_WRITE: 250, MSP_DEBUGMSG: 253, MSP_DEBUG: 254 } var CONFIG = { version: 0, multiType: 0, cycleTime: 0, i2cError: 0, activeSensors: 0, mode: 0 } var PIDs = new Array(10); for (var i = 0; i < 10; i++) { PIDs[i] = new Array(3); } var RC = { roll: 0, pitch: 0, yaw: 0, throttle: 0, AUX1: 0, AUX2: 0, AUX3: 0, AUX4: 0 } var RC_tuning = { RC_RATE: 0, RC_EXPO: 0, roll_pitch_rate: 0, yaw_rate: 0, dynamic_THR_PID: 0, throttle_MID: 0, throttle_EXPO: 0, } var AUX_CONFIG = new Array(); var AUX_CONFIG_values = new Array(); var SENSOR_DATA = { gyroscope: [0, 0, 0], accelerometer: [0, 0, 0], magnetometer: [0, 0, 0], altitude: 0, kinematicsX: 0.0, kinematicsY: 0.0, kinematicsZ: 0.0 } var MOTOR_DATA = new Array(8); var SERVO_DATA = new Array(8); var GPS_DATA = { fix: 0, numSat: 0, lat: 0, lon: 0, alt: 0, speed: 0, distanceToHome: 0, ditectionToHome: 0, update: 0 } var BATTERY = { voltage: 0, pMeterSum: 0, } var CLI_active = false; $(document).ready(function() { port_picker = $('div#port-picker .port select'); baud_picker = $('div#port-picker #baud'); delay_picker = $('div#port-picker #delay'); $('div#port-picker a.refresh').click(function() { console.log("Available port list requested."); port_picker.html(''); chrome.serial.getPorts(function(ports) { if (ports.length > 0) { // Port list received ports.forEach(function(port) { $(port_picker).append($("