Fix REST server initialization
This commit is contained in:
@@ -10,3 +10,8 @@ idf_component_register(SRCS "${srcs}"
|
||||
PRIV_INCLUDE_DIRS "src"
|
||||
PRIV_REQUIRES nvs_flash esp_http_server esp_netif esp_https_ota app_update json mqtt vfs spiffs # Use spiffs aqui
|
||||
REQUIRES config api logger)
|
||||
|
||||
set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/webfolder")
|
||||
if(EXISTS ${WEB_SRC_DIR})
|
||||
spiffs_create_partition_image(data ${WEB_SRC_DIR} FLASH_IN_PROJECT)
|
||||
endif()
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
#ifndef REST_H_
|
||||
#define REST_H_
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* @brief Init rest server
|
||||
* @brief Initialize REST server
|
||||
*
|
||||
* @param base_path Path on the SPIFFS filesystem where static files reside
|
||||
* @return ESP_OK on success, ESP_FAIL otherwise
|
||||
*/
|
||||
void rest_init(void);
|
||||
esp_err_t rest_init(const char *base_path);
|
||||
|
||||
#endif /* REST_H_ */
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
void protocols_init(void)
|
||||
{
|
||||
date_time_init();
|
||||
rest_init();
|
||||
/* Serve static files from the SPIFFS data partition */
|
||||
rest_init("/data");
|
||||
//mqtt_init();
|
||||
//modbus_tcp_init();
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "esp_log.h"
|
||||
#include "esp_vfs.h"
|
||||
#include "cJSON.h"
|
||||
#include "rest.h"
|
||||
|
||||
static const char *REST_TAG = "esp-rest";
|
||||
#define REST_CHECK(a, str, goto_tag, ...) \
|
||||
|
||||
Reference in New Issue
Block a user