fallback to parameter channel value

This commit is contained in:
medentem 2024-12-15 18:52:39 -06:00
parent dd1698a4f5
commit 3af831621d

View File

@ -58,7 +58,8 @@ void NodeInfoModule::sendOurNodeInfo(NodeNum dest, bool wantReplies, uint8_t cha
// If this is a broadcast over the default channel, we can safely change this to the discovery channel if defined
if (dest == NODENUM_BROADCAST && channel == 0) {
int8_t discoveryChannelIdx = channels.getIndexByHash((ChannelHash)USERPREFS_CONFIG_DISCOVERY_CHANNEL_HASH);
p->channel = discoveryChannelIdx > 0 ? discoveryChannelIdx : 0;
// Fallback to primary channel if discovery channel is not found by its hash
p->channel = discoveryChannelIdx > 0 ? discoveryChannelIdx : channel;
}
#endif