1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-16 21:05:28 +03:00

timeout and retry improvements

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-01-21 22:50:29 +01:00
parent daf06fa466
commit 4ae45333a8
3 changed files with 22 additions and 7 deletions

View file

@ -156,11 +156,6 @@ var MSP = {
bufView,
i;
/*
* For debug reasons, check how ofter MSP frames are executed
*/
helper.eventFrequencyAnalyzer.put(code);
// always reserve 6 bytes for protocol overhead !
if (data) {
var size = data.length + 6,

View file

@ -56,12 +56,18 @@ helper.mspQueue = (function (serial, MSP) {
*/
publicScope.executor = function () {
/*
* Debug
*/
helper.eventFrequencyAnalyzer.put("execute");
privateScope.loadFilter.apply(privateScope.queue.length);
/*
* if port is blocked or there is no connection, do not process the queue
*/
if (privateScope.portInUse || serial.connectionId === false) {
helper.eventFrequencyAnalyzer.put("port in use");
return false;
}
@ -81,10 +87,18 @@ helper.mspQueue = (function (serial, MSP) {
*/
MSP.removeCallback(request.code);
/*
* To prevent infinite retry situation, allow retry only while counter is positive
*/
if (request.retryCounter > 0) {
request.retryCounter--;
/*
* Create new entry in the queue
*/
publicScope.put(request);
}
}, serial.getTimeout());
if (request.sentOn === null) {

View file

@ -14,6 +14,12 @@ TABS.cli.initialize = function (callback) {
googleAnalytics.sendAppView('CLI');
}
/*
* Flush MSP queue as well as all MSP registered callbacks
*/
helper.mspQueue.flush();
MSP.callbacks_cleanup();
$('#content').load("./tabs/cli.html", function () {
// translate to user-selected language
localize();