make nodeinfo & position plugins optional

1.2-legacy
Kevin Hester 2021-03-06 10:36:30 +08:00
rodzic d2d6b8e12f
commit 2c29e8b179
2 zmienionych plików z 15 dodań i 9 usunięć

Wyświetl plik

@ -114,7 +114,8 @@ bool MeshService::reloadConfig()
void MeshService::reloadOwner() void MeshService::reloadOwner()
{ {
assert(nodeInfoPlugin); assert(nodeInfoPlugin);
nodeInfoPlugin->sendOurNodeInfo(); if(nodeInfoPlugin)
nodeInfoPlugin->sendOurNodeInfo();
nodeDB.saveToDisk(); nodeDB.saveToDisk();
} }
@ -170,12 +171,18 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
assert(node); assert(node);
DEBUG_MSG("Sending network ping to 0x%x, with position=%d, wantReplies=%d\n", dest, node->has_position, wantReplies); if (node->has_position) {
assert(positionPlugin && nodeInfoPlugin); if(positionPlugin) {
if (node->has_position) DEBUG_MSG("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
positionPlugin->sendOurPosition(dest, wantReplies); positionPlugin->sendOurPosition(dest, wantReplies);
else }
nodeInfoPlugin->sendOurNodeInfo(dest, wantReplies); }
else {
if(nodeInfoPlugin) {
DEBUG_MSG("Sending nodeinfo ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
nodeInfoPlugin->sendOurNodeInfo(dest, wantReplies);
}
}
} }
NodeInfo *MeshService::refreshMyNodeInfo() NodeInfo *MeshService::refreshMyNodeInfo()

Wyświetl plik

@ -65,8 +65,7 @@ int32_t NodeInfoPlugin::runOnce()
currentGeneration = radioGeneration; currentGeneration = radioGeneration;
DEBUG_MSG("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies); DEBUG_MSG("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies);
assert(nodeInfoPlugin); sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
nodeInfoPlugin->sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
return getPref_position_broadcast_secs() * 1000; return getPref_position_broadcast_secs() * 1000;
} }