mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-19 14:25:13 +03:00
hardware roundtrip
This commit is contained in:
parent
019fb3e851
commit
e76612a4cc
5 changed files with 25 additions and 33 deletions
|
@ -38,10 +38,11 @@ helper.mspQueue = (function (serial, MSP) {
|
|||
var publicScope = {},
|
||||
privateScope = {};
|
||||
|
||||
privateScope.handlerFrequency = 200;
|
||||
privateScope.handlerFrequency = 100;
|
||||
|
||||
privateScope.loadAverage = new walkingAverageClass(privateScope.handlerFrequency);
|
||||
privateScope.roundtripAverage = new walkingAverageClass(50);
|
||||
privateScope.hardwareRoundtripAverage = new walkingAverageClass(50);
|
||||
|
||||
privateScope.queue = [];
|
||||
|
||||
|
@ -91,6 +92,10 @@ helper.mspQueue = (function (serial, MSP) {
|
|||
publicScope.put(request);
|
||||
}, serial.getTimeout());
|
||||
|
||||
if (request.sentOn === null) {
|
||||
request.sentOn = new Date().getTime();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set receive callback here
|
||||
*/
|
||||
|
@ -153,6 +158,18 @@ helper.mspQueue = (function (serial, MSP) {
|
|||
privateScope.roundtripAverage.put(number);
|
||||
};
|
||||
|
||||
publicScope.getHardwareRoundtrip = function () {
|
||||
return privateScope.hardwareRoundtripAverage.getAverage();
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} number
|
||||
*/
|
||||
publicScope.putHardwareRoundtrip = function (number) {
|
||||
privateScope.hardwareRoundtripAverage.put(number);
|
||||
};
|
||||
|
||||
setInterval(publicScope.executor, Math.round(1000 / privateScope.handlerFrequency));
|
||||
|
||||
return publicScope;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue