1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-19 14:25:13 +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, bufView,
i; i;
/*
* For debug reasons, check how ofter MSP frames are executed
*/
helper.eventFrequencyAnalyzer.put(code);
// always reserve 6 bytes for protocol overhead ! // always reserve 6 bytes for protocol overhead !
if (data) { if (data) {
var size = data.length + 6, var size = data.length + 6,

View file

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

View file

@ -14,6 +14,12 @@ TABS.cli.initialize = function (callback) {
googleAnalytics.sendAppView('CLI'); 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 () { $('#content').load("./tabs/cli.html", function () {
// translate to user-selected language // translate to user-selected language
localize(); localize();