Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix channel_num log #2361

Merged
merged 2 commits into from
Mar 17, 2023
Merged

fix channel_num log #2361

merged 2 commits into from
Mar 17, 2023

Conversation

andrekir
Copy link
Member

@andrekir andrekir commented Mar 16, 2023

the value shown in the log for channel_num is actually (channel_num - 1) because that is the value used in the formula to calc frequency center:

int channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels;

float freq = myRegion->freqStart + (bw / 2000) + (channel_num * (bw / 1000));

below should be preferred for clarity:

int channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels + 1;
...
float freq = myRegion->freqStart + (bw / 2000) + ((channel_num - 1) * (bw / 1000));

@github-actions
Copy link
Contributor

github-actions bot commented Mar 16, 2023

🤖 Pull request artifacts

file commit
pr2361-firmware-2.1.3.3e818a5.zip 3e818a5

thebentern added a commit to meshtastic/artifacts that referenced this pull request Mar 16, 2023
Copy link
Member

@caveman99 caveman99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid observation, but the proposed fix will break things badly for all users. Can't we just fix the log display?

src/mesh/RadioInterface.cpp Outdated Show resolved Hide resolved
src/mesh/RadioInterface.cpp Outdated Show resolved Hide resolved
@andrekir andrekir changed the title fix channel_num variable fix channel_num log Mar 17, 2023
thebentern added a commit to meshtastic/artifacts that referenced this pull request Mar 17, 2023
@thebentern thebentern merged commit 7bbfa48 into meshtastic:master Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants