mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
fine tuning of httpd implementation
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*/
|
*/
|
||||||
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "cmd_i2ctools.h"
|
#include "cmd_i2ctools.h"
|
||||||
#include "argtable3/argtable3.h"
|
#include "argtable3/argtable3.h"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Main Makefile. This is basically the same as a component makefile.
|
# 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
|
-I$(COMPONENT_PATH)/../tools
|
||||||
COMPONENT_ADD_INCLUDEDIRS := .
|
COMPONENT_ADD_INCLUDEDIRS := .
|
||||||
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools
|
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*/
|
*/
|
||||||
//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*/
|
*/
|
||||||
#define LOG_LOCAL_LEVEL ESP_LOG_INFO
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "nvs_utilities.h"
|
#include "nvs_utilities.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
|
|
||||||
#include "nvs_utilities.h"
|
#include "nvs_utilities.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ COMPONENT_ADD_INCLUDEDIRS += include
|
|||||||
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/main/
|
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/main/
|
||||||
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/components/tools
|
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/components/tools
|
||||||
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO -DCONFIG_OTA_ALLOW_HTTP=1
|
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
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
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/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
|
|||||||
@@ -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
|
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_INFO \
|
||||||
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG \
|
|
||||||
-I$(COMPONENT_PATH)/../tools
|
-I$(COMPONENT_PATH)/../tools
|
||||||
COMPONENT_ADD_INCLUDEDIRS := .
|
COMPONENT_ADD_INCLUDEDIRS := .
|
||||||
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools
|
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools
|
||||||
|
|||||||
@@ -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;
|
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);
|
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;
|
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){
|
esp_err_t resource_filehandler(httpd_req_t *req){
|
||||||
char filepath[FILE_PATH_MAX];
|
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));
|
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");
|
httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "File does not exist");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
ESP_LOGI_LOC(TAG, "Resource sending complete");
|
ESP_LOGD_LOC(TAG, "Resource sending complete");
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -589,7 +589,7 @@ esp_err_t config_post_handler(httpd_req_t *req){
|
|||||||
err = ESP_FAIL;
|
err = ESP_FAIL;
|
||||||
}
|
}
|
||||||
if(err == ESP_OK){
|
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);
|
nvs_type_t item_type= config_get_item_type(prev_item);
|
||||||
if(item_type!=0){
|
if(item_type!=0){
|
||||||
void * val = config_safe_alloc_get_entry_value(item_type, prev_item);
|
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;
|
err = ESP_FAIL;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
free(val);
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ function to process requests, decode URLs, serve files, etc. etc.
|
|||||||
#include "lwip/priv/tcp_priv.h"
|
#include "lwip/priv/tcp_priv.h"
|
||||||
#include "lwip/priv/tcpip_priv.h"
|
#include "lwip/priv/tcpip_priv.h"
|
||||||
#include "esp_vfs.h"
|
#include "esp_vfs.h"
|
||||||
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
|
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
|
||||||
# please read the SDK documents if you need to do this.
|
# 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
|
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO -DMODEL_NAME=SqueezeESP32
|
||||||
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools \
|
COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools \
|
||||||
$(COMPONENT_PATH)/../config
|
$(COMPONENT_PATH)/../config
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
|
||||||
#include "platform_esp32.h"
|
#include "platform_esp32.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user