1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 16:55:22 +03:00

Merge pull request #2048 from iNavFlight/dzikuvx-mps-queue-improvements

MSP Queue handling improvements
This commit is contained in:
Paweł Spychalski 2024-04-27 22:21:43 +02:00 committed by GitHub
commit 04f4b925d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 183 additions and 438 deletions

View file

@ -18,6 +18,8 @@ const ProgrammingPid = require('./../programmingPid');
const Safehome = require('./../safehome');
const { FwApproach } = require('./../fwApproach');
const Waypoint = require('./../waypoint');
const mspDeduplicationQueue = require('./mspDeduplicationQueue');
const mspStatistics = require('./mspStatistics');
var mspHelper = (function () {
var self = {};
@ -1618,9 +1620,17 @@ var mspHelper = (function () {
*/
if (dataHandler.callbacks[i]) {
mspQueue.putRoundtrip(new Date().getTime() - dataHandler.callbacks[i].createdOn);
mspQueue.putHardwareRoundtrip(new Date().getTime() - dataHandler.callbacks[i].sentOn);
const hardwareRountrip = new Date().getTime() - dataHandler.callbacks[i].sentOn;
mspQueue.putHardwareRoundtrip(hardwareRountrip);
mspStatistics.add(dataHandler.code, hardwareRountrip);
}
//remove message from queue as received
mspDeduplicationQueue.remove(dataHandler.code);
// remove object from array
dataHandler.callbacks.splice(i, 1);
@ -3065,6 +3075,7 @@ var mspHelper = (function () {
};
self._getSetting = function (name) {
console.log("Getting setting " + name);
if (FC.SETTINGS[name]) {
return Promise.resolve(FC.SETTINGS[name]);
}