ESP8266 switching between WiFi/WLAN-Router and ESP-NOW

Hi ESP8266-experts,

I'm trying to receive networktime with a ntpUDP-server (my local WLAN-router).
This means I connect to my WLAN-router and do a request for the time
This works.

Now after that I want to use ESP-NOW to send the time-information to another ESP8266.
But this doesn't work.

the OnSent-Callback-function reports "delivery failed".

If I don't call my "GetNTP-function" ESP-NOW works perfect.
So establishing a WiFi-connection to my router causes ESP-NOW to fail.

I'm already doing


trying to disable WiFi.
Has anybody managed to switch between WiFi and ESP-NOW?
and can post code that achieves this?

best regards Stefan

Given --
#include <espnow.h>
in the header
I don't think there's a way to "de-include" selectively, on-the-fly as it were.

HI noiasca,

I read the issue you pointed me. Using the same channel for esp-now as the Wifi does (I'm using channel 13) did not work for me. The only thing that worked for me was to do store actual time in the RTC-RAM and additional storing a "toggle-byte" then call a reset.
Then on start-up reading the RTC-RAM-toggle-byte if toggle-byte has value "connect to Wifi" connect to wifi and getting NPT-Time if toggle-byte has value "read Time from RTC-RAM" do so.
So with a deviation of approx. 10 seonds I can synchronise my software-RTC with NPT-Time

I would call this a workaround. Not an elegant solution.
best regards Stefan