ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By dzindra
#13231 @Sprite_tm really awesome work, I definitely owe you a beer ;)

I cleaned up the project a bit to learn how things work - basically grouped files into chunks that are closely related (espfs, httpd and user parts), fixed bug in heatshrink decompressor and moved around few #includes. You can check it at https://github.com/dzindra/esphttpd

Is there a reason for using binary esptool instead of python esptool?
User avatar
By prozac
#13319
Sprite_tm wrote:Agreed. I poked admin to see if this is possible.


Tee hee, I poked them as well. Wonder how many of us did :lol:

Anyways, I know I have been talking about it without putting much up, but here is my code:
https://github.com/billprozac/esphttpd

So, I updated the readme so most of the info is clear, but there are some key things to take away:
1. This uses esptool.py instead of the binary version. This actually allows the non-OTA flashes to flash in one command with no resets inbetween
2. there are more options in the Makefile for things like the SDK version and bootloader type. Unfortunately, unless we decide to depricate bootloaders, there are going to have to be a bunch of extra things. All you need to do, however, is know that for SDKs > 1.0.0, they want you to use the new bootloaders 1.2 or 1.3b3, so set ESP_BOOT_VER=new. If you want to use 1.1, set it to old (but make sure there is a copy in your SDK bin folder.
3. There is support in the Makefile for switching between SDKs. Just change place all of your sdk folders (esp_iot_sdk_vX.X.X)in the same base path and set SDK_VERSION in the Makefile.
4. I added two new variables/declarations APP_NAME and APP_VERSION so individuals can set these to prevent confusion with folks asking for support. I know it has been tough when people ask for support and they are using some strage derivitive. Please display this on whatever main page you display. See mine for an example.
5. Bad form, but I committed the commenting out of includes that were causing all of those int32 errors. Should mostly compile straight out of the box.

I am sure there is more, but I will let people play with this first.



@Sprite_tm: Please feel free to incorporate as much or as little upstream. I don't want to maintain a fork, but I understand if you don't want to take on any more either.
User avatar
By bjpirt
#13325 Maybe the mods will create a new section before we reach page 30. Ah well, at least @sprite_tm gets the kudos from creating the board's longest thread :-)

@prozac that approach is genius! I'd been banging my head against trying to dedicate a partition to the espfs image at the same time as both firmware sectors and hadn't thought about just using the second one for espfs and reflashing it at firmware upgrade time. I think I'd been worried that if an update failed you might be left without the ability to try again, but realised that was an error in my thinking, because if the update fails then it's probably not going to be serving out web pages anyway. I think I'm still going to put a rescue webpage in the firmware (not in espfs) just in case and I might auto-redirect to this in case the espfs image isn't there. I'm building a product that has to deal with less technical users (http://mirobot.io) so I need some kind of fallback that doesn't rely on them being able to reflash over serial. It would be nice if the bootloader supported some kind of rollback if the new firmware doesn't work, but that might be asking too much.

I've looked through your repo and like the look of your mods. @sprite_tm - what are your thoughts on merging this in? Obviously we'd need to create a branch which isolates just these changes and I'm happy to do that with @prozac if you'd like?

@dzindra I think your reorganisation makes a lot of sense. As someone who is using esp-httpd as a library, it would be nice to be able to isolate some of the components so I can just put one folder in the search path and not the whole user directory. It would also be nice if we could configure, for example, whether we want to use auth or not via a define so we can compile esp-httpd as a library appropriately.

@sprite_tm you've created a great project here - thank you! It looks like you'll be getting a bunch of users looking to help with development so it would be good to get some guidance from you as to how best to contribute. Are you looking for patches to be emailed or to set up the repository on github so you can discuss and accept pull requests or something else? If it were on GitHub you'd be able to share the load a bit because I'd be happy to check over any incoming code and comment, etc. and I'm sure @prozac would help out too. Up to you of course.

Cheers,
Ben