mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-01 11:42:45 +00:00
Merge pull request #1147 from mc-hamster/master
rangeTestPlugin - only send if channelUtilization is less than 25%
This commit is contained in:
commit
d26549c7c2
@ -4,6 +4,7 @@
|
|||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
#include "Router.h"
|
#include "Router.h"
|
||||||
|
#include "airtime.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "gps/GeoCoord.h"
|
#include "gps/GeoCoord.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
@ -73,7 +74,13 @@ int32_t RangeTestPlugin::runOnce()
|
|||||||
DEBUG_MSG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
|
DEBUG_MSG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
|
||||||
DEBUG_MSG("pref.fixed_position() %d\n", radioConfig.preferences.fixed_position);
|
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);
|
return (senderHeartbeat);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we're a receiver.
|
// 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()) {
|
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,
|
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
|
fileToAppend.printf("%f,", distance); // Distance in meters
|
||||||
} else {
|
} else {
|
||||||
fileToAppend.printf("0,");
|
fileToAppend.printf("0,");
|
||||||
|
Loading…
Reference in New Issue
Block a user