gmag11 / FSBrowserNG

Full autocontained (on SPIFFS) async web server on ESP8266. Written as a Library.
Other
158 stars 70 forks source link

callback_example upload is fine but it gets a reset after GotIp address #56

Closed pvdw0310 closed 5 years ago

pvdw0310 commented 6 years ago

Hi, I like to test the callback example and it compiles well and the upload to a esp8266-12F works fine. I start the esp to config, that works also. But then I see on the serial monitor the connection to the router and it shows the GotIp Address 192.168.1.5 like I have set it in the config. Then it dumps and reset esp. That goes on and on. Do you have a advice what I did wrong? Thanks Peter

species5618 commented 6 years ago

try a few things, if you are pre seting the config,json in the data folder set the NTP interval to 0 and make sure the device name is less than 8 chars I have been looking into a problem which caused the IP stack to crash, if NTP is enable and the device name is more than 8 chars (mDNS)

or don't upload the config,json, and let it create its own

pvdw0310 commented 6 years ago

Indeed, the device name was esp8266test and longer then 8 chars. Thats not a big problem. The NTP I like to use. Is there a way to fix that? I use a painlessmesh-network for my home domotica and use Ntp to set the time om my touchscreen. Thanks Peter

species5618 commented 6 years ago

With a shorter device name NOT should would. But may need 2 resets after initials code upload Again something in the Wi-Fi/ IP code i need to understand

rvangijlswijk commented 6 years ago

I believe I have the same issue. In my case, the device name is the default one ("ESP8266fs") which is indeed 9 characters long.

I did not pre-include a config.json file. I was able to start the ESP in AP mode without a problem, and I configured the WiFi settings over the web interface. Then, I restarted the ESP, and it connects to my WiFi network. Afterwards, a core dump occurs and the ESP reboots again and again. The following exception occurs:

Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x40104b0c, epc2=0x00000000, epc3=0x4024aa57, excvaddr=0x00000003, depc=0x00000000

Exception (9):
epc1=0x40104b0c epc2=0x00000000 epc3=0x4024aa57 excvaddr=0x00000003 depc=0x00000000

ctx: sys
sp: 3fffead0 end: 3fffffb0 offset: 01a0

Here is the complete Serial output, in case it may help: https://pastebin.com/n2LA6SvV. @pvdw0310 do you get a similar stack dump?

pvdw0310 commented 6 years ago

@rvangijlswijk I stopt working with the call_back example and use only the start_here for the moment. I'am still looking for some other possibilities to use ntp time and setup config website and I like to add a website page that shows some variables( they change often) which are provided by the serial input. I thought to do it with the call_back example .But I don't understand the software behind it. Do you have an idea if there is some alternatief? Let me know. Thanks

species5618 commented 6 years ago

I am struggling for time at the moment

However I have a project running on this library with a 5 char device name and ntp enabled Which stayed online for 5+ days

I am still planning to investigate But is seem to be a problem deep in the core code

pvdw0310 commented 6 years ago

@species5618 I appreciate your effort. I hope you can solve the problem. I don't understand the code behind, so for me it is hard to help. If you can send me already what you have, so I can test it out in the meantime. Let me know what you need to send me the code.

rvangijlswijk commented 6 years ago

I noticed that everything runs stable when using 0 as refresh rate for NTP (effectively disables it). I could use a device name with more than 8 characters without a problem I'm currently using the following config:

{"ssid":"xxx",
"pass":"xxx",
"ip":[192,168,1,4],
"netmask":[255,255,255,0],
"gateway":[192,168,1,1],
"dns":[192,168,1,1],
"dhcp":true,
"ntp":"pool.ntp.org","NTPperiod":0,"timeZone":10,"daylight":true,
"deviceName":"ESP8266fs"}

As you can see, the device name is 9 characters long, and NTPperiod 0. This config runs stable for me.

@species5618 Once I get the chance, I'll help you out with debugging. I have some ideas that I want to try to see if they solve the problem.

@pvdw0310 what you can do, is disable the NTPperiod, and use a different NTP library for the meantime. The NTP library used by this lib is "NTPClient" from the same author, but there are others available. So maybe you can manually implement a different ntp lib in your main .ino code.

species5618 commented 6 years ago

Re debug I got as far as enabling all the debug in NTP client And the crash occurs immediately after the UDP time request is sent

So I believe it a lwip problem / mdns I was about to try disabling mdns as I don't use it (That is the main use for the device name , as far as I can tell) when I got dragged onto a non IT problem taking my spare time

pvdw0310 commented 6 years ago

Hi, Back again. I like to change the starthere without the callback routine and nothing is working any more like before. Before I could use the NTP service, after the last update it stoped working. Can you put the old version back? thank

flurl commented 6 years ago

I think, it's just a coincidence that the crash is related to the UDP request. You can try using different delays in AsyncFSWebServer::onWiFiConnectedGotIP() and it will crash without even calling something NTP related. My guess is, that it's just taking to much time in a callback, as in any case I tried the program counter pointed to _ets_timersetfn. Sounds like something related to timing. Perhaps you could try my fix where I just set a flag in the callback and update the time in AsyncFSWebServer::handle() See https://github.com/flurl/FSBrowserNG/commit/904284a4aefdad81c7031e6b109bd4f8250e3e32 This way it works for me, though I have no idea, why it might be related to the device name