Don't send NodeInfo and DeviceTelemetry at high Tx air util

Also move airtime checking to airtime class
This commit is contained in:
GUVWAF
2023-01-11 21:52:19 +01:00
parent d7a71e46aa
commit fc775012ea
9 changed files with 43 additions and 21 deletions

View File

@@ -21,7 +21,7 @@ int32_t StoreForwardModule::runOnce()
// Send out the message queue.
if (this->busy) {
// Only send packets if the channel is less than 25% utilized.
if (airTime->channelUtilizationPercent() < polite_channel_util_percent) {
if (airTime->isTxAllowedChannelUtil(true)) {
storeForwardModule->sendPayload(this->busyTo, this->packetHistoryTXQueue_index);
if (this->packetHistoryTXQueue_index == packetHistoryTXQueue_size) {
// Tell the client we're done sending
@@ -34,12 +34,10 @@ int32_t StoreForwardModule::runOnce()
} else {
this->packetHistoryTXQueue_index++;
}
} else {
LOG_WARN("*** Channel utilization is too high. Retrying later.\n");
}
LOG_DEBUG("*** SF bitrate = %f bytes / sec\n", myNodeInfo.bitrate);
} else if ((millis() - lastHeartbeat > (heartbeatInterval * 1000)) && (airTime->channelUtilizationPercent() < polite_channel_util_percent)) {
} else if ((millis() - lastHeartbeat > (heartbeatInterval * 1000)) && airTime->isTxAllowedChannelUtil(true)) {
lastHeartbeat = millis();
LOG_INFO("*** Sending heartbeat\n");
StoreAndForward sf = StoreAndForward_init_zero;