mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 12:55:13 +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
|
@ -24,7 +24,10 @@ helper.mspQueue = (function (serial, MSP) {
|
|||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -37,13 +40,13 @@ helper.mspQueue = (function (serial, MSP) {
|
|||
*/
|
||||
privateScope.portInUse = true;
|
||||
|
||||
//TODO implement timeout scenario
|
||||
|
||||
/*
|
||||
* Set receive callback here
|
||||
*/
|
||||
MSP.putCallback(request);
|
||||
|
||||
//TODO implement timeout scenario
|
||||
|
||||
/*
|
||||
* Send data to serial port
|
||||
*/
|
||||
|
@ -65,6 +68,10 @@ helper.mspQueue = (function (serial, MSP) {
|
|||
return privateScope.queue.shift();
|
||||
};
|
||||
|
||||
publicScope.flush = function () {
|
||||
privateScope.queue = [];
|
||||
};
|
||||
|
||||
publicScope.freeSerialPort = function () {
|
||||
privateScope.portInUse = false;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue