ESP8266 after connecting to my Wifi-Router and disconnect ESP-NOW does not work

Hi everybody,

I have a long code (exceeding the 9000 bytes-limit of the forum-software) that receives ESP-NOW-messages on a ESP8266 Wemos D!-mini-Board.

Configuring ESP-NOW is coded like this

void ESP_Now_setup(){
  WiFi.mode(WIFI_STA);
  Serial.println("WiFi.mode(WIFI_STA); done");
  WiFi.disconnect(); // for strange reasons WiFi.disconnect() makes ESP-NOW work
  Serial.println("WiFi.disconnect(); done");

As long as I just setup ESP-NOW without connecting to my WiFi-Router the receiving of ESP-NOW-messages works
if I add connecting to my WiFi-Router to obtain time-information from a NTP-server and do a

receiving ESP-NOW-messages does not work anymore.

So what the heck must I code to make it work again?

the only difference between ESP-NOW working or not woring is a call to this function inside setup()

void GetNTP_Time() {
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(200);
    Serial.print(".");
    HeartBeat.BlinkOnBoardLED(200);
  }
  Serial.println("");
  Serial.println("WiFi connected.");
  
  timeClient.begin();
  yield();
  timeClient.update();
  yield();
  WiFi.disconnect();
  RTC_Hour   = timeClient.getHours();
  RTC_Minute = timeClient.getMinutes();
  RTC_Second = timeClient.getSeconds() + 1;
  delay(1000);
  Print_RTC_Time();
}

this is my setup-function

void setup() {
  IO_Pin_Setup();

  Serial.begin(115200);   // Init Serial Monitor
  Serial.println();  // a carriage return to make sure serial-output begins in colum 1 of a new line
  PrintFileNameDateTime();
  PrintWiFiMacAdress();  
  
  //GetNTP_Time();  // activating this function-call and receiving of ESP-NOW does not work anymore

  ESP_Now_setup();

  TimerSetup();
}

Does anybody know what kind of sledge-hammer I have to use to make ESP-NOW-receiving working again.
Whenever I upload a code-version without the function-call of GetNTP_Time(); receiving of ESP-NOW-messages immediately works.

best regards Stefan

Multi-Cross-Post
Links zusammen getragen durch fips finden Sie hier: Re: gilt gleiche Frage im englischen bzw. deutschen Forum als Doppelposting? #13

MfG

StefanL38:
Ich betrachte das ganze als Ügzb.

... auch eine Einstellung