diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index e036f846a..8296daf86 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -331,6 +331,8 @@ firmware/ - Follow existing code style - run `trunk fmt` before commits - Prefer `LOG_DEBUG`, `LOG_INFO`, `LOG_WARN`, `LOG_ERROR` for logging +- **Format node IDs and packet IDs as `0x%08x` in logs.** This covers `NodeNum`/`PacketId` and the `uint32_t` packet fields `from`, `to`, `id`, `dest`, `source`, `request_id`, and `node_id`. They are 32-bit, so 8 hex digits is exact — `%08x` never truncates or leaves a value ragged. Do **not** use `%x` (variable width) or `%0x` (a no-op typo for `%08x` — the `0` flag does nothing without a width). User-facing display uses `!%08x` (the `!xxxxxxxx` convention), e.g. `Applet::hexifyNodeNum`. +- **Do not zero-pad one-byte values to 8.** `next_hop`, `relay_node`, and the next-hop hint are `uint8_t` last-byte route hints, and `channel` is a one-byte hash/index — log these as `0x%x` (or `%d`). Padding a byte to `0x000000ab` falsely implies a full node number. The same goes for I2C addresses, register values, flags/bitmasks, and error/reason codes: they are not IDs, so leave them `0x%x`. - Use `assert()` for invariants that should never fail - C++17 features are available (`std::optional`, structured bindings, `if constexpr`, etc.) - **Keep code comments minimal — one or two lines, max.** Comment only when the _why_ isn't obvious from the code; never restate what the next line does. No multi-paragraph block comments explaining straightforward changes. The diff and commit message carry the rationale; the code carries the behavior. diff --git a/src/graphics/niche/InkHUD/Applet.cpp b/src/graphics/niche/InkHUD/Applet.cpp index 94039d519..82c67c9ff 100644 --- a/src/graphics/niche/InkHUD/Applet.cpp +++ b/src/graphics/niche/InkHUD/Applet.cpp @@ -439,12 +439,11 @@ InkHUD::Applet::SignalStrength InkHUD::Applet::getSignalStrength(float snr, floa return SIGNAL_NONE; } -// Apply the standard "node id" formatting to a nodenum int: !0123abdc +// Format a node number as the standard user-facing node ID string: !xxxxxxxx std::string InkHUD::Applet::hexifyNodeNum(NodeNum num) { - // Not found in nodeDB, show a hex nodeid instead char nodeIdHex[10]; - sprintf(nodeIdHex, "!%0x", num); // Convert to the typical "fixed width hex with !" format + sprintf(nodeIdHex, "!%08x", num); return std::string(nodeIdHex); } diff --git a/src/mesh/MeshModule.cpp b/src/mesh/MeshModule.cpp index 83b64a873..a4acea7f1 100644 --- a/src/mesh/MeshModule.cpp +++ b/src/mesh/MeshModule.cpp @@ -68,7 +68,7 @@ meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, Nod p->decoded.request_id = idFrom; p->channel = chIndex; if (err != meshtastic_Routing_Error_NONE) - LOG_WARN("Alloc an err=%d,to=0x%x,idFrom=0x%x,id=0x%x", err, to, idFrom, p->id); + LOG_WARN("Alloc an err=%d,to=0x%08x,idFrom=0x%08x,id=0x%08x", err, to, idFrom, p->id); return p; } diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index f219e60d2..a7464c0cc 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -288,14 +288,14 @@ bool MeshService::trySendPosition(NodeNum dest, bool wantReplies) LOG_DEBUG("Skip position ping; no fresh position since boot"); return false; } - LOG_INFO("Send position ping to 0x%x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel); + LOG_INFO("Send position ping to 0x%08x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel); positionModule->sendOurPosition(dest, wantReplies, node->channel); return true; } } else { #endif if (nodeInfoModule) { - LOG_INFO("Send nodeinfo ping to 0x%x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel); + LOG_INFO("Send nodeinfo ping to 0x%08x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel); nodeInfoModule->sendOurNodeInfo(dest, wantReplies, node->channel); } } diff --git a/src/mesh/NextHopRouter.cpp b/src/mesh/NextHopRouter.cpp index 5fe079a19..e3db0ef4c 100644 --- a/src/mesh/NextHopRouter.cpp +++ b/src/mesh/NextHopRouter.cpp @@ -116,7 +116,7 @@ void NextHopRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtast // -> store nothing and keep flooding (safe). if (nodeDB->resolveUniqueLastByte(p->relay_node, /*requireDirectNeighbor=*/false)) { if (origTx && origTx->next_hop != p->relay_node) { // Not already set - LOG_INFO("Update next hop of 0x%x to 0x%x based on ACK/reply (was relayer %d we were sole %d)", p->from, + LOG_INFO("Update next hop of 0x%08x to 0x%x based on ACK/reply (was relayer %d we were sole %d)", p->from, p->relay_node, wasAlreadyRelayer, weWereSoleRelayer); origTx->next_hop = p->relay_node; } @@ -128,7 +128,7 @@ void NextHopRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtast trafficManagementModule->setNextHop(p->from, p->relay_node); #endif } else { - LOG_DEBUG("Not learning next hop for 0x%x: relay byte 0x%x ambiguous/unknown; keep flooding", p->from, + LOG_DEBUG("Not learning next hop for 0x%08x: relay byte 0x%x ambiguous/unknown; keep flooding", p->from, p->relay_node); } } @@ -225,7 +225,7 @@ std::optional NextHopRouter::getNextHop(NodeNum to, uint8_t relay_node) // TraceRouteModule) with no matching record is left authoritative. const RouteHealth *h = findRouteHealth(to); if (h && h->lastNextHop == node->next_hop && isRouteStale(*h, millis())) { - LOG_INFO("Next hop 0x%x for 0x%x is stale (age/fails); flood and clear", node->next_hop, to); + LOG_INFO("Next hop 0x%x for 0x%08x is stale (age/fails); flood and clear", node->next_hop, to); node->next_hop = NO_NEXT_HOP_PREFERENCE; // clear persisted route clearRouteHealth(to); // clear RAM health return std::nullopt; @@ -240,10 +240,10 @@ std::optional NextHopRouter::getNextHop(NodeNum to, uint8_t relay_node) ResolvedNode r = nodeDB->resolveLastByte(node->next_hop, /*requireDirectNeighbor=*/true); if (r.status == LastByteResolution::Unique) return node->next_hop; - LOG_WARN("Next hop 0x%x for 0x%x %s; set no pref", node->next_hop, to, + LOG_WARN("Next hop 0x%x for 0x%08x %s; set no pref", node->next_hop, to, r.status == LastByteResolution::Ambiguous ? "ambiguous among neighbors" : "not a known neighbor"); } else - LOG_WARN("Next hop for 0x%x is 0x%x, same as relayer; set no pref", to, node->next_hop); + LOG_WARN("Next hop for 0x%08x is 0x%x, same as relayer; set no pref", to, node->next_hop); } #if HAS_TRAFFIC_MANAGEMENT @@ -257,17 +257,17 @@ std::optional NextHopRouter::getNextHop(NodeNum to, uint8_t relay_node) if (hint && hint != relay_node) { const RouteHealth *h = findRouteHealth(to); if (h && h->lastNextHop == hint && isRouteStale(*h, millis())) { - LOG_INFO("TMM next hop 0x%x for 0x%x is stale (age/fails); flood and clear", hint, to); + LOG_INFO("TMM next hop 0x%x for 0x%08x is stale (age/fails); flood and clear", hint, to); trafficManagementModule->clearNextHop(to); // clear overflow route (setNextHop won't store 0) clearRouteHealth(to); // clear RAM health return std::nullopt; } ResolvedNode r = nodeDB->resolveLastByte(hint, /*requireDirectNeighbor=*/true); if (r.status == LastByteResolution::Unique) { - LOG_DEBUG("Next hop for 0x%x is 0x%x (TMM cache)", to, hint); + LOG_DEBUG("Next hop for 0x%08x is 0x%x (TMM cache)", to, hint); return hint; } - LOG_WARN("TMM next hop 0x%x for 0x%x %s; set no pref", hint, to, + LOG_WARN("TMM next hop 0x%x for 0x%08x %s; set no pref", hint, to, r.status == LastByteResolution::Ambiguous ? "ambiguous among neighbors" : "not a known neighbor"); } } @@ -368,15 +368,15 @@ int32_t NextHopRouter::doRetransmissions() if (p.nextTxMsec <= now) { if (p.numRetransmissions == 0) { if (isFromUs(p.packet)) { - LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to, - p.packet->id); + LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%08x,to=0x%08x,id=0x%08x", p.packet->from, + p.packet->to, p.packet->id); sendAckNak(meshtastic_Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel); } // Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived stopRetransmission(it->first); stillValid = false; // just deleted it } else { - LOG_DEBUG("Sending retransmission fr=0x%x,to=0x%x,id=0x%x, tries left=%d", p.packet->from, p.packet->to, + LOG_DEBUG("Sending retransmission fr=0x%08x,to=0x%08x,id=0x%08x, tries left=%d", p.packet->from, p.packet->to, p.packet->id, p.numRetransmissions); if (!isBroadcast(p.packet->to)) { @@ -389,7 +389,7 @@ int32_t NextHopRouter::doRetransmissions() // Also reset it in the nodeDB meshtastic_NodeInfoLite *sentTo = nodeDB->getMeshNode(p.packet->to); if (sentTo) { - LOG_INFO("Resetting next hop for packet with dest 0x%x\n", p.packet->to); + LOG_INFO("Resetting next hop for packet with dest 0x%08x", p.packet->to); sentTo->next_hop = NO_NEXT_HOP_PREFERENCE; } #if HAS_TRAFFIC_MANAGEMENT diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 9adebf5d6..1a245c738 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1922,10 +1922,10 @@ void NodeDB::pickNewNodeNum() (nodeNum == NODENUM_BROADCAST || nodeNum < NUM_RESERVED)) { NodeNum candidate = random(NUM_RESERVED, LONG_MAX); // try a new random choice if (found) - LOG_WARN("NOTE! Our desired nodenum 0x%x is invalid or in use, picking 0x%x", nodeNum, candidate); + LOG_WARN("NOTE! Our desired nodenum 0x%08x is invalid or in use, picking 0x%08x", nodeNum, candidate); nodeNum = candidate; } - LOG_DEBUG("Use nodenum 0x%x ", nodeNum); + LOG_DEBUG("Use nodenum 0x%08x ", nodeNum); myNodeInfo.my_node_num = nodeNum; } @@ -3074,7 +3074,7 @@ void logHopStartDrop(const meshtastic_MeshPacket &p, const char *context) const bool decoded = (p.which_payload_variant == meshtastic_MeshPacket_decoded_tag); const bool hasBitfield = decoded && p.decoded.has_bitfield; LOG_DEBUG( - "Drop packet (%s): hop_start invalid/missing (from=0x%x id=%u hop_start=%u hop_limit=%u decoded=%d has_bitfield=%d)", + "Drop packet (%s): hop_start invalid/missing (from=0x%08x id=%u hop_start=%u hop_limit=%u decoded=%d has_bitfield=%d)", context ? context : "unknown", p.from, p.id, p.hop_start, p.hop_limit, decoded, hasBitfield); } @@ -3122,7 +3122,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou // recorded based on the packet rxTime // // FIXME perhaps handle RX_SRC_USER separately? - LOG_INFO("updatePosition REMOTE node=0x%x time=%u lat=%d lon=%d", nodeId, p.time, p.latitude_i, p.longitude_i); + LOG_INFO("updatePosition REMOTE node=0x%08x time=%u lat=%d lon=%d", nodeId, p.time, p.latitude_i, p.longitude_i); // First, back up fields that we want to protect from overwrite uint32_t tmp_time = slot.time; @@ -3155,7 +3155,7 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxS if (src == RX_SRC_LOCAL) { LOG_DEBUG("updateTelemetry LOCAL device"); } else { - LOG_DEBUG("updateTelemetry REMOTE device node=0x%x", nodeId); + LOG_DEBUG("updateTelemetry REMOTE device node=0x%08x", nodeId); } #if !MESHTASTIC_EXCLUDE_TELEMETRYDB concurrency::LockGuard guard(&satelliteMutex); @@ -3167,7 +3167,7 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxS if (src == RX_SRC_LOCAL) { LOG_DEBUG("updateTelemetry LOCAL env"); } else { - LOG_DEBUG("updateTelemetry REMOTE env node=0x%x", nodeId); + LOG_DEBUG("updateTelemetry REMOTE env node=0x%08x", nodeId); } #if !MESHTASTIC_EXCLUDE_ENVIRONMENTDB concurrency::LockGuard guard(&satelliteMutex); @@ -3336,7 +3336,7 @@ void NodeDB::updateFrom(const meshtastic_MeshPacket &mp) return; } if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.from) { - LOG_DEBUG("Update DB node 0x%x, rx_time=%u", mp.from, mp.rx_time); + LOG_DEBUG("Update DB node 0x%08x, rx_time=%u", mp.from, mp.rx_time); meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getFrom(&mp)); if (!info) { @@ -3730,7 +3730,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) lite->public_key.size = 32; memcpy(lite->public_key.bytes, warm.public_key, 32); } - LOG_MIGRATION("Rehydrated node 0x%x from warm tier (key=%d)", n, lite->public_key.size == 32); + LOG_MIGRATION("Rehydrated node 0x%08x from warm tier (key=%d)", n, lite->public_key.size == 32); } #endif LOG_INFO("Adding node to database with %i nodes and %u bytes free!", numMeshNodes, memGet.getFreeHeap()); diff --git a/src/mesh/ProtobufModule.h b/src/mesh/ProtobufModule.h index fa2417c46..42d80d5d6 100644 --- a/src/mesh/ProtobufModule.h +++ b/src/mesh/ProtobufModule.h @@ -89,7 +89,7 @@ template class ProtobufModule : protected SinglePortModule memset(&scratch, 0, sizeof(scratch)); if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) { decoded = &scratch; - LOG_INFO("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d", name, mp.from, mp.id, p.portnum, + LOG_INFO("Received %s from=0x%08x, id=0x%08x, portnum=%d, payloadlen=%d", name, mp.from, mp.id, p.portnum, p.payload.size); } else { LOG_ERROR("Error decoding proto module!"); diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 281587d44..bdd267e16 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -770,11 +770,12 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(meshtastic_MeshPacket *p) return delay; } +// Node IDs and packet IDs are formatted as 0x%08x in logs, and !%08x in user-facing display. void printPacket(const char *prefix, const meshtastic_MeshPacket *p) { #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE) std::string out = - DEBUG_PORT.mt_sprintf("%s (id=0x%08x fr=0x%08x to=0x%08x, transport = %u, WantAck=%d, HopLim=%d Ch=0x%x", prefix, p->id, + DEBUG_PORT.mt_sprintf("%s (id=0x%08x fr=0x%08x to=0x%08x, transport = %u, WantAck=%d, HopLim=%d Ch=%d", prefix, p->id, p->from, p->to, p->transport_mechanism, p->want_ack, p->hop_limit, p->channel); if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { auto &s = p->decoded; @@ -788,13 +789,13 @@ void printPacket(const char *prefix, const meshtastic_MeshPacket *p) out += DEBUG_PORT.mt_sprintf(" PKI"); if (s.source != 0) - out += DEBUG_PORT.mt_sprintf(" source=%08x", s.source); + out += DEBUG_PORT.mt_sprintf(" source=0x%08x", s.source); if (s.dest != 0) - out += DEBUG_PORT.mt_sprintf(" dest=%08x", s.dest); + out += DEBUG_PORT.mt_sprintf(" dest=0x%08x", s.dest); if (s.request_id) - out += DEBUG_PORT.mt_sprintf(" requestId=%0x", s.request_id); + out += DEBUG_PORT.mt_sprintf(" requestId=0x%08x", s.request_id); /* now inside Data and therefore kinda opaque if (s.which_ackVariant == SubPacket_success_id_tag) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 3aff92831..d1c430d31 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -247,7 +247,7 @@ bool RadioLibInterface::cancelSending(NodeNum from, PacketId id) packetPool.release(p); // free the packet we just removed bool result = (p != NULL); - LOG_DEBUG("cancelSending id=0x%x, removed=%d", id, result); + LOG_DEBUG("cancelSending id=0x%08x, removed=%d", id, result); return result; } diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 3126c820e..9c800b027 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -148,7 +148,7 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas if ((ackId || nakId) && // Implicit ACKs from MQTT should not stop retransmissions !(isFromUs(p) && p->transport_mechanism == meshtastic_MeshPacket_TransportMechanism_TRANSPORT_MQTT)) { - LOG_DEBUG("Received a %s for 0x%x, stopping retransmissions", ackId ? "ACK" : "NAK", ackId); + LOG_DEBUG("Received a %s for 0x%08x, stopping retransmissions", ackId ? "ACK" : "NAK", ackId); if (ackId) { stopRetransmission(p->to, ackId); // M3: an end-to-end ACK proves the directed route to the ACK's sender currently works, diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 6f08e8cab..f6505bce1 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -119,7 +119,7 @@ bool Router::shouldDecrementHopLimit(const meshtastic_MeshPacket *p) if (node && nodeInfoLiteIsFavorite(node) && nodeInfoLiteHasUser(node) && IS_ONE_OF(node->role, meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_ROUTER_LATE, meshtastic_Config_DeviceConfig_Role_CLIENT_BASE)) { - LOG_DEBUG("Identified unique favorite relay router 0x%x from last byte 0x%x", resolved, p->relay_node); + LOG_DEBUG("Identified unique favorite relay router 0x%08x from last byte 0x%x", resolved, p->relay_node); return false; // Don't decrement hop_limit } } @@ -450,7 +450,7 @@ DecodeState perhapsDecode(meshtastic_MeshPacket *p) if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_KNOWN_ONLY && !nodeInfoLiteHasUser(nodeDB->getMeshNode(p->from))) { - LOG_DEBUG("Node 0x%x not in nodeDB-> Rebroadcast mode KNOWN_ONLY will ignore packet", p->from); + LOG_DEBUG("Node 0x%08x not in nodeDB-> Rebroadcast mode KNOWN_ONLY will ignore packet", p->from); return DecodeState::DECODE_FAILURE; } @@ -925,14 +925,14 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p) #endif // assert(radioConfig.has_preferences); if (is_in_repeated(config.lora.ignore_incoming, p->from)) { - LOG_DEBUG("Ignore msg, 0x%x is in our ignore list", p->from); + LOG_DEBUG("Ignore msg, 0x%08x is in our ignore list", p->from); packetPool.release(p); return; } meshtastic_NodeInfoLite const *node = nodeDB->getMeshNode(p->from); if (nodeInfoLiteIsIgnored(node)) { - LOG_DEBUG("Ignore msg, 0x%x is ignored", p->from); + LOG_DEBUG("Ignore msg, 0x%08x is ignored", p->from); packetPool.release(p); return; } @@ -944,7 +944,7 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p) } if (config.lora.ignore_mqtt && p->via_mqtt) { - LOG_DEBUG("Msg came in via MQTT from 0x%x", p->from); + LOG_DEBUG("Msg came in via MQTT from 0x%08x", p->from); packetPool.release(p); return; } @@ -956,7 +956,7 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p) } if (shouldFilterReceived(p)) { - LOG_DEBUG("Incoming msg was filtered from 0x%x", p->from); + LOG_DEBUG("Incoming msg was filtered from 0x%08x", p->from); packetPool.release(p); return; } diff --git a/src/mesh/udp/UdpMulticastHandler.h b/src/mesh/udp/UdpMulticastHandler.h index 93306c41d..3deb4bd1a 100644 --- a/src/mesh/udp/UdpMulticastHandler.h +++ b/src/mesh/udp/UdpMulticastHandler.h @@ -74,7 +74,7 @@ class UdpMulticastHandler final if (isPacketDecoded && router && mp.which_payload_variant == meshtastic_MeshPacket_encrypted_tag) { // Drop packets with spoofed local origin — no legitimate LAN node should send from=0 or our own nodeNum if (isFromUs(&mp)) { - LOG_WARN("UDP packet with spoofed local from=0x%x, dropping", mp.from); + LOG_WARN("UDP packet with spoofed local from=0x%08x, dropping", mp.from); return; } mp.transport_mechanism = meshtastic_MeshPacket_TransportMechanism_TRANSPORT_MULTICAST_UDP; diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 86477a9bc..46ddbc610 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -496,7 +496,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta } else if (mp.from == 0) { // local request from the phone — tell the user why it didn't take sendWarning(NodeDB::PROTECTED_CAP_WARN_FMT, "favorite", r->set_favorite_node, MAX_NUM_NODES - 2); } else { - LOG_WARN("Remote set_favorite_node for 0x%x refused: protected-node cap", r->set_favorite_node); + LOG_WARN("Remote set_favorite_node for 0x%08x refused: protected-node cap", r->set_favorite_node); } } break; @@ -525,7 +525,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta } else if (mp.from == 0) { // local request from the phone — tell the user why it didn't take sendWarning(NodeDB::PROTECTED_CAP_WARN_FMT, "ignore", r->set_ignored_node, MAX_NUM_NODES - 2); } else { - LOG_WARN("Remote set_ignored_node for 0x%x refused: protected-node cap", r->set_ignored_node); + LOG_WARN("Remote set_ignored_node for 0x%08x refused: protected-node cap", r->set_ignored_node); } } break; diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index 2cd8ec5ed..6c4b452ba 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -14,11 +14,11 @@ NOTE: For debugging only */ void NeighborInfoModule::printNeighborInfo(const char *header, const meshtastic_NeighborInfo *np) { - LOG_DEBUG("%s NEIGHBORINFO PACKET from Node 0x%x to Node 0x%x (last sent by 0x%x)", header, np->node_id, nodeDB->getNodeNum(), - np->last_sent_by_id); + LOG_DEBUG("%s NEIGHBORINFO PACKET from Node 0x%08x to Node 0x%08x (last sent by 0x%08x)", header, np->node_id, + nodeDB->getNodeNum(), np->last_sent_by_id); LOG_DEBUG("Packet contains %d neighbors", np->neighbors_count); for (int i = 0; i < np->neighbors_count; i++) { - LOG_DEBUG("Neighbor %d: node_id=0x%x, snr=%.2f", i, np->neighbors[i].node_id, np->neighbors[i].snr); + LOG_DEBUG("Neighbor %d: node_id=0x%08x, snr=%.2f", i, np->neighbors[i].node_id, np->neighbors[i].snr); } } @@ -30,7 +30,7 @@ void NeighborInfoModule::printNodeDBNeighbors() { LOG_DEBUG("Our NodeDB contains %d neighbors", neighbors.size()); for (size_t i = 0; i < neighbors.size(); i++) { - LOG_DEBUG("Node %d: node_id=0x%x, snr=%.2f", i, neighbors[i].node_id, neighbors[i].snr); + LOG_DEBUG("Node %d: node_id=0x%08x, snr=%.2f", i, neighbors[i].node_id, neighbors[i].snr); } } @@ -93,7 +93,7 @@ void NeighborInfoModule::cleanUpNeighbors() // broadcast interval cannot use isWithinTimespanMs() as it->last_rx_time is // seconds since 1970 if ((now - it->last_rx_time > it->node_broadcast_interval_secs * 2) && (it->node_id != my_node_id)) { - LOG_DEBUG("Remove neighbor with node ID 0x%x", it->node_id); + LOG_DEBUG("Remove neighbor with node ID 0x%08x", it->node_id); it = std::vector::reverse_iterator( neighbors.erase(std::next(it).base())); // Erase the element and update the iterator } else { diff --git a/src/modules/RangeTestModule.cpp b/src/modules/RangeTestModule.cpp index 9d3c3ffba..57001919d 100644 --- a/src/modules/RangeTestModule.cpp +++ b/src/modules/RangeTestModule.cpp @@ -141,7 +141,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const meshtastic_MeshPacket /* auto &p = mp.decoded; - LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s", + LOG_DEBUG("Received text msg self=0x%08x, from=0x%08x, to=0x%08x, id=%d, msg=%.*s", LOG_INFO.getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes); */ diff --git a/src/modules/ReplyModule.cpp b/src/modules/ReplyModule.cpp index 434441d49..c48b16d53 100644 --- a/src/modules/ReplyModule.cpp +++ b/src/modules/ReplyModule.cpp @@ -12,7 +12,7 @@ meshtastic_MeshPacket *ReplyModule::allocReply() auto req = *currentRequest; auto &p = req.decoded; // The incoming message is in p.payload - LOG_INFO("Received message from=0x%0x, id=%d, msg=%.*s", req.from, req.id, p.payload.size, p.payload.bytes); + LOG_INFO("Received message from=0x%08x, id=0x%08x, msg=%.*s", req.from, req.id, p.payload.size, p.payload.bytes); #endif const char *replyStr = "Message Received"; diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index f0d1278aa..058a5701c 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -377,7 +377,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const meshtastic_MeshPacket &mp } auto &p = mp.decoded; - // LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s", + // LOG_DEBUG("Received text msg self=0x%08x, from=0x%08x, to=0x%08x, id=%d, msg=%.*s", // nodeDB->getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes); if (isFromUs(&mp)) { diff --git a/src/modules/TextMessageModule.cpp b/src/modules/TextMessageModule.cpp index 275dec63d..1d0912311 100644 --- a/src/modules/TextMessageModule.cpp +++ b/src/modules/TextMessageModule.cpp @@ -15,7 +15,7 @@ ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp { #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE) auto &p = mp.decoded; - LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes); + LOG_INFO("Received text msg from=0x%08x, id=0x%08x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes); #endif // add packet ID to the rolling list of packets textPacketList[textPacketListIndex] = mp.id; diff --git a/src/modules/WaypointModule.cpp b/src/modules/WaypointModule.cpp index ca96eaa7a..8eaf2c5c6 100644 --- a/src/modules/WaypointModule.cpp +++ b/src/modules/WaypointModule.cpp @@ -19,7 +19,7 @@ ProcessMessage WaypointModule::handleReceived(const meshtastic_MeshPacket &mp) { #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE) auto &p = mp.decoded; - LOG_INFO("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes); + LOG_INFO("Received waypoint msg from=0x%08x, id=0x%08x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes); #endif // We only store/display messages destined for us. // Keep a copy of the most recent text message. diff --git a/src/platform/portduino/SimRadio.cpp b/src/platform/portduino/SimRadio.cpp index c483eca02..14465a09f 100644 --- a/src/platform/portduino/SimRadio.cpp +++ b/src/platform/portduino/SimRadio.cpp @@ -140,7 +140,7 @@ bool SimRadio::cancelSending(NodeNum from, PacketId id) packetPool.release(p); // free the packet we just removed bool result = (p != NULL); - LOG_DEBUG("cancelSending id=0x%x, removed=%d", id, result); + LOG_DEBUG("cancelSending id=0x%08x, removed=%d", id, result); return result; }