From cae2d6792099a784eab52d06e965b641b3c4b290 Mon Sep 17 00:00:00 2001 From: Timm Bogner <64260873+timmbogner@users.noreply.github.com> Date: Sat, 10 Feb 2024 17:14:00 -0600 Subject: [PATCH] show/hide various debugs --- src/fdrs_gateway_espnow.h | 14 +++++++------- src/fdrs_gateway_mqtt.h | 2 +- src/fdrs_gateway_serial.h | 4 ++-- src/fdrs_node_espnow.h | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/fdrs_gateway_espnow.h b/src/fdrs_gateway_espnow.h index 3c06018..1a34428 100644 --- a/src/fdrs_gateway_espnow.h +++ b/src/fdrs_gateway_espnow.h @@ -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}; diff --git a/src/fdrs_gateway_mqtt.h b/src/fdrs_gateway_mqtt.h index fa5db05..5a94f9b 100644 --- a/src/fdrs_gateway_mqtt.h +++ b/src/fdrs_gateway_mqtt.h @@ -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 diff --git a/src/fdrs_gateway_serial.h b/src/fdrs_gateway_serial.h index ef2c825..4ac0f23 100644 --- a/src/fdrs_gateway_serial.h +++ b/src/fdrs_gateway_serial.h @@ -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(); diff --git a/src/fdrs_node_espnow.h b/src/fdrs_node_espnow.h index 1cd6b9e..0e69839 100644 --- a/src/fdrs_node_espnow.h +++ b/src/fdrs_node_espnow.h @@ -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;