mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 16:55:24 +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
|
||||
}
|
||||
}, function(createdWindow) {
|
||||
// Give the window a callback it can use to access our MSP object to send to CF
|
||||
createdWindow.contentWindow.setRawRx = MSP.setRawRx;
|
||||
// Give the window a callback it can use to send the channels (otherwise it can't see those objects)
|
||||
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:
|
||||
window.setRawRx(channelValues);
|
||||
if (!window.setRawRx(channelValues)) {
|
||||
// MSP connection has gone away
|
||||
chrome.app.window.current().close();
|
||||
}
|
||||
}
|
||||
|
||||
function stickPortionToChannelValue(portion) {
|
||||
|
@ -178,5 +181,5 @@ $(document).ready(function() {
|
|||
|
||||
updateControlPositions();
|
||||
|
||||
setInterval(transmitChannels, 100);
|
||||
setInterval(transmitChannels, 50);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue