Further simplification of the new code

10.3.x-maintenance
Dominik Derigs 2016-01-18 08:45:19 +01:00
parent ed735556df
commit f60f599fb9
1 changed files with 3 additions and 12 deletions

View File

@ -271,18 +271,9 @@ TABS.motors.initialize = function (callback) {
// This is particularly useful for motor balancing as it // This is particularly useful for motor balancing as it
// eliminates the need for external tools // eliminates the need for external tools
var sum = 0.0; var sum = 0.0;
for (var k = 0; k < accel_data[0].length; k++) for (var j = 0; j < accel_data.length; j++)
{ for (var k = 0; k < accel_data[0].length; k++)
sum += accel_data[0][k][1]*accel_data[0][k][1]; sum += accel_data[j][k][1]*accel_data[j][k][1];
}
for (var k = 0; k < accel_data[1].length; k++)
{
sum += accel_data[1][k][1]*accel_data[1][k][1];
}
for (var k = 0; k < accel_data[2].length; k++)
{
sum += accel_data[2][k][1]*accel_data[2][k][1];
}
var rms = Math.sqrt(sum/(accel_data[0].length+accel_data[1].length+accel_data[2].length)); var rms = Math.sqrt(sum/(accel_data[0].length+accel_data[1].length+accel_data[2].length));
raw_data_text_ements.x[0].text(accel_with_offset[0].toFixed(2) + ' (' + accel_max_read[0].toFixed(2) + ')'); raw_data_text_ements.x[0].text(accel_with_offset[0].toFixed(2) + ' (' + accel_max_read[0].toFixed(2) + ')');