Merge pull request #1147 from mc-hamster/master

rangeTestPlugin - only send if channelUtilization is less than 25%
pull/1148/head
Jm Casler 2022-01-26 22:20:35 -08:00 zatwierdzone przez GitHub
commit d26549c7c2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -4,6 +4,7 @@
#include "PowerFSM.h"
#include "RTC.h"
#include "Router.h"
#include "airtime.h"
#include "configuration.h"
#include "gps/GeoCoord.h"
#include <Arduino.h>
@ -73,7 +74,13 @@ int32_t RangeTestPlugin::runOnce()
DEBUG_MSG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
DEBUG_MSG("pref.fixed_position() %d\n", radioConfig.preferences.fixed_position);
rangeTestPluginRadio->sendPayload();
// Only send packets if the channel is less than 25% utilized.
if (airTime->channelUtilizationPercent() < 25) {
rangeTestPluginRadio->sendPayload();
} else {
DEBUG_MSG("rangeTest - Channel utilization is too high. Skipping this opportunity to send and will retry later.\n");
}
return (senderHeartbeat);
} else {
// Otherwise, we're a receiver.
@ -273,7 +280,7 @@ bool RangeTestPluginRadio::appendFile(const MeshPacket &mp)
if (n->position.latitude_i && n->position.longitude_i && gpsStatus->getLatitude() && gpsStatus->getLongitude()) {
float distance = GeoCoord::latLongToMeter(n->position.latitude_i * 1e-7, n->position.longitude_i * 1e-7,
gpsStatus->getLatitude() * 1e-7, gpsStatus->getLongitude() * 1e-7);
gpsStatus->getLatitude() * 1e-7, gpsStatus->getLongitude() * 1e-7);
fileToAppend.printf("%f,", distance); // Distance in meters
} else {
fileToAppend.printf("0,");