validation

10.3.x-maintenance
cTn 2013-12-12 17:10:10 +01:00
parent e7a02d0e21
commit fd62b8568c
8 changed files with 38 additions and 28 deletions

View File

@ -50,7 +50,7 @@ function configuration_backup() {
AUX_val: AUX_CONFIG_values,
RC: RC_tuning,
AccelTrim: CONFIG.accelerometerTrims
}
};
// crunch the config object
var serialized_config_object = JSON.stringify(configuration);

View File

@ -49,7 +49,7 @@ var MSP_codes = {
MSP_ACC_TRIM: 240, // get acc angle trim values
MSP_SET_ACC_TRIM: 239, // set acc angle trim values
MSP_GPSSVINFO: 164 // get Signal Strength (only U-Blox)
}
};
var char_counter = 0;
@ -154,13 +154,16 @@ function MSP_char_read(readInfo) {
}
function send_message(code, data, callback_sent, callback_msp) {
var bufferOut;
var bufView;
// always reserve 6 bytes for protocol overhead !
if (typeof data === 'object') {
var size = data.length + 6;
var checksum = 0;
var bufferOut = new ArrayBuffer(size);
var bufView = new Uint8Array(bufferOut);
bufferOut = new ArrayBuffer(size);
bufView = new Uint8Array(bufferOut);
bufView[0] = 36; // $
bufView[1] = 77; // M
@ -178,8 +181,8 @@ function send_message(code, data, callback_sent, callback_msp) {
bufView[5 + data.length] = checksum;
} else {
var bufferOut = new ArrayBuffer(7);
var bufView = new Uint8Array(bufferOut);
bufferOut = new ArrayBuffer(7);
bufView = new Uint8Array(bufferOut);
bufView[0] = 36; // $
bufView[1] = 77; // M

View File

@ -15,7 +15,7 @@ var CONFIG = {
uid: [0, 0, 0],
accelerometerTrims: [0, 0]
}
};
var PIDs = new Array(10);
for (var i = 0; i < 10; i++) {
@ -31,7 +31,7 @@ var RC = {
AUX2: 0,
AUX3: 0,
AUX4: 0
}
};
var RC_tuning = {
RC_RATE: 0,
@ -41,7 +41,7 @@ var RC_tuning = {
dynamic_THR_PID: 0,
throttle_MID: 0,
throttle_EXPO: 0,
}
};
var AUX_CONFIG = new Array();
var AUX_CONFIG_values = new Array();
@ -57,7 +57,7 @@ var SENSOR_DATA = {
kinematicsY: 0.0,
kinematicsZ: 0.0,
debug: [0, 0, 0, 0]
}
};
var MOTOR_DATA = new Array(8);
var SERVO_DATA = new Array(8);
@ -79,12 +79,12 @@ var GPS_DATA = {
svid: new Array(),
quality: new Array(),
cno: new Array()
}
};
var BATTERY = {
voltage: 0,
pMeterSum: 0,
}
};
var CLI_active = false;
@ -369,7 +369,7 @@ function lowByte(num) {
}
function bit_check(num, bit) {
return ((num >> bit) % 2 != 0)
return ((num >> bit) % 2 != 0);
}
function bit_set(num, bit) {

View File

@ -63,19 +63,21 @@ STM32_protocol.prototype.connect = function(hex) {
// get fastest supported bitrate for current platform
// (serial API for windows support baud > 256000 from chrome v 33+)
// recommended windows - 921600, rest - 576000, default - 115200
var flashing_bitrate;
switch (GUI.operating_system) {
case 'Windows':
var flashing_bitrate = 256000;
flashing_bitrate = 256000;
break;
case 'MacOS':
case 'ChromeOS':
case 'Linux':
case 'UNIX':
var flashing_bitrate = 230400;
flashing_bitrate = 230400;
break;
default:
var flashing_bitrate = 115200;
flashing_bitrate = 115200;
}
if (!$('input.updating').is(':checked')) {
@ -432,10 +434,12 @@ STM32_protocol.prototype.upload_procedure = function(step) {
case 5:
// upload
if (self.bytes_flashed < self.hex.data.length) {
var data_length;
if ((self.bytes_flashed + 256) <= self.hex.data.length) {
var data_length = 256;
data_length = 256;
} else {
var data_length = self.hex.data.length - self.bytes_flashed;
data_length = self.hex.data.length - self.bytes_flashed;
}
console.log('STM32 - Writing to: 0x' + self.flashing_memory_address.toString(16) + ', ' + data_length + ' bytes');
@ -487,10 +491,12 @@ STM32_protocol.prototype.upload_procedure = function(step) {
case 6:
// verify
if (self.bytes_verified < self.hex.data.length) {
var data_length;
if ((self.bytes_verified + 256) <= self.hex.data.length) {
var data_length = 256;
data_length = 256;
} else {
var data_length = self.hex.data.length - self.bytes_verified;
data_length = self.hex.data.length - self.bytes_verified;
}
console.log('STM32 - Reading from: 0x' + self.verify_memory_address.toString(16) + ', ' + data_length + ' bytes');

View File

@ -16,7 +16,7 @@ CliHistory.prototype = {
if (this.index < this.history.length) this.index += 1;
return this.history[this.index - 1];
}
}
};
cli_history = new CliHistory();

View File

@ -14,7 +14,7 @@ function tab_initialize_gps () {
// Update GPS Signal Strengths
var e_ss_table = $('div.GPS_signal_strength table tr:not(.titles)')
var e_ss_table = $('div.GPS_signal_strength table tr:not(.titles)');
for (var i = 0; i < GPS_DATA.chn.length; i++) {
var row = e_ss_table.eq(i);

View File

@ -73,7 +73,7 @@ function tab_initialize_sensors() {
position: "we",
backgroundOpacity: 0
}
}
};
accel_options = {
title: "Accelerometer (g)",
@ -93,7 +93,7 @@ function tab_initialize_sensors() {
position: "we",
backgroundOpacity: 0
}
}
};
mag_options = {
title: "Magnetometer (Ga)",
@ -111,7 +111,7 @@ function tab_initialize_sensors() {
position: "we",
backgroundOpacity: 0
}
}
};
baro_options = {
title: "Barometer (meters)",
@ -129,7 +129,7 @@ function tab_initialize_sensors() {
position: "we",
backgroundOpacity: 0
}
}
};
debug1_options = {
title: "Debug1",
@ -147,7 +147,8 @@ function tab_initialize_sensors() {
position: "we",
backgroundOpacity: 0
}
}
};
debug2_options = {};
for (var key in debug1_options) debug2_options[key] = debug1_options[key];
debug2_options.title = "Debug2";

View File

@ -117,4 +117,4 @@ onmessage = function(event) {
// terminate worker
close();
}
};