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

error esp now #3

Open
sreejithshaji opened this issue Sep 4, 2023 · 3 comments
Open

error esp now #3

sreejithshaji opened this issue Sep 4, 2023 · 3 comments

Comments

@sreejithshaji
Copy link

serial prints
Peer channel is not equal to the home channel, send fail!
esp32

@ncmreynolds
Copy link
Owner

This usually happens when you have connected it to a WiFi and it has been made to change channel after the library has initialised. Have you connected it to an AP?

This is definitely something the library handles poorly and I should make it check for.

@sreejithshaji
Copy link
Author

can you please provide something about how to run this program like,
is this RTC server important and all ??

@jordigrau83
Copy link

jordigrau83 commented Mar 20, 2024

This usually happens when you have connected it to a WiFi and it has been made to change channel after the library has initialised. Have you connected it to an AP?

This is definitely something the library handles poorly and I should make it check for.

I could solve the channel selection by forching wifi to reset in the setup():

WiFi.mode (WIFI_MODE_STA);
WiFi.disconnect (false, true);

if(m2mMesh.begin())
{
Serial.print("\n\nMesh started on channel:");
//m2mMesh.
Serial.println(WiFi.channel());
}


Now I can change the default channel 1 with this:

#include <Arduino.h>
#include <m2mMesh.h>
#include <WiFi.h>
#include <esp_wifi.h> //to forche channel

void setup() {

Serial.begin(115200);

////////
WiFi.mode (WIFI_MODE_STA);
WiFi.disconnect (false, true);
//force channel 2
uint8_t channel = 2;
esp_wifi_set_promiscuous(true);
esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE);
esp_wifi_set_promiscuous(false);
//////

if(m2mMesh.begin(99,channel))
{
Serial.print("\n\nMesh started on channel:");
//m2mMesh.
Serial.println(WiFi.channel());
}
else
{
Serial.println("\n\nMesh failed to start");
}
}

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

No branches or pull requests

3 participants