1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 16:25:19 +03:00

adaptive intervals

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-01-25 21:13:58 +01:00
parent dc40b96238
commit 37738ac269
12 changed files with 87 additions and 9 deletions

View file

@ -249,14 +249,14 @@ helper.mspQueue = (function (serial, MSP) {
};
/**
* This method return periodic for polling interval that should populate queue in 75% or less
* This method return periodic for polling interval that should populate queue in 80% or less
* @param {number} requestedInterval
* @param {number} messagesInInterval
* @returns {number}
*/
publicScope.getIntervalPrediction = function (requestedInterval, messagesInInterval) {
var requestedRate = (1000 / requestedInterval) * messagesInInterval,
availableRate = (1000 / publicScope.getRoundtrip()) * 0.75;
availableRate = (1000 / publicScope.getRoundtrip()) * 0.8;
if (requestedRate < availableRate) {
return requestedInterval;