diff --git a/src/MeshRadio.cpp b/src/MeshRadio.cpp index fadc07805..3d181ada6 100644 --- a/src/MeshRadio.cpp +++ b/src/MeshRadio.cpp @@ -68,13 +68,13 @@ bool MeshRadio::init() ErrorCode MeshRadio::send(MeshPacket *p) { - DEBUG_MSG("enquing packet for send from=%d, to=%d\n", p->from, p->to); + DEBUG_MSG("enquing packet for send from=0x%x, to=0x%x\n", p->from, p->to); return txQueue.enqueue(p, 0); // nowait } ErrorCode MeshRadio::sendTo(NodeNum dest, const uint8_t *buf, size_t len) { - DEBUG_MSG("mesh sendTo %d bytes to %d\n", len, dest); + DEBUG_MSG("mesh sendTo %d bytes to 0x%x\n", len, dest); // FIXME - for now we do all packets as broadcast dest = NODENUM_BROADCAST; diff --git a/src/MeshService.cpp b/src/MeshService.cpp index 00358ba06..dbbe69aba 100644 --- a/src/MeshService.cpp +++ b/src/MeshService.cpp @@ -67,6 +67,11 @@ void MeshService::loop() while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL) { nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio + if(mp->has_payload && mp->payload.which_variant == SubPacket_user_tag && mp->to == NODENUM_BROADCAST) { + // Someone just sent us a User, reply with our Owner + DEBUG_MSG("Received broadcast Owner from 0x%x, replying with our owner\n", mp->from); + sendOurOwner(mp->from); + } fromNum++; assert(toPhoneQueue.enqueue(mp, 0) == pdTRUE); // FIXME, instead of failing for full queue, delete the oldest mssages diff --git a/src/MeshService.h b/src/MeshService.h index 0d1d39843..65db43daa 100644 --- a/src/MeshService.h +++ b/src/MeshService.h @@ -55,7 +55,7 @@ public: void reloadConfig() { radio.reloadConfig(); } /// The owner User record just got updated, update our node DB and broadcast the info into the mesh - void reloadOwner() { DEBUG_MSG("FIXME implement reloadOwner\n"); } + void reloadOwner() { sendOurOwner(); } /// Allocate and return a meshpacket which defaults as send to broadcast from the current node. MeshPacket *allocForSending(); diff --git a/src/NodeDB.cpp b/src/NodeDB.cpp index c7ac3378d..891639dc0 100644 --- a/src/NodeDB.cpp +++ b/src/NodeDB.cpp @@ -76,7 +76,7 @@ void NodeDB::updateFrom(const MeshPacket &mp) if (mp.has_payload) { const SubPacket &p = mp.payload; - DEBUG_MSG("Update DB node %x for variant %d\n", mp.from, p.which_variant); + DEBUG_MSG("Update DB node 0x%x for variant %d\n", mp.from, p.which_variant); if (p.which_variant != SubPacket_want_node_tag) // we don't create nodeinfo records for someone that is just trying to claim a nodenum { int oldNumNodes = numNodes;