From b09620b6aee3f5b2c71cea6312190d8968c8c3dd Mon Sep 17 00:00:00 2001 From: cTn Date: Sat, 7 Jun 2014 17:54:51 +0200 Subject: [PATCH] remove obsolete needle, cleanup --- js/data_storage.js | 14 +++++++------- js/msp.js | 6 ++---- tabs/auxiliary_configuration.js | 10 ++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/js/data_storage.js b/js/data_storage.js index 3af5498a..00c2c4d2 100644 --- a/js/data_storage.js +++ b/js/data_storage.js @@ -38,10 +38,10 @@ var RC_tuning = { throttle_EXPO: 0, }; -var AUX_CONFIG = new Array(); -var AUX_CONFIG_values = new Array(); +var AUX_CONFIG = []; +var AUX_CONFIG_values = []; -var SERVO_CONFIG = new Array(); +var SERVO_CONFIG = []; var SENSOR_DATA = { gyroscope: [0, 0, 0], @@ -70,10 +70,10 @@ var GPS_DATA = { update: 0, // baseflight specific gps stuff - chn: new Array(), - svid: new Array(), - quality: new Array(), - cno: new Array() + chn: [], + svid: [], + quality: [], + cno: [] }; var ANALOG = { diff --git a/js/msp.js b/js/msp.js index fea1fdc6..fb60af29 100644 --- a/js/msp.js +++ b/js/msp.js @@ -283,8 +283,7 @@ MSP.process_data = function(code, message_buffer, message_length) { } break; case MSP_codes.MSP_BOX: - // dump previous data (if there was any) - AUX_CONFIG_values = new Array(); + AUX_CONFIG_values = []; // empty the array as new data is coming in // fill in current data for (var i = 0; i < data.byteLength; i += 2) { // + 2 because uint16_t = 2 bytes @@ -345,8 +344,7 @@ MSP.process_data = function(code, message_buffer, message_length) { console.log(data); break; case MSP_codes.MSP_SERVO_CONF: - // drop previous data - SERVO_CONFIG = []; + SERVO_CONFIG = []; // empty the array as new data is coming in for (var i = 0; i < 56; i += 7) { var arr = { diff --git a/tabs/auxiliary_configuration.js b/tabs/auxiliary_configuration.js index c7ed1adb..4d648a60 100644 --- a/tabs/auxiliary_configuration.js +++ b/tabs/auxiliary_configuration.js @@ -74,13 +74,11 @@ function tab_initialize_auxiliary_configuration() { } }); - // send over the data - var AUX_val_buffer_out = new Array(); - - var needle = 0; + // send over data + var AUX_val_buffer_out = []; for (var i = 0; i < AUX_CONFIG_values.length; i++) { - AUX_val_buffer_out[needle++] = lowByte(AUX_CONFIG_values[i]); - AUX_val_buffer_out[needle++] = highByte(AUX_CONFIG_values[i]); + AUX_val_buffer_out.push(lowByte(AUX_CONFIG_values[i])); + AUX_val_buffer_out.push(highByte(AUX_CONFIG_values[i])); } MSP.send_message(MSP_codes.MSP_SET_BOX, AUX_val_buffer_out, false, save_to_eeprom);