diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index fa184b3913..eb40b77122 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -48,6 +48,14 @@ class MeshService uint32_t oldFromNum = 0; public: + static bool isTextPayload(const meshtastic_MeshPacket *p) + { + if (moduleConfig.range_test.enabled && p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP) { + return true; + } + return p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP || + p->decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP; + } /// Called when some new packets have arrived from one of the radios Observable fromNumChanged; diff --git a/src/modules/DetectionSensorModule.h b/src/modules/DetectionSensorModule.h index bcc0b9419d..ed6cddda59 100644 --- a/src/modules/DetectionSensorModule.h +++ b/src/modules/DetectionSensorModule.h @@ -5,7 +5,7 @@ class DetectionSensorModule : public SinglePortModule, private concurrency::OSTh { public: DetectionSensorModule() - : SinglePortModule("detection", meshtastic_PortNum_TEXT_MESSAGE_APP), OSThread("DetectionSensorModule") + : SinglePortModule("detection", meshtastic_PortNum_DETECTION_SENSOR_APP), OSThread("DetectionSensorModule") { } diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index cbcf4e452d..20191e706f 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -128,6 +128,11 @@ int32_t ExternalNotificationModule::runOnce() } } +bool ExternalNotificationModule::wantPacket(const meshtastic_MeshPacket *p) +{ + return MeshService::isTextPayload(p); +} + /** * Sets the external notification on for the specified index. * @@ -212,8 +217,8 @@ void ExternalNotificationModule::stopNow() } ExternalNotificationModule::ExternalNotificationModule() - : SinglePortModule("ExternalNotificationModule", meshtastic_PortNum_TEXT_MESSAGE_APP), concurrency::OSThread( - "ExternalNotificationModule") + : SinglePortModule("ExternalNotificationModule", meshtastic_PortNum_TEXT_MESSAGE_APP), + concurrency::OSThread("ExternalNotificationModule") { /* Uncomment the preferences below if you want to use the module diff --git a/src/modules/ExternalNotificationModule.h b/src/modules/ExternalNotificationModule.h index f8ec053dd2..3331ec428d 100644 --- a/src/modules/ExternalNotificationModule.h +++ b/src/modules/ExternalNotificationModule.h @@ -52,6 +52,8 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency: virtual int32_t runOnce() override; + virtual bool wantPacket(const meshtastic_MeshPacket *p) override; + bool isNagging = false; virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp, @@ -59,4 +61,4 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency: meshtastic_AdminMessage *response) override; }; -extern ExternalNotificationModule *externalNotificationModule; +extern ExternalNotificationModule *externalNotificationModule; \ No newline at end of file diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index 706b1db582..804384cb62 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -120,7 +120,7 @@ Assumes that the neighborInfo packet has been allocated */ uint32_t NeighborInfoModule::collectNeighborInfo(meshtastic_NeighborInfo *neighborInfo) { - int my_node_id = nodeDB.getNodeNum(); + uint my_node_id = nodeDB.getNodeNum(); neighborInfo->node_id = my_node_id; neighborInfo->last_sent_by_id = my_node_id; neighborInfo->node_broadcast_interval_secs = moduleConfig.neighbor_info.update_interval; diff --git a/src/modules/RangeTestModule.h b/src/modules/RangeTestModule.h index ae2a8f1829..b632d343e7 100644 --- a/src/modules/RangeTestModule.h +++ b/src/modules/RangeTestModule.h @@ -29,7 +29,7 @@ class RangeTestModuleRadio : public SinglePortModule uint32_t lastRxID = 0; public: - RangeTestModuleRadio() : SinglePortModule("RangeTestModuleRadio", meshtastic_PortNum_TEXT_MESSAGE_APP) + RangeTestModuleRadio() : SinglePortModule("RangeTestModuleRadio", meshtastic_PortNum_RANGE_TEST_APP) { loopbackOk = true; // Allow locally generated messages to loop back to the client } diff --git a/src/modules/TextMessageModule.cpp b/src/modules/TextMessageModule.cpp index 8ff034fa93..0f86a6470d 100644 --- a/src/modules/TextMessageModule.cpp +++ b/src/modules/TextMessageModule.cpp @@ -1,4 +1,5 @@ #include "TextMessageModule.h" +#include "MeshService.h" #include "NodeDB.h" #include "PowerFSM.h" #include "configuration.h" @@ -22,3 +23,8 @@ ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp return ProcessMessage::CONTINUE; // Let others look at this message also if they want } + +bool TextMessageModule::wantPacket(const meshtastic_MeshPacket *p) +{ + return MeshService::isTextPayload(p); +} \ No newline at end of file diff --git a/src/modules/TextMessageModule.h b/src/modules/TextMessageModule.h index 93b1bfaa2d..cc0b0f9d51 100644 --- a/src/modules/TextMessageModule.h +++ b/src/modules/TextMessageModule.h @@ -20,6 +20,7 @@ class TextMessageModule : public SinglePortModule, public Observable