diff --git a/docs/software/TODO.md b/docs/software/TODO.md index 564f11f2d..2320eaafb 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -21,6 +21,7 @@ You probably don't care about this section - skip to the next one. * implement 'get channels' Admin plugin operation * use get-channels from python * use set-channel from python +* combine acks and responses in a single message if possible * use portuino TCP connection to debug with python API * make python tests more exhaustive * document the relationship between want_response (indicating remote node received it) and want_ack (indicating that this message should be sent reliably - and also get acks from the first rx node and naks if it is never delivered) diff --git a/src/mesh/MeshPlugin.cpp b/src/mesh/MeshPlugin.cpp index 2d6b907c5..c9cc89e12 100644 --- a/src/mesh/MeshPlugin.cpp +++ b/src/mesh/MeshPlugin.cpp @@ -47,8 +47,12 @@ void MeshPlugin::callPlugins(const MeshPacket &mp) bool handled = pi.handleReceived(mp); - // Possibly send replies (but only if the message was directed to us specifically, i.e. not for promiscious sniffing), also not if we sent it - if (mp.decoded.want_response && toUs && mp.from != ourNodeNum) { + // Possibly send replies (but only if the message was directed to us specifically, i.e. not for promiscious sniffing) + + // NOTE: we send a reply *even if the (non broadcast) request was from us* which is unfortunate but necessary because currently when the phone + // sends things, it sends things using the local node ID as the from address. A better solution (FIXME) would be to let phones + // have their own distinct addresses and we 'route' to them like any other node. + if (mp.decoded.want_response && toUs && (mp.from != ourNodeNum || mp.to == ourNodeNum)) { pi.sendResponse(mp); DEBUG_MSG("Plugin %s sent a response\n", pi.name); } diff --git a/src/plugins/AdminPlugin.cpp b/src/plugins/AdminPlugin.cpp index f187fb1cc..63f7a41da 100644 --- a/src/plugins/AdminPlugin.cpp +++ b/src/plugins/AdminPlugin.cpp @@ -13,6 +13,7 @@ void AdminPlugin::handleGetChannel(const MeshPacket &req, uint32_t channelIndex) // We create the reply here AdminMessage r = AdminMessage_init_default; r.get_channel_response = channels.getByIndex(channelIndex); + r.which_variant = AdminMessage_get_channel_response_tag; reply = allocDataProtobuf(r); } } @@ -23,6 +24,7 @@ void AdminPlugin::handleGetRadio(const MeshPacket &req) // We create the reply here AdminMessage r = AdminMessage_init_default; r.get_radio_response = devicestate.radio; + r.which_variant = AdminMessage_get_radio_response_tag; reply = allocDataProtobuf(r); } }