Telemetry phone api guard (#1805)

* Delay start of telemetry modules

* Don't send unless our toPhoneQueue is empty

* Get wrecked, checks!
This commit is contained in:
Ben Meadors
2022-10-16 09:58:58 -05:00
committed by GitHub
parent 44529620ad
commit 45f9dee89a
6 changed files with 15 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
#include "main.h"
#include <OLEDDisplay.h>
#include <OLEDDisplayUi.h>
#include "MeshService.h"
int32_t DeviceTelemetryModule::runOnce()
{
@@ -18,8 +19,9 @@ int32_t DeviceTelemetryModule::runOnce()
&& airTime->channelUtilizationPercent() < max_channel_util_percent) {
sendTelemetry();
lastSentToMesh = now;
} else {
} else if (service.isToPhoneQueueEmpty()) {
// Just send to phone when it's not our time to send to mesh yet
// Only send while queue is empty (phone assumed connected)
sendTelemetry(NODENUM_BROADCAST, true);
}
return sendToPhoneIntervalMs;