fix channel_num log (#2361)

* fix channel_num variable

* fix channel_num log instead
This commit is contained in:
Andre K 2023-03-17 15:36:10 -03:00 committed by GitHub
parent b398f31b64
commit 7bbfa48b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 // 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()); 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; int channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels;
// Old frequency selection formula // 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, LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd,
myRegion->freqEnd - myRegion->freqStart); myRegion->freqEnd - myRegion->freqStart);
LOG_INFO("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw); 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("Radio frequency: %f\n", getFreq());
LOG_INFO("Slot time: %u msec\n", slotTimeMsec); LOG_INFO("Slot time: %u msec\n", slotTimeMsec);
} }