* Mesh/Dispatcher: MESH_DEBUG_ and MESH_PACKET_LOGGING now output date-time. (new getLogDateTime() virtual)

* MESH_PACKET_LOGGING now parity with dynamic/file logging (src/dest hashes)
This commit is contained in:
Scott Powell
2025-02-20 12:41:47 +11:00
parent cf63ec9493
commit fc02d8fbcb
5 changed files with 85 additions and 38 deletions

View File

@@ -229,14 +229,6 @@ class MyMesh : public mesh::Mesh {
#endif #endif
} }
const char* get_curr_time_str() {
static char tmp[32];
uint32_t now = getRTCClock()->getCurrentTime();
DateTime dt = DateTime(now);
sprintf(tmp, "%02d:%02d:%02d - %d/%d/%d U", dt.hour(), dt.minute(), dt.second(), dt.day(), dt.month(), dt.year());
return tmp;
}
protected: protected:
float getAirtimeBudgetFactor() const override { float getAirtimeBudgetFactor() const override {
return _prefs.airtime_factor; return _prefs.airtime_factor;
@@ -246,11 +238,19 @@ protected:
return !_prefs.disable_fwd; return !_prefs.disable_fwd;
} }
const char* getLogDateTime() override {
static char tmp[32];
uint32_t now = getRTCClock()->getCurrentTime();
DateTime dt = DateTime(now);
sprintf(tmp, "%02d:%02d:%02d - %d/%d/%d U", dt.hour(), dt.minute(), dt.second(), dt.day(), dt.month(), dt.year());
return tmp;
}
void logRx(mesh::Packet* pkt, int len, float score) override { void logRx(mesh::Packet* pkt, int len, float score) override {
if (_logging) { if (_logging) {
File f = openAppend(PACKET_LOG_FILE); File f = openAppend(PACKET_LOG_FILE);
if (f) { if (f) {
f.print(get_curr_time_str()); f.print(getLogDateTime());
f.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d", f.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len, len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len,
(int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000)); (int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000));
@@ -269,7 +269,7 @@ protected:
if (_logging) { if (_logging) {
File f = openAppend(PACKET_LOG_FILE); File f = openAppend(PACKET_LOG_FILE);
if (f) { if (f) {
f.print(get_curr_time_str()); f.print(getLogDateTime());
f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)", f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len); len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
@@ -287,7 +287,7 @@ protected:
if (_logging) { if (_logging) {
File f = openAppend(PACKET_LOG_FILE); File f = openAppend(PACKET_LOG_FILE);
if (f) { if (f) {
f.print(get_curr_time_str()); f.print(getLogDateTime());
f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n", f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len); len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
f.close(); f.close();

View File

@@ -284,6 +284,14 @@ protected:
return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time); return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time);
} }
const char* getLogDateTime() override {
static char tmp[32];
uint32_t now = getRTCClock()->getCurrentTime();
DateTime dt = DateTime(now);
sprintf(tmp, "%02d:%02d:%02d - %d/%d/%d U", dt.hour(), dt.minute(), dt.second(), dt.day(), dt.month(), dt.year());
return tmp;
}
uint32_t getRetransmitDelay(const mesh::Packet* packet) override { uint32_t getRetransmitDelay(const mesh::Packet* packet) override {
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.tx_delay_factor); uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.tx_delay_factor);
return getRNG()->nextInt(0, 6)*t; return getRNG()->nextInt(0, 6)*t;

View File

@@ -46,7 +46,8 @@ void Dispatcher::loop() {
releasePacket(outbound); // return to pool releasePacket(outbound); // return to pool
outbound = NULL; outbound = NULL;
} else if (millisHasNowPassed(outbound_expiry)) { } else if (millisHasNowPassed(outbound_expiry)) {
MESH_DEBUG_PRINTLN("Dispatcher::loop(): WARNING: outbound packed send timed out!"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Dispatcher::loop(): WARNING: outbound packed send timed out!");
_radio->onSendFinished(); _radio->onSendFinished();
logTxFail(outbound, 2 + outbound->path_len + outbound->payload_len); logTxFail(outbound, 2 + outbound->path_len + outbound->payload_len);
@@ -79,7 +80,8 @@ void Dispatcher::checkRecv() {
if (len > 0) { if (len > 0) {
pkt = _mgr->allocNew(); pkt = _mgr->allocNew();
if (pkt == NULL) { if (pkt == NULL) {
MESH_DEBUG_PRINTLN("Dispatcher::checkRecv(): WARNING: received data, no unused packets available!"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Dispatcher::checkRecv(): WARNING: received data, no unused packets available!");
} else { } else {
int i = 0; int i = 0;
#ifdef NODE_ID #ifdef NODE_ID
@@ -95,7 +97,8 @@ void Dispatcher::checkRecv() {
pkt->path_len = raw[i++]; pkt->path_len = raw[i++];
if (pkt->path_len > MAX_PATH_SIZE || i + pkt->path_len > len) { if (pkt->path_len > MAX_PATH_SIZE || i + pkt->path_len > len) {
MESH_DEBUG_PRINTLN("Dispatcher::checkRecv(): partial or corrupt packet received, len=%d", len); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Dispatcher::checkRecv(): partial or corrupt packet received, len=%d", len);
_mgr->free(pkt); // put back into pool _mgr->free(pkt); // put back into pool
pkt = NULL; pkt = NULL;
} else { } else {
@@ -113,10 +116,17 @@ void Dispatcher::checkRecv() {
} }
} }
if (pkt) { if (pkt) {
#if MESH_PACKET_LOGGING #if MESH_PACKET_LOGGING
Serial.printf("PACKET: recv, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d\n", Serial.print(getLogDateTime());
Serial.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d",
2 + pkt->path_len + pkt->payload_len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len, 2 + pkt->path_len + pkt->payload_len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len,
(int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000)); (int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000));
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
Serial.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
} else {
Serial.printf("\n");
}
#endif #endif
logRx(pkt, 2 + pkt->path_len + pkt->payload_len, score); // hook for custom logging logRx(pkt, 2 + pkt->path_len + pkt->payload_len, score); // hook for custom logging
@@ -125,10 +135,12 @@ void Dispatcher::checkRecv() {
int _delay = calcRxDelay(score, air_time); int _delay = calcRxDelay(score, air_time);
if (_delay < 50) { if (_delay < 50) {
MESH_DEBUG_PRINTLN("Dispatcher::checkRecv(), score delay below threshold (%d)", _delay); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Dispatcher::checkRecv(), score delay below threshold (%d)", _delay);
processRecvPacket(pkt); // is below the score delay threshold, so process immediately processRecvPacket(pkt); // is below the score delay threshold, so process immediately
} else { } else {
MESH_DEBUG_PRINTLN("Dispatcher::checkRecv(), score delay is: %d millis", _delay); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Dispatcher::checkRecv(), score delay is: %d millis", _delay);
if (_delay > MAX_RX_DELAY_MILLIS) { if (_delay > MAX_RX_DELAY_MILLIS) {
_delay = MAX_RX_DELAY_MILLIS; _delay = MAX_RX_DELAY_MILLIS;
} }
@@ -173,7 +185,8 @@ void Dispatcher::checkSend() {
memcpy(&raw[len], outbound->path, outbound->path_len); len += outbound->path_len; memcpy(&raw[len], outbound->path, outbound->path_len); len += outbound->path_len;
if (len + outbound->payload_len > MAX_TRANS_UNIT) { if (len + outbound->payload_len > MAX_TRANS_UNIT) {
MESH_DEBUG_PRINTLN("Dispatcher::checkSend(): FATAL: Invalid packet queued... too long, len=%d", len + outbound->payload_len); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Dispatcher::checkSend(): FATAL: Invalid packet queued... too long, len=%d", len + outbound->payload_len);
_mgr->free(outbound); _mgr->free(outbound);
outbound = NULL; outbound = NULL;
} else { } else {
@@ -185,8 +198,15 @@ void Dispatcher::checkSend() {
outbound_expiry = futureMillis(max_airtime); outbound_expiry = futureMillis(max_airtime);
#if MESH_PACKET_LOGGING #if MESH_PACKET_LOGGING
Serial.printf("PACKET: send, len=%d (type=%d, route=%s, payload_len=%d)\n", Serial.print(getLogDateTime());
Serial.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)",
len, outbound->getPayloadType(), outbound->isRouteDirect() ? "D" : "F", outbound->payload_len); len, outbound->getPayloadType(), outbound->isRouteDirect() ? "D" : "F", outbound->payload_len);
if (outbound->getPayloadType() == PAYLOAD_TYPE_PATH || outbound->getPayloadType() == PAYLOAD_TYPE_REQ
|| outbound->getPayloadType() == PAYLOAD_TYPE_RESPONSE || outbound->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
Serial.printf(" [%02X -> %02X]\n", (uint32_t)outbound->payload[1], (uint32_t)outbound->payload[0]);
} else {
Serial.printf("\n");
}
#endif #endif
} }
} }
@@ -208,7 +228,8 @@ void Dispatcher::releasePacket(Packet* packet) {
void Dispatcher::sendPacket(Packet* packet, uint8_t priority, uint32_t delay_millis) { void Dispatcher::sendPacket(Packet* packet, uint8_t priority, uint32_t delay_millis) {
if (packet->path_len > MAX_PATH_SIZE || packet->payload_len > MAX_PACKET_PAYLOAD) { if (packet->path_len > MAX_PATH_SIZE || packet->payload_len > MAX_PACKET_PAYLOAD) {
MESH_DEBUG_PRINTLN("Dispatcher::sendPacket(): ERROR: invalid packet... path_len=%d, payload_len=%d", (uint32_t) packet->path_len, (uint32_t) packet->payload_len); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Dispatcher::sendPacket(): ERROR: invalid packet... path_len=%d, payload_len=%d", (uint32_t) packet->path_len, (uint32_t) packet->payload_len);
_mgr->free(packet); _mgr->free(packet);
} else { } else {
_mgr->queueOutbound(packet, priority, futureMillis(delay_millis)); _mgr->queueOutbound(packet, priority, futureMillis(delay_millis));

View File

@@ -120,6 +120,7 @@ protected:
virtual void logRx(Packet* packet, int len, float score) { } // hooks for custom logging virtual void logRx(Packet* packet, int len, float score) { } // hooks for custom logging
virtual void logTx(Packet* packet, int len) { } virtual void logTx(Packet* packet, int len) { }
virtual void logTxFail(Packet* packet, int len) { } virtual void logTxFail(Packet* packet, int len) { }
virtual const char* getLogDateTime() { return ""; }
virtual float getAirtimeBudgetFactor() const; virtual float getAirtimeBudgetFactor() const;
virtual int calcRxDelay(float score, uint32_t air_time) const; virtual int calcRxDelay(float score, uint32_t air_time) const;

View File

@@ -30,7 +30,8 @@ int Mesh::searchChannelsByHash(const uint8_t* hash, GroupChannel channels[], int
DispatcherAction Mesh::onRecvPacket(Packet* pkt) { DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
if (pkt->getPayloadVer() > PAYLOAD_VER_1) { // not supported in this firmware version if (pkt->getPayloadVer() > PAYLOAD_VER_1) { // not supported in this firmware version
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): unsupported packet version"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): unsupported packet version");
return ACTION_RELEASE; return ACTION_RELEASE;
} }
@@ -54,7 +55,8 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
uint32_t ack_crc; uint32_t ack_crc;
memcpy(&ack_crc, &pkt->payload[i], 4); i += 4; memcpy(&ack_crc, &pkt->payload[i], 4); i += 4;
if (i > pkt->payload_len) { if (i > pkt->payload_len) {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): incomplete ACK packet"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): incomplete ACK packet");
} else if (!_tables->hasSeen(pkt)) { } else if (!_tables->hasSeen(pkt)) {
onAckRecv(pkt, ack_crc); onAckRecv(pkt, ack_crc);
action = routeRecvPacket(pkt); action = routeRecvPacket(pkt);
@@ -71,7 +73,8 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
uint8_t* macAndData = &pkt->payload[i]; // MAC + encrypted data uint8_t* macAndData = &pkt->payload[i]; // MAC + encrypted data
if (i + 2 >= pkt->payload_len) { if (i + 2 >= pkt->payload_len) {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): incomplete data packet"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): incomplete data packet");
} else if (!_tables->hasSeen(pkt)) { } else if (!_tables->hasSeen(pkt)) {
// NOTE: this is a 'first packet wins' impl. When receiving from multiple paths, the first to arrive wins. // NOTE: this is a 'first packet wins' impl. When receiving from multiple paths, the first to arrive wins.
// For flood mode, the path may not be the 'best' in terms of hops. // For flood mode, the path may not be the 'best' in terms of hops.
@@ -114,7 +117,8 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
if (found) { if (found) {
pkt->markDoNotRetransmit(); // packet was for this node, so don't retransmit pkt->markDoNotRetransmit(); // packet was for this node, so don't retransmit
} else { } else {
MESH_DEBUG_PRINTLN("recv matches no peers, src_hash=%02X", (uint32_t)src_hash); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" recv matches no peers, src_hash=%02X", (uint32_t)src_hash);
} }
} }
action = routeRecvPacket(pkt); action = routeRecvPacket(pkt);
@@ -128,7 +132,8 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
uint8_t* macAndData = &pkt->payload[i]; // MAC + encrypted data uint8_t* macAndData = &pkt->payload[i]; // MAC + encrypted data
if (i + 2 >= pkt->payload_len) { if (i + 2 >= pkt->payload_len) {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): incomplete data packet"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): incomplete data packet");
} else if (!_tables->hasSeen(pkt)) { } else if (!_tables->hasSeen(pkt)) {
if (self_id.isHashMatch(&dest_hash)) { if (self_id.isHashMatch(&dest_hash)) {
Identity sender(sender_pub_key); Identity sender(sender_pub_key);
@@ -155,7 +160,8 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
uint8_t* macAndData = &pkt->payload[i]; // MAC + encrypted data uint8_t* macAndData = &pkt->payload[i]; // MAC + encrypted data
if (i + 2 >= pkt->payload_len) { if (i + 2 >= pkt->payload_len) {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): incomplete data packet"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): incomplete data packet");
} else if (!_tables->hasSeen(pkt)) { } else if (!_tables->hasSeen(pkt)) {
// scan channels DB, for all matching hashes of 'channel_hash' (max 2 matches supported ATM) // scan channels DB, for all matching hashes of 'channel_hash' (max 2 matches supported ATM)
GroupChannel channels[2]; GroupChannel channels[2];
@@ -184,9 +190,11 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
const uint8_t* signature = &pkt->payload[i]; i += SIGNATURE_SIZE; const uint8_t* signature = &pkt->payload[i]; i += SIGNATURE_SIZE;
if (i > pkt->payload_len) { if (i > pkt->payload_len) {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): incomplete advertisement packet"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): incomplete advertisement packet");
} else if (self_id.matches(id.pub_key)) { } else if (self_id.matches(id.pub_key)) {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): receiving SELF advert packet"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): receiving SELF advert packet");
} else if (!_tables->hasSeen(pkt)) { } else if (!_tables->hasSeen(pkt)) {
uint8_t* app_data = &pkt->payload[i]; uint8_t* app_data = &pkt->payload[i];
int app_data_len = pkt->payload_len - i; int app_data_len = pkt->payload_len - i;
@@ -204,17 +212,20 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
is_ok = id.verify(signature, message, msg_len); is_ok = id.verify(signature, message, msg_len);
} }
if (is_ok) { if (is_ok) {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): valid advertisement received!"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): valid advertisement received!");
onAdvertRecv(pkt, id, timestamp, app_data, app_data_len); onAdvertRecv(pkt, id, timestamp, app_data, app_data_len);
action = routeRecvPacket(pkt); action = routeRecvPacket(pkt);
} else { } else {
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): received advertisement with forged signature! (app_data_len=%d)", app_data_len); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): received advertisement with forged signature! (app_data_len=%d)", app_data_len);
} }
} }
break; break;
} }
default: default:
MESH_DEBUG_PRINTLN("Mesh::onRecvPacket(): unknown payload type, header: %d", (int) pkt->header); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::onRecvPacket(): unknown payload type, header: %d", (int) pkt->header);
// Don't flood route unknown packet types! action = routeRecvPacket(pkt); // Don't flood route unknown packet types! action = routeRecvPacket(pkt);
break; break;
} }
@@ -239,7 +250,8 @@ Packet* Mesh::createAdvert(const LocalIdentity& id, const uint8_t* app_data, siz
Packet* packet = obtainNewPacket(); Packet* packet = obtainNewPacket();
if (packet == NULL) { if (packet == NULL) {
MESH_DEBUG_PRINTLN("Mesh::createAdvert(): error, packet pool empty"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::createAdvert(): error, packet pool empty");
return NULL; return NULL;
} }
@@ -283,7 +295,8 @@ Packet* Mesh::createPathReturn(const uint8_t* dest_hash, const uint8_t* secret,
Packet* packet = obtainNewPacket(); Packet* packet = obtainNewPacket();
if (packet == NULL) { if (packet == NULL) {
MESH_DEBUG_PRINTLN("Mesh::createPathReturn(): error, packet pool empty"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::createPathReturn(): error, packet pool empty");
return NULL; return NULL;
} }
packet->header = (PAYLOAD_TYPE_PATH << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later packet->header = (PAYLOAD_TYPE_PATH << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later
@@ -324,7 +337,8 @@ Packet* Mesh::createDatagram(uint8_t type, const Identity& dest, const uint8_t*
Packet* packet = obtainNewPacket(); Packet* packet = obtainNewPacket();
if (packet == NULL) { if (packet == NULL) {
MESH_DEBUG_PRINTLN("Mesh::createDatagram(): error, packet pool empty"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::createDatagram(): error, packet pool empty");
return NULL; return NULL;
} }
packet->header = (type << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later packet->header = (type << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later
@@ -348,7 +362,8 @@ Packet* Mesh::createAnonDatagram(uint8_t type, const LocalIdentity& sender, cons
Packet* packet = obtainNewPacket(); Packet* packet = obtainNewPacket();
if (packet == NULL) { if (packet == NULL) {
MESH_DEBUG_PRINTLN("Mesh::createAnonDatagram(): error, packet pool empty"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::createAnonDatagram(): error, packet pool empty");
return NULL; return NULL;
} }
packet->header = (type << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later packet->header = (type << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later
@@ -373,7 +388,8 @@ Packet* Mesh::createGroupDatagram(uint8_t type, const GroupChannel& channel, con
Packet* packet = obtainNewPacket(); Packet* packet = obtainNewPacket();
if (packet == NULL) { if (packet == NULL) {
MESH_DEBUG_PRINTLN("Mesh::createGroupDatagram(): error, packet pool empty"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::createGroupDatagram(): error, packet pool empty");
return NULL; return NULL;
} }
packet->header = (type << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later packet->header = (type << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later
@@ -390,7 +406,8 @@ Packet* Mesh::createGroupDatagram(uint8_t type, const GroupChannel& channel, con
Packet* Mesh::createAck(uint32_t ack_crc) { Packet* Mesh::createAck(uint32_t ack_crc) {
Packet* packet = obtainNewPacket(); Packet* packet = obtainNewPacket();
if (packet == NULL) { if (packet == NULL) {
MESH_DEBUG_PRINTLN("Mesh::createAck(): error, packet pool empty"); MESH_DEBUG_PRINT(getLogDateTime());
MESH_DEBUG_PRINTLN(" Mesh::createAck(): error, packet pool empty");
return NULL; return NULL;
} }
packet->header = (PAYLOAD_TYPE_ACK << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later packet->header = (PAYLOAD_TYPE_ACK << PH_TYPE_SHIFT); // ROUTE_TYPE_* set later