bluerange-io / bluerange-mesh

BlueRange Mesh (formerly FruityMesh) - The first completely connection-based open source mesh on top of Bluetooth Low Energy (4.1/5.0 or higher)
https://bluerange.io/
Other
288 stars 109 forks source link

Unable to load custom modules #118

Closed jjduhamel closed 4 years ago

jjduhamel commented 4 years ago

Since the recent update, I'm having trouble figuring out how to load and activate my custom modules. I see the code related to this has changed, but the docs and example code are both still relevant to the old codebase.

In addition to the changes I made here: https://github.com/mwaylabs/fruitymesh/pull/117, I've made the following changes:

diff --git a/config/featuresets/github.cpp b/config/featuresets/github.cpp
index 933b665..8d981d4 100644
--- a/config/featuresets/github.cpp
+++ b/config/featuresets/github.cpp
@@ -37,6 +37,7 @@
 #include "EnrollmentModule.h"
 #include "IoModule.h"
 #include "MeshAccessModule.h"
+#include "PingModule.h"
 #include "GlobalState.h"

 void setFeaturesetConfiguration_github(ModuleConfiguration* config, void* module)
@@ -74,6 +75,7 @@ u32 initializeModules_github(bool createModule)
        size += GS->InitializeModule<EnrollmentModule>(createModule);
        size += GS->InitializeModule<IoModule>(createModule);
        size += GS->InitializeModule<MeshAccessModule>(createModule);
+       size += GS->InitializeModule<PingModule>(createModule);
        return size;
 }

Is there some other step that I'm missing?

Brotcrunsher commented 4 years ago

Hi John!

You are right, the documentation for this is a bit outdated, a fix for it is already on the way. It seems like you have found out most of the new stuff by yourself. Probably the module is not active though. To do this you must set configuration.moduleActive = true for the PingModule. You can either do this inside of PingModule::ResetToDefaultConfiguration() or inside of setFeaturesetConfiguration_github in the case that config->moduleId == ModuleId::PING_MODULE. Hope this helps!

Jakob

volkrass commented 4 years ago

So that you don't have to wait for the documentation to be updated for our github version. Here is a link to the already released commercial version of the documentation. "Custom Modul" description is the same for commercial and non-commercial edition.

jjduhamel commented 4 years ago

Thanks for the link. I'm able to load the module, but when I issue pingmod 0 or pingmod this, I see log messages from PingModule::TerminalCommandHandler but nothing from PingModule::MeshMessageReceivedHandler.

  < pingmod 0

00> [PingModule.cpp@92 PINGMOD]: Trying to ping node 0 (201)
romankc commented 4 years ago

@volkrass or @Brotcrunsher , any comments on this?

Brotcrunsher commented 4 years ago

I have checked it and for me this is working. Could you give me more details please?

  1. If you type in status you get a few details about the node. Could you tell me the Mesh clusterSize that is reported by this command? If both nodes are connected correctly it should report 2.
  2. Did you enable the logging of the PINGMOD tag on both nodes?
jjduhamel commented 4 years ago

I found the issue. In PingModule.cpp I needed to set configuration.moduleActive = true; in PingModule::ResetToDefaultConfiguration. It's working as expected now.

Brotcrunsher commented 4 years ago

I am happy that you were able to fix your issue. Yes, the module must be set active, as I wrote in my first response.

jjduhamel commented 4 years ago

Ah yes I overlooked that. Thanks for your help.