I am posting a lot of code because I don't know what might be most relevant, I request anyone, please help me understand what I am doing wrong.
I have recently started learning how to use esp-idf for building IoT applications. I was trying to build an application that posts data on a webpage. I started a wifi service, and I have embedded a webpage. the webpage is supposed to allow me to send files or OTA updates, and post the data on it so I can view it. When I tried the OTA update, it worked fine.
all the ESP_LOGI functions were also working, but as soon as I made a new URI handler that is supposed to send the data to a webpage, the ESP_LOGI function inside it stopped working, even after successful installation of the handler. I am pasting multiple codes here, in the hope someone could tell me where and what to change so I successfully view the data because once I can view the data, I have other things In mind I want to post on the webpage for viewing. please know this is me trying to learn.
- #include "esp_log.h"
- #include "esp_http_server.h"
- #include "esp_ota_ops.h"
- #include "sys/param.h"
- #include "esp_timer.h"
- #include <stdbool.h>
- #include "common_tasks.h"
- #include "wifi_app.h"
- #include "http_server.h"
- #include "adcValues.h"
- static const char tag[] = "http-server";
- //firmware update status
- static int global_fw_update_status = OTA_UPDATE_PENDING;
- //ESP32 TIMER CONFIG PASSED TO ESP_TIMER_CREATE
- const esp_timer_create_args_t fw_update_reset_args = {
- .callback = &http_server_fw_update_reset_callback,
- .arg = NULL,
- .dispatch_method = ESP_TIMER_TASK,
- .name = "fw_update_reset"
- };
- esp_timer_handle_t fw_update_reset;
- //CHECK IF global_fw_update_status IS TRUE, THEN CREATE A RESET TIMER
- static void firmware_update_reset_timer(void){
- if(global_fw_update_status == OTA_UPDATE_SUCCESSFUL){
- ESP_LOGI(tag, "HTTP_SERVER_FIRMWARE_UPDATE_RESET_TIMER: FIRMWARE UPDATE SUCCESSFUL, STARTING UPDATE RESET TIMER");
- // Give the web page a chance to receive an acknowledge back and initialize the timer
- ESP_ERROR_CHECK(esp_timer_create(&fw_update_reset_args, &fw_update_reset));
- ESP_ERROR_CHECK(esp_timer_start_once(fw_update_reset, 8000000)); //8 seconds
- } else {
- ESP_LOGI(tag, "HTTP_SERVER_FIRMWARE_UPDATE_RESET_TIMER: FIRMWARE UPDATE UNSUCCESSFUL");
- }
- }
- //HTTP SERVER TASK HANDLE
- static httpd_handle_t http_server_handle = NULL;
- //SERVER MONITOR TASK AND QUEUE HANDLES
- static TaskHandle_t task_http_server_monitor_handle = NULL;
- static QueueHandle_t http_server_monitor_queue_handle;
- //In the context of your ESP-IDF project, the declarations you provided are part of a mechanism to embed binary data directly into your program at compile-time.
- //This is typically done using a tool or a script that converts binary files into C arrays.
- extern const uint8_t jquery_3_3_1_min_js_start[] asm("_binary_jquery_3_3_1_min_js_start");
- extern const uint8_t jquery_3_3_1_min_js_end[] asm("_binary_jquery_3_3_1_min_js_end");
- //jquery_3_3_1_min_js_start is a pointer that points to the beginning of the binary data for the jQuery library.
- //The asm directive gives it a specific name in memory, in this case, "_binary_jquery_3_3_1_min_js_start".
- //jquey_3_3_1_min_js_end is a pointer that points to the end of the binary data for the jQuery library.
- //Similarly, the asm directive assigns a specific name in memory, "_binary_jquery_3_3_1_min_js_end".
- //The actual values of jquery_3_3_1_min_js_start and jquery_3_3_1_min_js_end are determined by the linker script or another mechanism
- //that places the binary data into the correct memory addresses.
- //When you include these declarations in your code and build your project,
- //the linker knows where to place the binary data in memory based on the names given in the asm directive.
- //It essentially takes care of the addresses for you. So, you don't need to manually specify where one array ends and the next begins;
- //the linker handles the memory layout during the compilation process.
- extern const uint8_t index_html_start[] asm("_binary_index_html_start");
- extern const uint8_t index_html_end[] asm("_binary_index_html_end");
- extern const uint8_t app_css_start[] asm("_binary_app_css_start");
- extern const uint8_t app_css_end[] asm("_binary_app_css_end");
- extern const uint8_t app_js_start[] asm("_binary_app_js_start");
- extern const uint8_t app_js_end[] asm("_binary_app_js_end");
- extern const uint8_t favicon_ico_start[] asm("_binary_favicon_ico_start");
- extern const uint8_t favicon_ico_end[] asm("_binary_favicon_ico_end");
- static esp_err_t http_server_jquery_handler(httpd_req_t *req){
- ESP_LOGI(tag, "JQUERY REQUESTED");
- httpd_resp_set_type(req, "application/javascript");
- httpd_resp_send(req, (const char *)jquery_3_3_1_min_js_start, jquery_3_3_1_min_js_end - jquery_3_3_1_min_js_start);
- return ESP_OK;
- }
- static esp_err_t http_server_index_html_handler(httpd_req_t *req){
- ESP_LOGI(tag, "INDEX.HTML REQUESTED");
- httpd_resp_set_type(req, "text/html");
- httpd_resp_send(req, (const char *)index_html_start, index_html_end - index_html_start);
- return ESP_OK;
- }
- static esp_err_t http_server_app_css_handler(httpd_req_t *req){
- ESP_LOGI(tag, "APP.CSS REQUESTED");
- httpd_resp_set_type(req, "text/css");
- httpd_resp_send(req, (const char *)app_css_start, app_css_end - app_css_start);
- return ESP_OK;
- }
- static esp_err_t http_server_app_js_handler(httpd_req_t *req){
- ESP_LOGI(tag, "APP.JS REQUESTED");
- httpd_resp_set_type(req, "application/javascript");
- httpd_resp_send(req, (const char *)app_js_start, app_js_end - app_js_start);
- return ESP_OK;
- }
- static esp_err_t http_server_favicon_ico_handler(httpd_req_t *req){
- ESP_LOGI(tag, "FAVICON.ICO REQUESTED");
- httpd_resp_set_type(req, "image/x-icon");
- httpd_resp_send(req, (const char *)favicon_ico_start, favicon_ico_end - favicon_ico_start);
- return ESP_OK;
- }
- // static esp_err_t http_server_adc_values_handler(httpd_req_t *req){
- // char adc_val[100];
- // ESP_LOGI(tag, "ADC VALUES REQUESTED");
- // int adc_value = getValue();
- // sprintf(adc_val, "{\"Value\":%d}", adc_value);
- // httpd_resp_set_type(req, "application/json");
- // httpd_resp_send(req, adc_val, strlen(adc_val));
- // return ESP_OK;
- // }
- static esp_err_t http_server_get_dht_sensor_readings_json_handler(httpd_req_t *req)
- {
- ESP_LOGI(tag, "/dhtSensor.json requested");
- char dhtSensorJSON[100];
- sprintf(dhtSensorJSON, "{\"temp\":\"%.1f\",\"humidity\":\"%.1f\"}", 1.1, 1.1);
- httpd_resp_set_type(req, "application/json");
- httpd_resp_send(req, dhtSensorJSON, strlen(dhtSensorJSON));
- return ESP_OK;
- }
- static esp_err_t http_server_ota_update_handler(httpd_req_t *req){
- //recieves the bin files via the webpage and handles the update
- esp_ota_handle_t OTA_handle;
- char OTA_buffer[1024];
- int content_length = req->content_len;
- int content_recieved = 0;
- int recv_len;
- bool is_req_body_started = false;
- bool flash_success = false;
- const esp_partition_t *update_partition = esp_ota_get_next_update_partition(NULL);
- do{
- //read data for req.
- if((recv_len = httpd_req_recv(req, OTA_buffer, MIN(content_length, sizeof(OTA_buffer)))) < 0){
- if(recv_len == HTTPD_SOCK_ERR_TIMEOUT){
- ESP_LOGI(tag, "HTTP SERVER OTA UPDATE HANDLER: SOCKET TIMEOUT");
- continue;
- //retry recieveing if timeout occured
- }
- ESP_LOGI(tag, "OTA UPDATE HANDLER RECIEVED OTHER OTA ERROR %d", recv_len);
- return ESP_FAIL;
- }
- printf("HTTP_SERVER_OTA_UPDATE_HANDLER: OTA RX: %d of %d\r", content_recieved, content_length);
- //IF THIS IS THE FIRST DATA WE ARE RECIEVEING
- //IF SO, IT HAS THE INFO IN HEADER THAT WE NEED
- if(!is_req_body_started){
- is_req_body_started = true;
- //GETS THE LOCATION OF BIN FILE CONTENT
- //MEANS REMOVE WEB FORM DATA
- char *body_start_p = strstr(OTA_buffer, "\r\n\r\n") + 4;
- int body_part_len = recv_len - (body_start_p - OTA_buffer);
- printf("HTTP_SERVER_OTA_UPDATE_HANDLER: OTA FILE SIZE: %d\r\n", content_length);
- esp_err_t err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &OTA_handle);
- if(err != ESP_OK){
- printf("HTTP_SERVER_OTA_UPDATE_HANDLER: ERROR WITH OTA BEGIN, CANCELLING OTA\r\n");
- return ESP_FAIL;
- } else {
- printf("HTTP_SERVER_OTA_UPDATE_HANDLER: WRITING TO PARTITION SUBTYPE %d AT OFFSET 0x%lx\r\n", update_partition->subtype, update_partition->address);
- }
- //WRITE FIRST PART OF THE DATA
- esp_ota_write(OTA_handle, body_start_p, body_part_len);
- content_recieved += body_part_len;
- } else {
- //WRITE OTA DATA
- esp_ota_write(OTA_handle, OTA_buffer, recv_len);
- content_recieved += recv_len;
- }
- } while ( recv_len > 0 && content_recieved < content_length);
- if(esp_ota_end(OTA_handle) == ESP_OK){
- if(esp_ota_set_boot_partition(update_partition) == ESP_OK){
- const esp_partition_t *boot_partition = esp_ota_get_boot_partition();
- ESP_LOGI(tag, "HTTP_SERVER_OTA_UPDATE_HANDLER; NEXT BOOT Next BOOT PARTITION SUBTYPE %d AT OFFSET 0x%lx", boot_partition->subtype, boot_partition->address);
- flash_success = true;
- } else {
- ESP_LOGI(tag, "HTTP_SERVER_OTA_UPDATE_HANDLER: FLASHED ERROR!!!");
- }
- } else {
- ESP_LOGI(tag, "HTTP_SERVER_OTA_UPDATE_HANDLER: esp_ota_end ERROR!!!");
- }
- //WE WONT UPDATE GLOBAL VARIABLES THROUGHOUT THE FILE
- if(flash_success) http_monitor_msg(HTTP_MSG_OTA_UPDATE_PASS);
- else http_monitor_msg(HTTP_MSG_OTA_UPDATE_FAIL);
- return ESP_OK;
- }
- //OTA status handler responds with the firmware update status after the OTA update is started
- //and responds with the compile time/date when the page is first requested
- static esp_err_t http_server_ota_status_handler(httpd_req_t *req){
- char OTA_JSON_BUFF[100];
- ESP_LOGI(tag, "OTA STATUS REQUESTED");
- sprintf(OTA_JSON_BUFF, "\"ota_update_status\":%d,\"COMPILE_TIME\":\"%s\",\"COMPILE_DATE\":\"%s\"}", global_fw_update_status, __TIME__, __DATE__);
- httpd_resp_set_type(req, "application/json");
- httpd_resp_send(req, OTA_JSON_BUFF, strlen(OTA_JSON_BUFF));
- return ESP_OK;
- }
- static void http_server_monitor(void *pvParameters){
- //used to track events of http server
- http_server_queue_msg_t message;
- //infinite loop means the task will go on infinitely
- for(;;){
- if(xQueueReceive(http_server_monitor_queue_handle, &message, portMAX_DELAY)){
- switch(message.msgID){
- case HTTP_MSG_WIFI_CONN_INIT:
- ESP_LOGI(tag, "HTTP_MSG_WIFI_CONN_INIT");
- break;
- case HTTP_MSG_WIFI_CONN_SUCCESS:
- ESP_LOGI(tag, "HTTP_MSG_WIFI_CONN_SUCCESS");
- break;
- case HTTP_MSG_WIFI_CONN_FAIL:
- ESP_LOGI(tag, "HTTP_MSG_WIFI_CONN_FAIL");
- break;
- case HTTP_MSG_OTA_UPDATE_PASS:
- ESP_LOGI(tag, "HTTP_MSG_OTA_UPDATE_PASS");
- global_fw_update_status = OTA_UPDATE_SUCCESSFUL;
- firmware_update_reset_timer();
- break;
- case HTTP_MSG_OTA_UPDATE_FAIL:
- ESP_LOGI(tag, "HTTP_MSG_OTA_UPDATE_FAIL");
- global_fw_update_status = OTA_UPDATE_FAIL;
- break;
- default:
- break;
- }
- }
- }
- }
- static httpd_handle_t http_server_configure(void){
- httpd_config_t http_config = HTTPD_DEFAULT_CONFIG();
- http_server_monitor_queue_handle = xQueueCreate(5, sizeof(http_server_queue_msg_t));
- xTaskCreatePinnedToCore(&http_server_monitor, "HTTP SERVER MONITOR", HTTP_SERVER_MONITOR_STACK_SIZE, NULL, HTTP_SERVER_MONITOR_STACK_SIZE, &task_http_server_monitor_handle, HTTP_SERVER_MONITOR_CORE_ID);
- //update vertain values
- http_config.core_id = HTTP_SERVER_CORE_ID;
- http_config.task_priority = HTTP_SERVER_TASK_PRIORITY;
- http_config.stack_size = HTTP_SERVER_TASK_STACK_SIZE;
- http_config.max_uri_handlers = 100;
- http_config.recv_wait_timeout = 10;
- http_config.recv_wait_timeout = 10;
- ESP_LOGI(tag, "HTTP_SERVER_CONFIGURE : STARTING SERVER ON PORT: '%d' WITH TASK PRIORITY : '%d'" , http_config.server_port, http_config.task_priority);
- if(httpd_start(&http_server_handle, &http_config) == ESP_OK){
- httpd_uri_t jquery_js = {
- .uri = "/jquery-3.3.1.min.js",
- .method = HTTP_GET,
- .handler = http_server_jquery_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &jquery_js);
- httpd_uri_t index_html = {
- .uri = "/",
- .method = HTTP_GET,
- .handler = http_server_index_html_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &index_html);
- httpd_uri_t app_css = {
- .uri = "/app.css",
- .method = HTTP_GET,
- .handler = http_server_app_css_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &app_css);
- httpd_uri_t app_js = {
- .uri = "/app.js",
- .method = HTTP_GET,
- .handler = http_server_app_js_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &app_js);
- httpd_uri_t favicon_ico = {
- .uri = "/favicon.ico",
- .method = HTTP_GET,
- .handler = http_server_favicon_ico_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &favicon_ico);
- httpd_uri_t OTA_update = {
- .uri = "/OTAupdate",
- .method = HTTP_POST,
- .handler = http_server_ota_update_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &OTA_update);
- httpd_uri_t OTA_status = {
- .uri = "/OTAstatus",
- .method = HTTP_POST,
- .handler = http_server_ota_status_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &OTA_status);
- // httpd_uri_t ADC_Values = {
- // .uri = "/adcValues.json",
- // .method = HTTP_POST,
- // .handler = http_server_adc_values_handler,
- // .user_ctx = NULL
- // };
- // httpd_register_uri_handler(http_server_handle, &ADC_Values);
- httpd_uri_t dht_sensor_json = {
- .uri = "/dhtSensor.json",
- .method = HTTP_GET,
- .handler = http_server_get_dht_sensor_readings_json_handler,
- .user_ctx = NULL
- };
- httpd_register_uri_handler(http_server_handle, &dht_sensor_json);
- ESP_LOGI(tag, "REGISTERING URI HANDLERS");
- return http_server_handle;
- }
- return NULL;
- }
- void start_http_server(void){
- if(http_server_handle == NULL) http_server_handle = http_server_configure();
- }
- void stop_http_server(void){
- esp_log_level_set("HTTP", ESP_LOG_VERBOSE);
- if(http_server_handle){
- httpd_stop(http_server_handle);
- ESP_LOGI(tag, "HTTP_SERVER_STOP ; Stopping HTTP server");
- http_server_handle = NULL;
- }
- if(task_http_server_monitor_handle){
- vTaskDelete(task_http_server_monitor_handle);
- ESP_LOGI(tag, "STOPPING HTTP SERVER");
- task_http_server_monitor_handle = NULL;
- }
- }
- BaseType_t http_monitor_msg(http_server_msg_e msgID){
- http_server_queue_msg_t msg;
- msg.msgID = msgID;
- return xQueueSend(http_server_monitor_queue_handle, &msg, portMAX_DELAY);
- }
- void http_server_fw_update_reset_callback(void *args){
- ESP_LOGI(tag, "HTTP_SERVER_FIRMWARE_UPDATE_RESET_TIMER: TIMER TIMED OUT, RESTARTING DEVICE");
- esp_restart();
- }
this is my app.js file, which is using jquery -
- /**
- * Initialize functions here.
- */
- $(document).ready(function(){
- getUpdateStatus();
- startDHTSensorInterval();
- });
- ................
- function getDHTSensorValues()
- {
- $.getJSON('/dhtSensor.json', function(data) {
- $("#temperature_reading").text(data["temp"]);
- $("#humidity_reading").text(data["humidity"]);
- });
- }
- function startDHTSensorInterval()
- {
- setInterval(getDHTSensorValues, 5000);
- }
this is my HTML div for reference -
- <div id="DHT22Sensor">
- <h2>DHT22 Sensor Readings</h2>
- <label for="temperature_reading">Temperature: </label>
- <div id="temperature_reading"></div>
- <label for="humidity_reading">Humidity: </label>
- <div id="humidity_reading"></div>
- </div>
- <hr>
does not initialize of even if it does, the handler doesn't seem to work, as the ESP_LOGI statement doest get logged or is stopping or is blocking i don't know.?
this is my terminal output -
Code: Select all
I (3016) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.0.1
D (3016) esp_netif_lwip: check: local, if=0x3ffc6b30 fn=0x400f6268
0x400f6268: esp_netif_update_default_netif_lwip at D:/ESP_IDF/v5.1.2/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:327
D (3026) esp_netif_lwip: esp_netif_update_default_netif_lwip 0x3ffc6b30
V (3036) esp_netif_lwip: esp_netif_is_netif_up esp_netif:0x3ffc6b30
D (3036) esp_netif_lwip: call api in lwip: ret=0x0, give sem
D (3046) event: no handlers have been registered for event ESP_HTTP_SERVER_EVENT:1 posted to loop 0x3ffbc5d0
D (3056) httpd_uri: httpd_register_uri_handler: [0] exists /jquery-3.3.1.min.js
D (3066) httpd_uri: httpd_register_uri_handler: [1] installed /
D (3066) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.3.1.min.js
D (3076) httpd_uri: httpd_find_uri_handler: [1] = /
D (3076) httpd_uri: httpd_register_uri_handler: [0] exists /jquery-3.3.1.min.js
D (3086) httpd_uri: httpd_register_uri_handler: [1] exists /
D (3096) httpd_uri: httpd_register_uri_handler: [2] installed /app.css
D (3096) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.3.1.min.js
D (3106) httpd_uri: httpd_find_uri_handler: [1] = /
D (3106) httpd_uri: httpd_find_uri_handler: [2] = /app.css
D (3116) httpd_uri: httpd_register_uri_handler: [0] exists /jquery-3.3.1.min.js
D (3126) httpd_uri: httpd_register_uri_handler: [1] exists /
D (3126) httpd_uri: httpd_register_uri_handler: [2] exists /app.css
D (3136) httpd_uri: httpd_register_uri_handler: [3] installed /app.js
D (3146) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.3.1.min.js
D (3146) httpd_uri: httpd_find_uri_handler: [1] = /
D (3156) httpd_uri: httpd_find_uri_handler: [2] = /app.css
D (3156) httpd_uri: httpd_find_uri_handler: [3] = /app.js
D (3166) httpd_uri: httpd_register_uri_handler: [0] exists /jquery-3.3.1.min.js
D (3176) httpd_uri: httpd_register_uri_handler: [1] exists /
D (3176) httpd_uri: httpd_register_uri_handler: [2] exists /app.css
D (3186) httpd_uri: httpd_register_uri_handler: [3] exists /app.js
D (3186) httpd_uri: httpd_register_uri_handler: [4] installed /favicon.ico
D (3196) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.3.1.min.js
D (3206) httpd_uri: httpd_find_uri_handler: [1] = /
D (3206) httpd_uri: httpd_find_uri_handler: [2] = /app.css
D (3216) httpd_uri: httpd_find_uri_handler: [3] = /app.js
D (3216) httpd_uri: httpd_find_uri_handler: [4] = /favicon.ico
D (3226) httpd_uri: httpd_register_uri_handler: [0] exists /jquery-3.3.1.min.js
D (3236) httpd_uri: httpd_register_uri_handler: [1] exists /
D (3236) httpd_uri: httpd_register_uri_handler: [2] exists /app.css
D (3246) httpd_uri: httpd_register_uri_handler: [3] exists /app.js
D (3246) httpd_uri: httpd_register_uri_handler: [4] exists /favicon.ico
D (3256) httpd_uri: httpd_register_uri_handler: [5] installed /OTAupdate
D (3266) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.3.1.min.js
D (3266) httpd_uri: httpd_find_uri_handler: [1] = /
D (3276) httpd_uri: httpd_find_uri_handler: [2] = /app.css
D (3286) httpd_uri: httpd_find_uri_handler: [3] = /app.js
D (3286) httpd_uri: httpd_find_uri_handler: [4] = /favicon.ico
D (3296) httpd_uri: httpd_find_uri_handler: [5] = /OTAupdate
D (3296) httpd_uri: httpd_register_uri_handler: [0] exists /jquery-3.3.1.min.js
D (3306) httpd_uri: httpd_register_uri_handler: [1] exists /
D (3316) httpd_uri: httpd_register_uri_handler: [2] exists /app.css
D (3316) httpd_uri: httpd_register_uri_handler: [3] exists /app.js
D (3326) httpd_uri: httpd_register_uri_handler: [4] exists /favicon.ico
D (3326) httpd_uri: httpd_register_uri_handler: [5] exists /OTAupdate
D (3336) httpd_uri: httpd_register_uri_handler: [6] installed /OTAstatus
D (3346) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.3.1.min.js
D (3346) httpd_uri: httpd_find_uri_handler: [1] = /
D (3356) httpd_uri: httpd_find_uri_handler: [2] = /app.css
D (3366) httpd_uri: httpd_find_uri_handler: [3] = /app.js
D (3366) httpd_uri: httpd_find_uri_handler: [4] = /favicon.ico
D (3376) httpd_uri: httpd_find_uri_handler: [5] = /OTAupdate
D (3376) httpd_uri: httpd_find_uri_handler: [6] = /OTAstatus
D (3386) httpd_uri: httpd_register_uri_handler: [0] exists /jquery-3.3.1.min.js
D (3396) httpd_uri: httpd_register_uri_handler: [1] exists /
D (3396) httpd_uri: httpd_register_uri_handler: [2] exists /app.css
D (3406) httpd_uri: httpd_register_uri_handler: [3] exists /app.js
D (3406) httpd_uri: httpd_register_uri_handler: [4] exists /favicon.ico
D (3416) httpd_uri: httpd_register_uri_handler: [5] exists /OTAupdate
D (3426) httpd_uri: httpd_register_uri_handler: [6] exists /OTAstatus
D (3426) httpd_uri: httpd_register_uri_handler: [7] installed /dhtSensor.json
I (3436) http-server: REGISTERING URI HANDLERS
D (2896) httpd: httpd_thread: web server started
D (3446) httpd: httpd_server: doing select maxfd+1 = 56
Code: Select all
D (117286) wifi:join success bss=0x3ffb962c, ap send assoc response
D (117346) event: running post WIFI_EVENT:14 with handler 0x400d7c00 and context 0x3ffbd51c on loop 0x3ffbc5d0
0x400d7c00: wifi_app_event_handler at D:/test_projects/LEDs/main/wifi_app.c:38
I (117346) wifi-app: WIFI_EVENT_AP_STACONNECTED
D (118636) esp_netif_lwip: esp_netif_dhcps_cb esp_netif:0x3ffc6b30
I (118636) esp_netif_lwip: DHCP server assigned IP to a client, IP is: 192.168.0.2
D (118636) esp_netif_lwip: Client's MAC: 6e:ff:73:89:3:7d
D (118646) event: running post IP_EVENT:2 with handler 0x400d7c00 and context 0x3ffbd550 on loop 0x3ffbc5d0
0x400d7c00: wifi_app_event_handler at D:/test_projects/LEDs/main/wifi_app.c:38
I (120716) wifi:<ba-add>idx:2 (ifx:1, 6e:ff:73:89:03:7d), tid:0, ssn:2, winSize:64
I (125026) wifi:<ba-add>idx:3 (ifx:1, 6e:ff:73:89:03:7d), tid:1, ssn:0, winSize:64
I (125256) wifi:<ba-add>idx:4 (ifx:1, 6e:ff:73:89:03:7d), tid:5, ssn:0, winSize:64
Code: Select all
.............
D (161276) httpd_parse: cb_on_body: body begins
D (161276) httpd_parse: httpd_parse_req: parsing complete
D (161286) httpd_uri: httpd_uri: request for /OTAstatus with type 3
D (161286) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.3.1.min.js
D (161296) httpd_uri: httpd_find_uri_handler: [1] = /
D (161296) httpd_uri: httpd_find_uri_handler: [2] = /app.css
D (161306) httpd_uri: httpd_find_uri_handler: [3] = /app.js
D (161316) httpd_uri: httpd_find_uri_handler: [4] = /favicon.ico
D (161316) httpd_uri: httpd_find_uri_handler: [5] = /OTAupdate
D (161326) httpd_uri: httpd_find_uri_handler: [6] = /OTAstatus
I (161326) http-server: OTA STATUS REQUESTED
D (161336) httpd_txrx: httpd_send_all: sent = 69
D (161336) httpd_txrx: httpd_send_all: sent = 2
D (161346) event: no handlers have been registered for event ESP_HTTP_SERVER_EVENT:4 posted to loop 0x3ffbc5d0
D (161356) httpd_txrx: httpd_send_all: sent = 77
D (161356) event: no handlers have been registered for event ESP_HTTP_SERVER_EVENT:6 posted to loop 0x3ffbc5d0
D (161366) httpd_sess: httpd_sess_process: httpd_req_delete
D (161376) httpd_txrx: httpd_req_recv: remaining length = 17
D (161376) httpd_txrx: httpd_recv_with_opt: requested length = 17
D (161386) httpd_txrx: httpd_recv_with_opt: pending length = 17
D (161396) httpd_txrx: httpd_req_recv: received length = 17
D (161396) event: no handlers have been registered for event ESP_HTTP_SERVER_EVENT:5 posted to loop 0x3ffbc5d0
D (161406) httpd_parse: httpd_req_delete: purging data size : 17 bytes
D (161416) httpd_sess: httpd_sess_process: success
D (161416) httpd: httpd_server: doing select maxfd+1 = 60
D (191406) httpd: httpd_process_session: processing socket 57
D (191406) httpd_sess: httpd_sess_process: httpd_req_new
D (191406) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (191406) httpd_txrx: httpd_recv_with_opt: received length = 0
D (191416) httpd_parse: read_block: connection closed
D (191416) httpd_sess: httpd_sess_delete: fd = 57
D (191426) event: no handlers have been registered for event ESP_HTTP_SERVER_EVENT:7 posted to loop 0x3ffbc5d0
D (191436) httpd_sess: httpd_sess_delete: active sockets: 2
D (191446) httpd: httpd_server: doing select maxfd+1 = 60
D (191446) httpd: httpd_process_session: processing socket 58
D (191456) httpd_sess: httpd_sess_process: httpd_req_new
D (191456) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (191466) httpd_txrx: httpd_recv_with_opt: received length = 0
D (191466) httpd_parse: read_block: connection closed
D (191476) httpd_sess: httpd_sess_delete: fd = 58
D (191486) event: no handlers have been registered for event ESP_HTTP_SERVER_EVENT:7 posted to loop 0x3ffbc5d0
D (191486) httpd_sess: httpd_sess_delete: active sockets: 1
D (191496) httpd: httpd_process_session: processing socket 59
D (191506) httpd_sess: httpd_sess_process: httpd_req_new
D (191506) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (191516) httpd_txrx: httpd_recv_with_opt: received length = 0
D (191516) httpd_parse: read_block: connection closed
D (191526) httpd_sess: httpd_sess_delete: fd = 59
D (191536) event: no handlers have been registered for event ESP_HTTP_SERVER_EVENT:7 posted to loop 0x3ffbc5d0
D (191536) httpd_sess: httpd_sess_delete: active sockets: 0
D (191546) httpd: httpd_server: doing select maxfd+1 = 56
I do not know where the program is getting stuck or why is it happening, please help me.