mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-07 17:08:49 +00:00
Rename Kconfig options (examples)
This commit is contained in:
@@ -4,7 +4,7 @@ EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_
|
||||
|
||||
include $(IDF_PATH)/make/project.mk
|
||||
|
||||
ifdef CONFIG_WEB_DEPLOY_SF
|
||||
ifdef CONFIG_EXAMPLE_WEB_DEPLOY_SF
|
||||
WEB_SRC_DIR = $(shell pwd)/front/web-demo
|
||||
ifneq ($(wildcard $(WEB_SRC_DIR)/dist/.*),)
|
||||
$(eval $(call spiffs_create_partition_image,www,$(WEB_SRC_DIR)/dist,FLASH_IN_PROJECT))
|
||||
|
||||
@@ -3,7 +3,7 @@ set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
register_component()
|
||||
|
||||
if(CONFIG_WEB_DEPLOY_SF)
|
||||
if(CONFIG_EXAMPLE_WEB_DEPLOY_SF)
|
||||
set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../front/web-demo")
|
||||
if(EXISTS ${WEB_SRC_DIR}/dist)
|
||||
spiffs_create_partition_image(www ${WEB_SRC_DIR}/dist FLASH_IN_PROJECT)
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
config MDNS_HOST_NAME
|
||||
config EXAMPLE_MDNS_HOST_NAME
|
||||
string "mDNS Host Name"
|
||||
default "esp-home"
|
||||
help
|
||||
Specify the domain name used in the mDNS service.
|
||||
Note that webpage also take it as a part of URL where it will send GET/POST requests to.
|
||||
|
||||
choice WEB_DEPLOY_MODE
|
||||
choice EXAMPLE_WEB_DEPLOY_MODE
|
||||
prompt "Website deploy mode"
|
||||
default WEB_DEPLOY_SEMIHOST
|
||||
default EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||
help
|
||||
Select website deploy mode.
|
||||
You can deploy website to host, and ESP32 will retrieve them in a semihost way (JTAG is needed).
|
||||
You can deploy website to SD card or SPI flash, and ESP32 will retrieve them via SDIO/SPI interface.
|
||||
Detailed operation steps are listed in the example README file.
|
||||
config WEB_DEPLOY_SEMIHOST
|
||||
config EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||
bool "Deploy website to host (JTAG is needed)"
|
||||
help
|
||||
Deploy website to host.
|
||||
It is recommended to choose this mode during developing.
|
||||
config WEB_DEPLOY_SD
|
||||
config EXAMPLE_WEB_DEPLOY_SD
|
||||
bool "Deploy website to SD card"
|
||||
help
|
||||
Deploy website to SD card.
|
||||
Choose this production mode if the size of website is too large (bigger than 2MB).
|
||||
config WEB_DEPLOY_SF
|
||||
config EXAMPLE_WEB_DEPLOY_SF
|
||||
bool "Deploy website to SPI Nor Flash"
|
||||
help
|
||||
Deploy website to SPI Nor Flash.
|
||||
Choose this production mode if the size of website is small (less than 2MB).
|
||||
endchoice
|
||||
|
||||
if WEB_DEPLOY_SEMIHOST
|
||||
config HOST_PATH_TO_MOUNT
|
||||
if EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||
config EXAMPLE_HOST_PATH_TO_MOUNT
|
||||
string "Host path to mount (e.g. absolute path to web dist directory)"
|
||||
default "PATH-TO-WEB-DIST_DIR"
|
||||
help
|
||||
@@ -41,7 +41,7 @@ menu "Example Configuration"
|
||||
Note that only absolute path is acceptable.
|
||||
endif
|
||||
|
||||
config WEB_MOUNT_POINT
|
||||
config EXAMPLE_WEB_MOUNT_POINT
|
||||
string "Website mount point in VFS"
|
||||
default "/www"
|
||||
help
|
||||
|
||||
@@ -30,7 +30,7 @@ esp_err_t start_rest_server(const char *base_path);
|
||||
static void initialise_mdns(void)
|
||||
{
|
||||
mdns_init();
|
||||
mdns_hostname_set(CONFIG_MDNS_HOST_NAME);
|
||||
mdns_hostname_set(CONFIG_EXAMPLE_MDNS_HOST_NAME);
|
||||
mdns_instance_name_set(MDNS_INSTANCE);
|
||||
|
||||
mdns_txt_item_t serviceTxtData[] = {
|
||||
@@ -42,10 +42,10 @@ static void initialise_mdns(void)
|
||||
sizeof(serviceTxtData) / sizeof(serviceTxtData[0])));
|
||||
}
|
||||
|
||||
#if CONFIG_WEB_DEPLOY_SEMIHOST
|
||||
#if CONFIG_EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||
esp_err_t init_fs(void)
|
||||
{
|
||||
esp_err_t ret = esp_vfs_semihost_register(CONFIG_WEB_MOUNT_POINT, CONFIG_HOST_PATH_TO_MOUNT);
|
||||
esp_err_t ret = esp_vfs_semihost_register(CONFIG_EXAMPLE_WEB_MOUNT_POINT, CONFIG_EXAMPLE_HOST_PATH_TO_MOUNT);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to register semihost driver (%s)!", esp_err_to_name(ret));
|
||||
return ESP_FAIL;
|
||||
@@ -54,7 +54,7 @@ esp_err_t init_fs(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_WEB_DEPLOY_SD
|
||||
#if CONFIG_EXAMPLE_WEB_DEPLOY_SD
|
||||
esp_err_t init_fs(void)
|
||||
{
|
||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
||||
@@ -73,7 +73,7 @@ esp_err_t init_fs(void)
|
||||
};
|
||||
|
||||
sdmmc_card_t *card;
|
||||
esp_err_t ret = esp_vfs_fat_sdmmc_mount(CONFIG_WEB_MOUNT_POINT, &host, &slot_config, &mount_config, &card);
|
||||
esp_err_t ret = esp_vfs_fat_sdmmc_mount(CONFIG_EXAMPLE_WEB_MOUNT_POINT, &host, &slot_config, &mount_config, &card);
|
||||
if (ret != ESP_OK) {
|
||||
if (ret == ESP_FAIL) {
|
||||
ESP_LOGE(TAG, "Failed to mount filesystem.");
|
||||
@@ -88,11 +88,11 @@ esp_err_t init_fs(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_WEB_DEPLOY_SF
|
||||
#if CONFIG_EXAMPLE_WEB_DEPLOY_SF
|
||||
esp_err_t init_fs(void)
|
||||
{
|
||||
esp_vfs_spiffs_conf_t conf = {
|
||||
.base_path = CONFIG_WEB_MOUNT_POINT,
|
||||
.base_path = CONFIG_EXAMPLE_WEB_MOUNT_POINT,
|
||||
.partition_label = NULL,
|
||||
.max_files = 5,
|
||||
.format_if_mount_failed = false
|
||||
@@ -130,5 +130,5 @@ void app_main()
|
||||
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
ESP_ERROR_CHECK(init_fs());
|
||||
ESP_ERROR_CHECK(start_rest_server(CONFIG_WEB_MOUNT_POINT));
|
||||
ESP_ERROR_CHECK(start_rest_server(CONFIG_EXAMPLE_WEB_MOUNT_POINT));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user