Skip to content

Commit

Permalink
Increase debug print of network consumers
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed Dec 5, 2024
1 parent 855605c commit 0a0fa77
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
59 changes: 52 additions & 7 deletions Firmware/RTK_Everywhere/Network.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1414,49 +1414,94 @@ uint8_t networkConsumers()
{
uint8_t consumerCount = 0;

uint16_t consumerType = 0;

// Rover + NTRIP Client
if (inRoverMode() == true && settings.enableNtripClient == true)
{
consumerCount++;
consumerType |= (1 << 0);
}

// Base + NTRIP Server
if (inBaseMode() == true && settings.enableNtripServer == true)
{
consumerCount++;
consumerType |= (1 << 1);
}

// TCP Client
if (settings.enableTcpClient == true)
{
consumerCount++;
consumerType |= (1 << 2);
}

// TCP Server
if (settings.enableTcpServer == true)
{
consumerCount++;
consumerType |= (1 << 3);
}

// UDP Server
if (settings.enableUdpServer == true)
{
consumerCount++;
consumerType |= (1 << 4);
}

// PointPerfect ZTP or get keys
if (settings.requestKeyUpdate == true)
{
consumerCount++;
consumerType |= (1 << 5);
}

// PointPerfect Corrections enabled with a non-zero length key
if (settings.enablePointPerfectCorrections == true && strlen(settings.pointPerfectCurrentKey) > 0)
{
// Check if keys are expired
int daysRemaining = daysFromEpoch(settings.pointPerfectNextKeyStart + settings.pointPerfectNextKeyDuration + 1);
if (daysRemaining > 0)
consumerCount++;
if (online.rtc)
{
// Check if keys need updating
int daysRemaining =
daysFromEpoch(settings.pointPerfectNextKeyStart + settings.pointPerfectNextKeyDuration + 1);
if (daysRemaining < 28)
{
consumerCount++;
consumerType |= (1 << 6);
if (settings.debugNetworkLayer)
systemPrintf("Network consumer daysRemaining: %d\r\n", daysRemaining);
}
}
}

//OTA
// OTA

if (settings.debugNetworkLayer)
{
static unsigned long lastPrint = millis();
static unsigned long lastPrint = 0;

if (millis() - lastPrint > 2000)
{
lastPrint = millis();
systemPrintf("Network consumer count: %d\r\n", consumerCount);
systemPrintf("Network consumer count: %d - Consumers: ", consumerCount);

if (consumerType & (1 << 0))
systemPrint("Rover NTRIP Client, ");
if (consumerType & (1 << 1))
systemPrint("Base NTRIP Server, ");
if (consumerType & (1 << 2))
systemPrint("TCP Client, ");
if (consumerType & (1 << 3))
systemPrint("TCP Server, ");
if (consumerType & (1 << 4))
systemPrint("UDP Server, ");
if (consumerType & (1 << 5))
systemPrint("PPL Key request, ");
if (consumerType & (1 << 6))
systemPrint("PPL Key update, ");
systemPrintln();
}
}

Expand Down
1 change: 1 addition & 0 deletions Firmware/RTK_Everywhere/menuPP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ void updateProvisioning()
{
httpClientModeNeeded = false; // Tell HTTP_Client to give up
recordSystemSettings(); // Make sure the new cert and keys are recorded
systemPrintln("Keys successfully updated!");
provisioningSetState(PROVISIONING_KEYS_REMAINING);
}
else if (ztpResponse == ZTP_DEACTIVATED)
Expand Down

0 comments on commit 0a0fa77

Please sign in to comment.