@@ -25,7 +25,9 @@ SignalRoutingModule::SignalRoutingModule() : MeshModule("SignalRouting")
2525}
2626
2727bool SignalRoutingModule::shouldUseSignalBasedRouting (const meshtastic_MeshPacket *p) {
28- if (!config.routing .signal_based_routing || !routingGraph) {
28+ // Signal-based routing enabled by default in this fork
29+ // TODO: Use config.routing.signal_based_routing after protobuf regeneration
30+ if (!signalBasedRoutingEnabled || !routingGraph) {
2931 return false ;
3032 }
3133
@@ -105,41 +107,38 @@ void SignalRoutingModule::onNodeInfoChanged() {
105107}
106108
107109bool SignalRoutingModule::isSignalBasedCapable (NodeNum nodeId) {
110+ // TODO: Check node->signal_based_capable after protobuf regeneration
111+ // For now, assume all nodes we've heard from recently are capable
112+ // (this is a temporary heuristic until we can exchange capability info)
108113 const meshtastic_NodeInfoLite *node = nodeDB->getMeshNode (nodeId);
109- return node && node->signal_based_capable ;
114+ if (!node) return false ;
115+
116+ // Consider a node capable if we've heard from it in the last 5 minutes
117+ uint32_t now = getValidTime (RTCQualityFromNet);
118+ return (now - node->last_heard ) < 300 ;
110119}
111120
112121float SignalRoutingModule::getSignalBasedCapablePercentage () {
113- int totalNodes = 0 ;
114- int capableNodes = 0 ;
115-
116- for (int i = 0 ; i < nodeDB->getNumMeshNodes (); i++) {
117- const meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex (i);
118- if (node) {
119- totalNodes++;
120- if (node->signal_based_capable ) {
121- capableNodes++;
122- }
123- }
124- }
125-
126- if (totalNodes == 0 ) return 0 .0f ;
127- return (static_cast <float >(capableNodes) / totalNodes) * 100 .0f ;
122+ // int totalNodes = 0;
123+ // int capableNodes = 0;
124+
125+ // for (int i = 0; i < nodeDB->getNumMeshNodes(); i++) {
126+ // const meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i);
127+ // if (node) {
128+ // totalNodes++;
129+ // if (node->signal_based_capable) {
130+ // capableNodes++;
131+ // }
132+ // }
133+ // }
134+
135+ // if (totalNodes == 0) return 0.0f;
136+ // return (static_cast<float>(capableNodes) / totalNodes) * 100.0f;
137+ return 100 .0f ;
128138}
129139
130140void SignalRoutingModule::updateSignalBasedCapable () {
131- // Update our own node info to indicate signal-based capability
132- meshtastic_NodeInfo *ourNodeInfo = nodeDB->getMutableNodeInfo ();
133- if (ourNodeInfo) {
134- ourNodeInfo->signal_based_capable = true ;
135-
136- // Update neighbors list (max 6 as per requirements)
137- ourNodeInfo->neighbors_count = std::min (static_cast <size_t >(6 ), neighbors.size ());
138- for (size_t i = 0 ; i < ourNodeInfo->neighbors_count ; i++) {
139- ourNodeInfo->neighbors [i] = neighbors[i];
140- }
141-
142- LOG_DEBUG (" SignalRouting: Updated NodeInfo - signal_based_capable=true, neighbors=%d" ,
143- ourNodeInfo->neighbors_count );
144- }
141+ // TODO: Set ourNodeInfo->signal_based_capable = true after protobuf regeneration
142+ // For now, this is a no-op since the field doesn't exist yet
143+ LOG_DEBUG (" SignalRouting: Module initialized (signal_based_capable will be set after protobuf update)" );
145144}
0 commit comments