mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-22 07:45:16 +03:00
flush msp queue on disconnect
This commit is contained in:
parent
72d85ad354
commit
ce3678950d
2 changed files with 18 additions and 7 deletions
|
@ -104,12 +104,16 @@ $(document).ready(function () {
|
||||||
helper.interval.killAll(['global_data_refresh']);
|
helper.interval.killAll(['global_data_refresh']);
|
||||||
GUI.tab_switch_cleanup();
|
GUI.tab_switch_cleanup();
|
||||||
GUI.tab_switch_in_progress = false;
|
GUI.tab_switch_in_progress = false;
|
||||||
|
CONFIGURATOR.connectionValid = false;
|
||||||
|
GUI.connected_to = false;
|
||||||
|
GUI.allowedTabs = GUI.defaultAllowedTabsWhenDisconnected.slice();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flush
|
||||||
|
*/
|
||||||
|
helper.mspQueue.flush();
|
||||||
|
|
||||||
serial.disconnect(onClosed);
|
serial.disconnect(onClosed);
|
||||||
|
|
||||||
GUI.connected_to = false;
|
|
||||||
CONFIGURATOR.connectionValid = false;
|
|
||||||
GUI.allowedTabs = GUI.defaultAllowedTabsWhenDisconnected.slice();
|
|
||||||
MSP.disconnect_cleanup();
|
MSP.disconnect_cleanup();
|
||||||
PortUsage.reset();
|
PortUsage.reset();
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,10 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
*/
|
*/
|
||||||
publicScope.executor = function () {
|
publicScope.executor = function () {
|
||||||
|
|
||||||
if (privateScope.portInUse) {
|
/*
|
||||||
|
* if port is blocked or there is no connection, do not process the queue
|
||||||
|
*/
|
||||||
|
if (privateScope.portInUse || !CONFIGURATOR.connectionValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,13 +40,13 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
*/
|
*/
|
||||||
privateScope.portInUse = true;
|
privateScope.portInUse = true;
|
||||||
|
|
||||||
|
//TODO implement timeout scenario
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set receive callback here
|
* Set receive callback here
|
||||||
*/
|
*/
|
||||||
MSP.putCallback(request);
|
MSP.putCallback(request);
|
||||||
|
|
||||||
//TODO implement timeout scenario
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send data to serial port
|
* Send data to serial port
|
||||||
*/
|
*/
|
||||||
|
@ -65,6 +68,10 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
return privateScope.queue.shift();
|
return privateScope.queue.shift();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
publicScope.flush = function () {
|
||||||
|
privateScope.queue = [];
|
||||||
|
};
|
||||||
|
|
||||||
publicScope.freeSerialPort = function () {
|
publicScope.freeSerialPort = function () {
|
||||||
privateScope.portInUse = false;
|
privateScope.portInUse = false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue