ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By kisesp
#3720 Hello @Sprite_tm, thanks for sharing your code.

Downloaded your code and find some bugs.
The mkespfsimage main.c have a small bug on compressHeatshrink(), the len declared int but must be "size_t len", else causing Segmentation fault for me when try to generate the image(if select c 0 (no compression, then works!))

After flash images to esp everything works as expected but the wifiscan do not find any AP-s.
If I reflash the 0.20 AT firmware and do scan then list all AP-s, I can join too, setting sta and give ssid an pass.
Now if I flash again the esp-httpd firmware (but not erase the config 0x7e000) the module automatically connect to my AP, now connecting to esp the wifiscan working and show all AP-s.
If I do again and leave the firmware on AP mode then again no AP-s found.
I'm using SDK 0.9.3
Any idea?

Thanks.
User avatar
By Sprite_tm
#3797 Yes, someone pointed out the size_t bug to me too. I've fixed it in the version I have here, but I'm also trying to make the WiFi logic a bit more sturdy and port the webserver to 0.9.3. Still need some more time to work all that out and then I'll release it again.
User avatar
By gerardwr
#3798
Sprite_tm wrote:Yes, someone pointed out the size_t bug to me too. I've fixed it in the version I have here, but I'm also trying to make the WiFi logic a bit more sturdy and port the webserver to 0.9.3. Still need some more time to work all that out and then I'll release it again.


Very interesting development, but still a little too complex for me to join the fun here. It inspired me to create my own webserver.

[Shameless advertising mode ON]
In the meantime I created a webserver in Lua with the nodeMcu firmware. It has an added "bonus" that it supports multiple html files, even server-side Lua code (analog to embedded PHP code) in the HTML files. The nodeMcu is closed source BTW, that's a bummer!

Why not have a look in my (longish) topic , for some inspiration:
viewtopic.php?f=19&t=611
[Shameless advertising mode OFF]

Kudo's to sprite_tm for his trendsetting open source developments!
User avatar
By kisesp
#3829 [Off topic start]
I don't like that lua because:
1.closed source (nobody know what inside) I can't add any low level io functions
2.Slow (compared to native code)
So I will not even try that lua until closed.
[Off topic end]

I checked the AT source and find at cwlap(scan):
Code: Select allif(at_wifiMode == SOFTAP_MODE)
   {
   at_backError;
   return;
}

So probably the esp can't scan if in softap mode.Two options remaining 1.scan before start the server (at user main) and list that on scan.cgi 2. when scancgi start switch to sta mode then scan and switch back and return the results.
I think the 1. option the good choice because if somebody want to use always in softap mode no reason to check the AP-s list, if need the sta mode it's need only once, when do config-s.

How variable parse work? I not really understand %counter% and cgi callback.
I want to add variable parse inside html like %led1% but in any html, I think something global struct variable with name and options, then if found %var% then search at struct and replace with value, or trigger a function to execute and return the value.

Thanks.