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

WiFi Monitor is always set to channel 1 when started #2433

Closed
hugokerstens opened this issue Jul 18, 2018 · 1 comment
Closed

WiFi Monitor is always set to channel 1 when started #2433

hugokerstens opened this issue Jul 18, 2018 · 1 comment

Comments

@hugokerstens
Copy link

I'm trying to monitor all different channels using my NodeMCU EPS8266 module. However, I quickly ran into the issue that whatever I tried, the monitored channel was always 1.

Looking into the source code, I found that upon starting the channel is set back to 1.

wifi_set_channel(1);

A workaround is to set the channel after starting the monitor, but that can be quite confusing. Even the provided example in the docs would not work, since the channel there is also set before starting the monitor.

https://nodemcu.readthedocs.io/en/master/en/modules/wifi_monitor/#example

I don't know if the call to wifi_set_channel is needed after changing into monitor mode, otherwise, the line can simply be removed.

Other solutions would be:

  • Clearly specify this behaviour in the documentation
  • Add an argument to wifi.monitor.start which specifies the channel
@pjsg
Copy link
Member

pjsg commented Jul 18, 2018

You are absolutley right. The example should show the set channel happening after the call to start the monitor.

I had great difficulty in making the monitoring code work without crashing inside the SDK and I now can't recall whether the setchannel of 1 was necessary or not. I agree that it ought to be specified in the documentation.

Do you want to submit a pull request to fix the documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants