1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 06:15:13 +03:00

only enforce mincommand if necessary

This commit is contained in:
cTn 2014-03-06 18:52:18 +01:00
parent e83b29cfde
commit 96d2bdbb12

View file

@ -216,6 +216,18 @@ GUI_control.prototype.tab_switch_cleanup = function(callback) {
case 'motor_outputs': case 'motor_outputs':
GUI.interval_remove('motor_poll'); GUI.interval_remove('motor_poll');
// only enforce mincommand if necessary
if (MOTOR_DATA != undefined) {
var update = false;
for (var i = 0; i < MOTOR_DATA.length; i++) {
if (MOTOR_DATA[i] > MISC.mincommand) {
update = true;
break;
}
}
if (update) {
// send data to mcu // send data to mcu
var buffer_out = []; var buffer_out = [];
@ -227,6 +239,12 @@ GUI_control.prototype.tab_switch_cleanup = function(callback) {
send_message(MSP_codes.MSP_SET_MOTOR, buffer_out, false, function() { send_message(MSP_codes.MSP_SET_MOTOR, buffer_out, false, function() {
if (callback) callback(); if (callback) callback();
}); });
} else {
if (callback) callback();
}
} else {
if (callback) callback();
}
break; break;
case 'sensors': case 'sensors':
GUI.interval_kill_all(['port_usage']); GUI.interval_kill_all(['port_usage']);