tzapu / WiFiManager

ESP8266 WiFi Connection manager with web captive portal
http://tzapu.com/esp8266-wifi-connection-manager-library-arduino-ide/
MIT License
6.45k stars 1.94k forks source link

Force MDNS restart after connection (NONBlockling) #1622

Open Shumatic opened 1 year ago

Shumatic commented 1 year ago

Basic Infos

Hardware

WiFimanager Branch/Release: Master 2.0.16-rc.2

Esp8266:

Hardware: ESP-12e

Core Version: 2.4.0, staging

Description

Is there a callback function to indicate that a connection is made? When using NONblocking and MDNS, it connects fine, but MDNS takes a long time to initialize, so i would like to force a MDNS restart.

Settings in IDE 1.8.13

Module: Generic

tablatronix commented 1 year ago

hmm on esp8266 you have to explicitly run mdns, maybe there is a problem there.

Shumatic commented 1 year ago

hmm on esp8266 you have to explicitly run mdns, maybe there is a problem there.

No, i am aware of this, and i have MDNS.begin ( "name" ) ) in setup. If ESP dosnt have a WiFi connection when booted, it still setup MDNS, and when i configure WiFi through the WiFimaneger it connects, but it isn't possile to reach from "name" only ip. It takes more then an hour before it works.

tablatronix commented 1 year ago

If you use WM non blocking it handles this for you.

Otherwise I think you are suppose to call this in loop 'MDNS.update();'

Maybe this is outdated, I will have to check the docs and code for esp mdns.

But give that a try in case its not working?

I will investigate this for a bug, sounds like it might be, or not starting mdns when no connection

Also confirm there is no delays in loop and you are calling wm.process() often enough

Shumatic commented 1 year ago

Thanks When i reboot after i have set WiFi, it works fine. I have tried to force both MDNS.update() and MDNS.begin(xxx) with a botton, but it dosnt work. Shouldnt the ESP restart automatically after WiFi have been set? i think that would solve it.

tablatronix commented 1 year ago

mdns stop start?

Shumatic commented 1 year ago

Hi Thers no Start stop mdns....

tablatronix commented 1 year ago

.end() sorry

Shumatic commented 1 year ago

I havent tested properly... when i set WiFi throug WiFimanager, and it reboots, i cant connect to it with IP either, i need to restart. so it isnt a MDNS problem

tablatronix commented 1 year ago

Thats strange, esp lib up to date?

Shumatic commented 1 year ago

Thats strange, esp lib up to date?

Hi, Thanks for still helping me out..... Tested some more, and it is the same, when i put in credentials, it connect and get NTPsync, but i cant connect, even throug IP . Another thing, if I put in a wrong password, and connect fails, it reboot portal, and i can correct PW, but it still dosnt work, i have to go in portal and ERASE WiFIconfig, then i can set theright PW.
All libs and esp updated and IDE is 2.1.1