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);
}
// UI hooks
var buffering_set_motor = [],
buffer_delay = false;
$('div.sliders input:not(.master)').on('input', function () {
if(self.allowTestMode){
// UI hooks
var buffering_set_motor = [],
buffer_delay = false;
$('div.sliders input:not(.master)').on('input', function () {
var index = $(this).index(),
buffer = [],
i;
var index = $(this).index(),
buffer = [],
i;
$('div.values li').eq(index).text($(this).val());
$('div.values li').eq(index).text($(this).val());
for (i = 0; i < 8; i++) {
var val = parseInt($('div.sliders input').eq(i).val());
for (i = 0; i < 8; i++) {
var val = parseInt($('div.sliders input').eq(i).val());
buffer.push(lowByte(val));
buffer.push(highByte(val));
}
buffer.push(lowByte(val));
buffer.push(highByte(val));
}
buffering_set_motor.push(buffer);
buffering_set_motor.push(buffer);
if (!buffer_delay) {
buffer_delay = setTimeout(function () {
buffer = buffering_set_motor.pop();
if (!buffer_delay) {
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 = [];
buffer_delay = false;
}, 10);
}
});
buffering_set_motor = [];
buffer_delay = false;
}, 10);
}
});
}
$('div.sliders input.master').on('input', function () {
var val = $(this).val();
@ -385,8 +387,7 @@ TABS.motors.initialize = function (callback) {
$('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;
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) {
motors_running = true;
break;
@ -408,7 +409,7 @@ TABS.motors.initialize = function (callback) {
}
if (motors_running) {
if (!self.armed) {
if (!self.armed && self.allowTestMode) {
$('#motorsEnableTestMode').prop('checked', true);
}
// motors are running adjust sliders to current values