ncmreynolds / m2mMesh

An Arduino library for machine to machine messaging over a self-organising mesh network on ESP8266/ESP32 using ESP-Now as the transport.
Other
20 stars 6 forks source link

error esp now #3

Open sreejithshaji opened 10 months ago

sreejithshaji commented 10 months ago

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

ncmreynolds commented 10 months ago

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 commented 10 months ago

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

jordigrau83 commented 3 months ago

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

include

include

include //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"); } }