From 7bbfa48b5db83a5aeab43d0f380ae4ed9ca2ca8c Mon Sep 17 00:00:00 2001 From: Andre K Date: Fri, 17 Mar 2023 15:36:10 -0300 Subject: [PATCH] fix channel_num log (#2361) * fix channel_num variable * fix channel_num log instead --- src/mesh/RadioInterface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 9a8c2d502..063ae5374 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -454,6 +454,7 @@ void RadioInterface::applyModemConfig() // If user has manually specified a channel num, then use that, otherwise generate one by hashing the name const char *channelName = channels.getName(channels.getPrimaryIndex()); + // channel_num is actually (channel_num - 1), since modulus (%) returns values from 0 to (numChannels - 1) int channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels; // Old frequency selection formula @@ -480,7 +481,7 @@ void RadioInterface::applyModemConfig() LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart); LOG_INFO("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw); - LOG_INFO("Radio channel_num: %d\n", channel_num); + LOG_INFO("Radio channel_num: %d\n", channel_num + 1); LOG_INFO("Radio frequency: %f\n", getFreq()); LOG_INFO("Slot time: %u msec\n", slotTimeMsec); }