mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
Have the command sticks disappear when disconnecting or switch to CLI
This commit is contained in:
parent
ef0c637877
commit
b7921de528
2 changed files with 14 additions and 4 deletions
|
@ -326,8 +326,15 @@ TABS.receiver.initialize = function (callback) {
|
||||||
maxWidth: windowWidth, maxHeight: windowHeight
|
maxWidth: windowWidth, maxHeight: windowHeight
|
||||||
}
|
}
|
||||||
}, function(createdWindow) {
|
}, function(createdWindow) {
|
||||||
// Give the window a callback it can use to access our MSP object to send to CF
|
// Give the window a callback it can use to send the channels (otherwise it can't see those objects)
|
||||||
createdWindow.contentWindow.setRawRx = MSP.setRawRx;
|
createdWindow.contentWindow.setRawRx = function(channels) {
|
||||||
|
if (CONFIGURATOR.connectionValid && GUI.active_tab != 'cli') {
|
||||||
|
MSP.setRawRx(channels);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,10 @@ function transmitChannels() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback given to us by the window creator so we can have it send data over MSP for us:
|
// Callback given to us by the window creator so we can have it send data over MSP for us:
|
||||||
window.setRawRx(channelValues);
|
if (!window.setRawRx(channelValues)) {
|
||||||
|
// MSP connection has gone away
|
||||||
|
chrome.app.window.current().close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stickPortionToChannelValue(portion) {
|
function stickPortionToChannelValue(portion) {
|
||||||
|
@ -178,5 +181,5 @@ $(document).ready(function() {
|
||||||
|
|
||||||
updateControlPositions();
|
updateControlPositions();
|
||||||
|
|
||||||
setInterval(transmitChannels, 100);
|
setInterval(transmitChannels, 50);
|
||||||
});
|
});
|
Loading…
Add table
Add a link
Reference in a new issue