no modifications to motor values in 3d mode if msp 3d isn't supported

10.3.x-maintenance
NightHawk32 2016-01-12 17:18:34 -05:00
parent e8cc7751af
commit da4f916f10
1 changed files with 29 additions and 28 deletions

View File

@ -328,37 +328,39 @@ TABS.motors.initialize = function (callback) {
$('div.sliders input').val(MISC.mincommand); $('div.sliders input').val(MISC.mincommand);
} }
// UI hooks if(self.allowTestMode){
var buffering_set_motor = [], // UI hooks
buffer_delay = false; var buffering_set_motor = [],
$('div.sliders input:not(.master)').on('input', function () { buffer_delay = false;
$('div.sliders input:not(.master)').on('input', function () {
var index = $(this).index(), var index = $(this).index(),
buffer = [], buffer = [],
i; i;
$('div.values li').eq(index).text($(this).val()); $('div.values li').eq(index).text($(this).val());
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
var val = parseInt($('div.sliders input').eq(i).val()); var val = parseInt($('div.sliders input').eq(i).val());
buffer.push(lowByte(val)); buffer.push(lowByte(val));
buffer.push(highByte(val)); buffer.push(highByte(val));
} }
buffering_set_motor.push(buffer);
buffering_set_motor.push(buffer); if (!buffer_delay) {
buffer_delay = setTimeout(function () {
if (!buffer_delay) { buffer = buffering_set_motor.pop();
buffer_delay = setTimeout(function () {
buffer = buffering_set_motor.pop();
MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer); MSP.send_message(MSP_codes.MSP_SET_MOTOR, buffer);
buffering_set_motor = []; buffering_set_motor = [];
buffer_delay = false; buffer_delay = false;
}, 10); }, 10);
} }
}); });
}
$('div.sliders input.master').on('input', function () { $('div.sliders input.master').on('input', function () {
var val = $(this).val(); var val = $(this).val();
@ -385,8 +387,7 @@ TABS.motors.initialize = function (callback) {
$('div.sliders input').val(MISC.mincommand); $('div.sliders input').val(MISC.mincommand);
} }
// trigger change event so values are sent to mcu $('div.sliders input').trigger('input');
$('div.sliders input').trigger('input');
} }
}); });
@ -394,7 +395,7 @@ TABS.motors.initialize = function (callback) {
var motors_running = false; var motors_running = false;
for (var i = 0; i < number_of_valid_outputs; i++) { for (var i = 0; i < number_of_valid_outputs; i++) {
if( ! bit_check(BF_CONFIG.features,12) ){ if( !self.feature3DEnabled ){
if (MOTOR_DATA[i] > MISC.mincommand) { if (MOTOR_DATA[i] > MISC.mincommand) {
motors_running = true; motors_running = true;
break; break;
@ -408,7 +409,7 @@ TABS.motors.initialize = function (callback) {
} }
if (motors_running) { if (motors_running) {
if (!self.armed) { if (!self.armed && self.allowTestMode) {
$('#motorsEnableTestMode').prop('checked', true); $('#motorsEnableTestMode').prop('checked', true);
} }
// motors are running adjust sliders to current values // motors are running adjust sliders to current values