fine tuning of httpd implementation

This commit is contained in:
Sebastien
2020-02-13 16:22:51 -05:00
parent fb2e1884f5
commit b80faf911a
14 changed files with 12 additions and 21 deletions

View File

@@ -6,7 +6,7 @@
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdio.h>
#include "cmd_i2ctools.h"
#include "argtable3/argtable3.h"

View File

@@ -1,7 +1,7 @@
#
# Main Makefile. This is basically the same as a component makefile.
#
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG \
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO \
-I$(COMPONENT_PATH)/../tools
COMPONENT_ADD_INCLUDEDIRS := .
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools

View File

@@ -6,7 +6,7 @@
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -6,7 +6,7 @@
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#define LOG_LOCAL_LEVEL ESP_LOG_INFO
#include <stdio.h>
#include <string.h>
#include <ctype.h>

View File

@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
#include "config.h"
#include "nvs_utilities.h"

View File

@@ -1,4 +1,3 @@
//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
#include "nvs_utilities.h"
#include <stdio.h>

View File

@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

View File

@@ -9,5 +9,5 @@ COMPONENT_ADD_INCLUDEDIRS += include
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/main/
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/components/tools
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO -DCONFIG_OTA_ALLOW_HTTP=1
#CFLAGS += -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCONFIG_OTA_ALLOW_HTTP=1

View File

@@ -6,9 +6,6 @@
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#ifndef LOG_LOCAL_LEVEL
#define LOG_LOCAL_LEVEL ESP_LOG_INFO
#endif
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"

View File

@@ -8,8 +8,7 @@
#
COMPONENT_EMBED_FILES := style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz
#CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG \
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO \
-I$(COMPONENT_PATH)/../tools
COMPONENT_ADD_INCLUDEDIRS := .
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools

View File

@@ -254,7 +254,7 @@ session_context_t* get_session_context(httpd_req_t *req){
}
session_context_t *ctx_data = (session_context_t*)req->sess_ctx;
ctx_data->sess_ip_address = http_alloc_get_socket_address(req, 0, &ctx_data->port);
ESP_LOGI_LOC(TAG, "serving %s to peer %s port %u", req->uri, ctx_data->sess_ip_address , ctx_data->port);
ESP_LOGD_LOC(TAG, "serving %s to peer %s port %u", req->uri, ctx_data->sess_ip_address , ctx_data->port);
return (session_context_t *)req->sess_ctx;
}
@@ -382,7 +382,7 @@ esp_err_t root_get_handler(httpd_req_t *req){
esp_err_t resource_filehandler(httpd_req_t *req){
char filepath[FILE_PATH_MAX];
ESP_LOGI_LOC(TAG, "serving [%s]", req->uri);
ESP_LOGD_LOC(TAG, "serving [%s]", req->uri);
const char *filename = get_path_from_uri(filepath, req->uri, sizeof(filepath));
@@ -437,7 +437,7 @@ esp_err_t resource_filehandler(httpd_req_t *req){
httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "File does not exist");
return ESP_FAIL;
}
ESP_LOGI_LOC(TAG, "Resource sending complete");
ESP_LOGD_LOC(TAG, "Resource sending complete");
return ESP_OK;
}
@@ -589,7 +589,7 @@ esp_err_t config_post_handler(httpd_req_t *req){
err = ESP_FAIL;
}
if(err == ESP_OK){
ESP_LOGI_LOC(TAG,"Found config value name [%s]", prev_item->string);
ESP_LOGD_LOC(TAG,"Found config value name [%s]", prev_item->string);
nvs_type_t item_type= config_get_item_type(prev_item);
if(item_type!=0){
void * val = config_safe_alloc_get_entry_value(item_type, prev_item);
@@ -614,7 +614,7 @@ esp_err_t config_post_handler(httpd_req_t *req){
err = ESP_FAIL;
}
else {
ESP_LOGI_LOC(TAG,"Successfully set value for [%s]",prev_item->string);
ESP_LOGD_LOC(TAG,"Successfully set value for [%s]",prev_item->string);
}
}
free(val);

View File

@@ -60,7 +60,6 @@ function to process requests, decode URLs, serve files, etc. etc.
#include "lwip/priv/tcp_priv.h"
#include "lwip/priv/tcpip_priv.h"
#include "esp_vfs.h"
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#ifdef __cplusplus

View File

@@ -6,7 +6,6 @@
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
#
#CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO -DMODEL_NAME=SqueezeESP32
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools \
$(COMPONENT_PATH)/../config

View File

@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include "platform_esp32.h"
#include "led.h"
#include <stdio.h>