async approach to aux status updating

10.3.x-maintenance
cTn 2014-01-26 20:00:29 +01:00
parent 47ef16b575
commit a339b25c64
1 changed files with 21 additions and 23 deletions

View File

@ -74,34 +74,32 @@ function tab_initialize_auxiliary_configuration() {
});
// enable data pulling
GUI.interval_add('aux_data_poll', aux_data_poll, 50, true);
GUI.interval_add('aux_data_poll', function() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC, false, function() {
for (var i = 0; i < AUX_CONFIG.length; i++) {
if (bit_check(CONFIG.mode, i)) {
$('td.name').eq(i).addClass('on').removeClass('off');
} else {
$('td.name').eq(i).removeClass('on').removeClass('off');
if (AUX_CONFIG_values[i] > 0) {
$('td.name').eq(i).addClass('off');
}
}
}
box_highlight(RC.AUX1, 2);
box_highlight(RC.AUX2, 5);
box_highlight(RC.AUX3, 8);
box_highlight(RC.AUX4, 11);
});
}, 50, true);
});
});
});
}
function aux_data_poll() {
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC);
for (var i = 0; i < AUX_CONFIG.length; i++) {
if (bit_check(CONFIG.mode, i)) {
$('td.name').eq(i).addClass('on').removeClass('off');
} else {
$('td.name').eq(i).removeClass('on').removeClass('off');
if (AUX_CONFIG_values[i] > 0) {
$('td.name').eq(i).addClass('off');
}
}
}
box_highlight(RC.AUX1, 2);
box_highlight(RC.AUX2, 5);
box_highlight(RC.AUX3, 8);
box_highlight(RC.AUX4, 11);
}
function box_check(num, pos) {
if (bit_check(num, pos)) { // 1
return '<td><input type="checkbox" checked="checked" /></td>';