Merge branch 'logging_verbosity' of https://github.com/aviateur17/Farm-Data-Relay-System into logging_verbosity

pull/194/head
Jeff Lehman 3 months ago
commit d3108a9560

@ -119,7 +119,7 @@ int find_espnow_peer()
{
if (peer_list[i].last_seen == 0)
{
// DBG("Using peer entry " + String(i));
DBG1("Using peer entry " + String(i));
return i;
}
}
@ -127,7 +127,7 @@ int find_espnow_peer()
{
if ((millis() - peer_list[i].last_seen) >= PEER_TIMEOUT)
{
// DBG("Recycling peer entry " + String(i));
DBG1("Recycling peer entry " + String(i));
esp_now_del_peer(peer_list[i].mac);
return i;
@ -140,18 +140,18 @@ int find_espnow_peer()
// Returns the index of the peer list array element that contains the provided MAC address, -1 if not found
int getFDRSPeer(uint8_t *mac)
{
// DBG("Getting peer #");
DBG1("Getting peer #");
for (int i = 0; i < 16; i++)
{
if (memcmp(mac, &peer_list[i].mac, 6) == 0)
{
DBG("Peer is entry #" + String(i));
DBG1("Peer is entry #" + String(i));
return i;
}
}
// DBG("Couldn't find peer");
DBG1("Couldn't find peer");
return -1;
}
@ -162,7 +162,7 @@ void add_espnow_peer()
if (peer_num == -1) // if the device isn't registered
{
int open_peer = find_espnow_peer(); // find open spot in peer_list
DBG("New device will be registered as " + String(open_peer));
DBG1("New device will be registered as " + String(open_peer));
memcpy(&peer_list[open_peer].mac, &incMAC, 6); // save MAC to open spot
peer_list[open_peer].last_seen = millis();
#if defined(ESP32)
@ -186,7 +186,7 @@ void add_espnow_peer()
}
else
{
DBG("Refreshing existing peer registration");
DBG1("Refreshing existing peer registration");
peer_list[peer_num].last_seen = millis();
SystemPacket sys_packet = {.cmd = cmd_add, .param = PEER_TIMEOUT};

@ -120,7 +120,7 @@ void mqtt_callback(char *topic, byte *message, unsigned int length)
if (error)
{ // Test if parsing succeeds.
DBG("json parse err");
DBG(incomingString);
DBG1(incomingString);
return;
}
else

@ -35,8 +35,8 @@ void getSerial() {
JsonDocument doc;
DeserializationError error = deserializeJson(doc, incomingString);
if (error) { // Test if parsing succeeds.
// DBG("json parse err");
// DBG(incomingString);
DBG("json parse err");
DBG1(incomingString);
return;
} else {
int s = doc.size();

@ -95,7 +95,7 @@ bool refresh_registration()
#ifdef USE_ESPNOW
SystemPacket sys_packet = {.cmd = cmd_add, .param = 0};
esp_now_send(gatewayAddress, (uint8_t *)&sys_packet, sizeof(SystemPacket));
DBG("Refreshing registration to " + String(gatewayAddress[5]));
DBG1("Refreshing registration to " + String(gatewayAddress[5]));
uint32_t add_start = millis();
is_added = false;
while ((millis() - add_start) <= 1000) // 1000ms timeout
@ -103,12 +103,12 @@ bool refresh_registration()
yield();
if (is_added)
{
DBG("Registration accepted. Timeout: " + String(gtwy_timeout));
DBG1("Registration accepted. Timeout: " + String(gtwy_timeout));
last_refresh = millis();
return true;
}
}
DBG("No gateways accepted the request");
DBG1("No gateways accepted the request");
return false;
#endif // USE_ESPNOW
return true;

Loading…
Cancel
Save