we now reply to owner messages with our owner

1.2-legacy
geeksville 2020-02-06 11:07:44 -08:00
rodzic 2792e2148f
commit 61a88a343e
4 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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

Wyświetl plik

@ -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();

Wyświetl plik

@ -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;