1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-19 14:25:13 +03:00

utilizing tab_switch_cleanup functionality

This commit is contained in:
cTn 2013-11-09 06:14:21 +01:00
parent 36604ca724
commit 0f23b5f5d9
4 changed files with 65 additions and 54 deletions

View file

@ -124,6 +124,27 @@ GUI_control.prototype.timeout_kill_all = function() {
GUI_control.prototype.tab_switch_cleanup = function(callback) {
switch (this.active_tab) {
case 'cli':
var bufferOut = new ArrayBuffer(5);
var bufView = new Uint8Array(bufferOut);
bufView[0] = 0x65; // e
bufView[1] = 0x78; // x
bufView[2] = 0x69; // i
bufView[3] = 0x74; // t
bufView[4] = 0x0D; // enter
chrome.serial.write(connectionId, bufferOut, function(writeInfo) {
if (callback) {
// we could handle this "nicely", but this will do for now
// (another approach is however much more complicated):
// we can setup an interval asking for data lets say every 200ms, when data arrives, callback will be triggered and tab switched
// we could probably implement this someday
GUI.timeout_add('waiting_for_bootup', function() {
CLI_active = false;
callback();
}, 3000);
}
});
break;
default:
if (callback) {