Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Using IotWebConf on esp32 with esp_http_server.h already included #148

Closed
jameszah opened this issue Nov 29, 2020 · 3 comments
Closed

Using IotWebConf on esp32 with esp_http_server.h already included #148

jameszah opened this issue Nov 29, 2020 · 3 comments

Comments

@jameszah
Copy link

HI, I tried to add IotWebConf to a program that already had esp_http_server installed for http, ftp, WiFiClientSecure, ... and ran into a few problems. I think the WebServer.h for esp32 is a different version of the http services than you get in esp_http_server.h.

Wondering if anyone has tackled this conversion?

Other issues:

  1. I see you use the eeprom starting at position 0, which is logical as I was already using that position. In my code I can move it, but a #defne to move it in this library might be nice.

  2. Had to dig through the code to figure out this "#" feature, after you have set it up on 192.168.4.1 with your name/password for your wifi router, and the name/password for your esp32 for the next time you try to configure it. It all set up fine at 192.168.4.1, and connected to my router, but then I tried to connect to it again through my router, and my computer connect fine to the esp32, but then it gives this "#" name/password question. Which is not the name/password you just gave it, But the name "admin" and the password you just gave it. You could put that into the example program comments. 😄

I'll update this question, when do the switch from WebServer.h --> esp_http_server.h

@jameszah
Copy link
Author

jameszah commented Nov 29, 2020

Maybe this does it -- just have to figure out how to grab a pull-request:
I don't think it is already there -- I cannot find #define IOTWEBCONF_CONFIG_USE_ASYNC

#142 (comment)

And this I think is the answer to my question #1

// -- We might want to place the config in the EEPROM in an offset.
#ifndef IOTWEBCONF_CONFIG_START
#define IOTWEBCONF_CONFIG_START 0
#endif

@jameszah
Copy link
Author

jameszah commented Dec 9, 2020

Howdy, made a little progress on this.

First, I discovered how to find a pull request, just follow the fork and its mods to https://github.com/h2zero/IotWebConf/tree/async

But it solves a different problem.

My problem was using the object WebServer defined in WebServer.h and at the same time trying to use the basic esp_http_server.h functions. There is a big feud between the code about who owns the symbol HTTP_GET, which is "1", but the compiler (arduino IDE 1.8.12) cannot resolve the feud. I wrote up my partial solution below, but I still have a problem of the WebServer.h taking control of the network, and preventing the web, ftp, etc functions I was already using to run as before.

jameszah/ESP32-CAM-Video-Recorder#35 (comment)

@jameszah
Copy link
Author

jameszah commented Dec 10, 2020

So, looking back at my problem here, it is clear that you cannot have two different bits of software running the web.

I was using the esp_http_server.h calls, such as:

httpd_handle_t camera_httpd = NULL;
httpd_start(&camera_httpd, &config), 
httpd_register_uri_handler(camera_httpd, &index_uri), 
httpd_resp_send

And this uses WebServer.h calls such as:

 WebServer server(80);
 server.on("/wifi", []{ iotWebConf.handleConfig(); });
  this->_server->sendHeader("Content-Length", String(message.length()));
  this->_server->send(404, "text/plain", message);

So I could do a big fork and merge all the IotWebConf stuff into the httpd_ style of calls and it could run in parallel with all the other web stuff I have in my program.

So I'll close this. -- not done, but confusion resolved. 😄

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant