From c45d313cc5aacee133ad187a5844ca720d23848f Mon Sep 17 00:00:00 2001 From: NDJ-Ezlo Date: Sat, 24 Feb 2024 00:20:41 +0545 Subject: [PATCH 1/4] Implemented mdns in EzlopiFirmware --- ezlopi-core/ezlopi-core-ezlopi/CMakeLists.txt | 3 +- .../ezlopi-core-ezlopi/ezlopi_core_ezlopi.c | 3 + ezlopi-core/ezlopi-core-mdns/CMakeLists.txt | 7 +++ .../ezlopi-core-mdns/ezlopi_core_mdns.c | 62 +++++++++++++++++++ .../ezlopi-core-mdns/ezlopi_core_mdns.h | 9 +++ sdkconfig | 3 + 6 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 ezlopi-core/ezlopi-core-mdns/CMakeLists.txt create mode 100644 ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c create mode 100644 ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.h diff --git a/ezlopi-core/ezlopi-core-ezlopi/CMakeLists.txt b/ezlopi-core/ezlopi-core-ezlopi/CMakeLists.txt index 1ac9bc579..fea7848ac 100644 --- a/ezlopi-core/ezlopi-core-ezlopi/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-ezlopi/CMakeLists.txt @@ -10,7 +10,8 @@ set(EZLOPI_CORE_COMPONENTS ezlopi-core-wifi ezlopi-core-sntp ezlopi-core-ble - ezlopi-core-scenes + ezlopi-core-scenes + ezlopi-core-mdns ) diff --git a/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c b/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c index 07288215e..7dd981d59 100644 --- a/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c +++ b/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c @@ -15,6 +15,7 @@ #include "ezlopi_core_devices_list.h" #include "ezlopi_core_scenes_scripts.h" #include "ezlopi_core_scenes_expressions.h" +#include "ezlopi_core_mdns.h" #ifdef EZPI_CORE_ENABLE_ETH #include "ezlopi_core_ethernet.h" @@ -78,6 +79,8 @@ void ezlopi_init(void) uint32_t boot_count = ezlopi_system_info_get_boot_count(); + ezlopi_core_initialize_mdns(); + ezlopi_wifi_connect_from_id_bin(); ezlopi_nvs_set_boot_count(boot_count + 1); diff --git a/ezlopi-core/ezlopi-core-mdns/CMakeLists.txt b/ezlopi-core/ezlopi-core-mdns/CMakeLists.txt new file mode 100644 index 000000000..ee88e1469 --- /dev/null +++ b/ezlopi-core/ezlopi-core-mdns/CMakeLists.txt @@ -0,0 +1,7 @@ + + +idf_component_register(SRCS "ezlopi_core_mdns.c" + INCLUDE_DIRS . + REQUIRES mdns ezlopi-util-trace) + + diff --git a/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c new file mode 100644 index 000000000..d368f46a3 --- /dev/null +++ b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c @@ -0,0 +1,62 @@ + +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_netif_ip_addr.h" +#include "esp_system.h" +#include "esp_event.h" +#include "esp_log.h" +#include "esp_netif.h" +#include "mdns.h" +#include "driver/gpio.h" +#include "netdb.h" + +#include "ezlopi_util_trace.h" + +#include "ezlopi_core_mdns.h" + +#define EXAMPLE_MDNS_INSTANCE "esp-instance" +#define EXAMPLE_HOST_NAME "ezlopi-device" + +static char *generate_hostname(void); + +static void initialise_mdns(void) +{ + char *hostname = generate_hostname(); + + // initialize mDNS + ESP_ERROR_CHECK(mdns_init()); + // set mDNS hostname (required if you want to advertise services) + ESP_ERROR_CHECK(mdns_hostname_set(hostname)); + TRACE_D("mdns hostname set to: [%s]", hostname); + // set default mDNS instance name + ESP_ERROR_CHECK(mdns_instance_name_set(EXAMPLE_MDNS_INSTANCE)); + ESP_ERROR_CHECK(mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, NULL, 0)); + free(hostname); +} + +int ezlopi_core_initialize_mdns(void) +{ + int ret = 0; + initialise_mdns(); + return ret; +} + +/** Generate host name based on sdkconfig, optionally adding a portion of MAC address to it. + * @return host name string allocated from the heap + */ +static char *generate_hostname(void) +{ +#ifndef CONFIG_MDNS_ADD_MAC_TO_HOSTNAME + return strdup(EXAMPLE_HOST_NAME); +#else + uint8_t mac[6]; + char *hostname; + esp_read_mac(mac, ESP_MAC_WIFI_STA); + if (-1 == asprintf(&hostname, "%s-%02X%02X%02X", EXAMPLE_HOST_NAME, mac[3], mac[4], mac[5])) + { + abort(); + } + return hostname; +#endif +} diff --git a/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.h b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.h new file mode 100644 index 000000000..c6a1de14e --- /dev/null +++ b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.h @@ -0,0 +1,9 @@ + +#ifndef __EZLOPI_CORE_MDNS_H_ +#define __EZLOPI_CORE_MDNS_H_ + +int ezlopi_core_initialize_mdns(); + +#endif // __EZLOPI_CORE_MDNS_H_ + + diff --git a/sdkconfig b/sdkconfig index 82d20c095..4c9824471 100644 --- a/sdkconfig +++ b/sdkconfig @@ -294,6 +294,7 @@ CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 # CONFIG_BT_GATTS_APPEARANCE_WRITABLE is not set CONFIG_BT_GATTC_ENABLE=y CONFIG_BT_GATTC_MAX_CACHE_CHAR=40 +CONFIG_BT_GATTC_NOTIF_REG_MAX=5 # CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 CONFIG_BT_BLE_SMP_ENABLE=y @@ -728,6 +729,7 @@ CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y # CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set +CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # @@ -1066,6 +1068,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_NETIF_API is not set +CONFIG_LWIP_TCPIP_TASK_PRIO=18 # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y From 01c795310ac33850b047f303160d387e6f625844 Mon Sep 17 00:00:00 2001 From: NDJ-Ezlo Date: Sat, 24 Feb 2024 02:34:02 +0545 Subject: [PATCH 2/4] Implemented EzloPi USer Config --- .../ezlopi-core-ble/ezlopi_core_ble_gap.c | 6 +- .../ezlopi-core-ble/ezlopi_core_ble_gatt.c | 2 +- .../ezlopi-core-ezlopi/ezlopi_core_ezlopi.c | 12 +- ezlopi-main/Kconfig.projbuild | 37 ++ .../ezlopi_ble_service_security.c | 14 +- .../ezlopi-service-ble/ezlopi_service_ble.c | 8 +- .../ezlopi_service_ble_security.c | 14 +- .../ezlopi-util-trace/ezlopi_util_trace.h | 4 +- sdkconfig | 13 + sdkconfig.old | 335 +----------------- 10 files changed, 94 insertions(+), 351 deletions(-) create mode 100644 ezlopi-main/Kconfig.projbuild diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c index 5c0e8c010..671e8b4bb 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c @@ -69,7 +69,7 @@ static char* esp_auth_req_to_str(esp_ble_auth_req_t auth_req); static char* ezlopi_ble_gap_event_to_str(esp_gap_ble_cb_event_t event); // static void ezlopi_ble_setup_adv_config(void); -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) void ezlopi_ble_gap_set_passkey(uint32_t passkey) { esp_ble_gap_set_security_param(ESP_BLE_SM_SET_STATIC_PASSKEY, &passkey, sizeof(uint32_t)); @@ -218,7 +218,7 @@ void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_p break; } -#if (1 == EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) case ESP_GAP_BLE_PASSKEY_REQ_EVT: // 12 { break; @@ -304,7 +304,7 @@ void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_p ezlopi_ble_setup_adv_config(); break; } -#if (1 == EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) case ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT: // 22 { ezlopi_ble_setup_adv_config(); diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c index a9d8ee7a8..27e4cbf0d 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c @@ -187,7 +187,7 @@ void ezlopi_ble_gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t ga ezlopi_ble_gatt_call_write_exec_by_handle(gatts_if, param); break; } -#if (1 == EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) case ESP_GATTS_CONNECT_EVT: { TRACE_S("ESP_GATTS_CONNECT_EVT"); diff --git a/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c b/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c index 07288215e..6adbba330 100644 --- a/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c +++ b/ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c @@ -16,9 +16,9 @@ #include "ezlopi_core_scenes_scripts.h" #include "ezlopi_core_scenes_expressions.h" -#ifdef EZPI_CORE_ENABLE_ETH +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH #include "ezlopi_core_ethernet.h" -#endif // EZPI_CORE_ENABLE_ETH +#endif // CONFIG_EZPI_CORE_ENABLE_ETH #include "ezlopi_service_uart.h" #include "ezlopi_service_ota.h" @@ -65,16 +65,16 @@ void ezlopi_init(void) ezlopi_ble_service_init(); -#ifdef EZPI_SERV_ENABLE_MESHBOTS +#ifdef CONFIG_EZPI_SERV_ENABLE_MESHBOTS ezlopi_scenes_meshbot_init(); ezlopi_scenes_scripts_init(); ezlopi_scenes_expressions_init(); ezlopi_scenes_init_v2(); -#endif // EZPI_SERV_ENABLE_MESHBOTS +#endif // CONFIG_EZPI_SERV_ENABLE_MESHBOTS -#ifdef EZPI_CORE_ENABLE_ETH +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH ezlopi_ethernet_init(); -#endif // EZPI_CORE_ENABLE_ETH +#endif // CONFIG_EZPI_CORE_ENABLE_ETH uint32_t boot_count = ezlopi_system_info_get_boot_count(); diff --git a/ezlopi-main/Kconfig.projbuild b/ezlopi-main/Kconfig.projbuild new file mode 100644 index 000000000..26fcdadd0 --- /dev/null +++ b/ezlopi-main/Kconfig.projbuild @@ -0,0 +1,37 @@ + +menu "EzloPi User Config" + + config EZPI_UTIL_ENABLE_TRACE + bool "Enable trace component for logging" + default y + help + ezlopi-util-trace component is enabled to log the outputs to the serial monitor + + config EZPI_CORE_ENABLE_ETH + bool "Enable ethernet component" + depends on ETH_USE_SPI_ETHERNET + default n + help + ezlopi-core-ethernet component is enabled + + config EZPI_SERV_ENABLE_MESHBOTS + bool "Enable meshbot service" + default y + help + Enable meshbot services for scenes + + config EZLOPI_BLE_ENALBE_PASSKEY + bool "Enable BLE pass key" + default n + help + Enable BLE pass key + + config EZLOPI_BLE_ENALBE_PAIRING + bool "Enable BLE pairing" + default y + help + Enable BLE pairing + +endmenu + + diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_ble_service_security.c b/ezlopi-services/ezlopi-service-ble/ezlopi_ble_service_security.c index adeadcdd8..268717197 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_ble_service_security.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_ble_service_security.c @@ -29,13 +29,13 @@ typedef enum e_ble_security_commands BLE_CMD_MAX, } e_ble_security_commands_t; -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) static uint32_t start_tick = 0; static uint32_t authenticated_flag = 0; #endif static s_gatt_service_t *security_service = NULL; -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) s_gatt_char_t *passkey_characterstic = NULL; static void passkey_write_func(esp_gatt_value_t *value, esp_ble_gatts_cb_param_t *param); #endif @@ -60,7 +60,7 @@ void ezlopi_ble_service_security_init(void) uuid.uuid.uuid16 = BLE_SECURITY_SERVICE_UUID; security_service = ezlopi_ble_gatt_create_service(BLE_SECURITY_SERVICE_HANDLE, &uuid); -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) uuid.uuid.uuid16 = BLE_SECURITY_CHAR_PASSKEY_UUID; uuid.len = ESP_UUID_LEN_16; permission = ESP_GATT_PERM_WRITE; @@ -75,7 +75,7 @@ void ezlopi_ble_service_security_init(void) factory_reset_characterstic = ezlopi_ble_gatt_add_characteristic(security_service, &uuid, permission, properties, NULL, factory_reset_write_func, NULL); } -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) static void passkey_write_func(esp_gatt_value_t *value, esp_ble_gatts_cb_param_t *param) { if (param->write.len == 4) @@ -141,7 +141,7 @@ static void factory_reset_write_func(esp_gatt_value_t *value, esp_ble_gatts_cb_p static void __process_hard_reset_command(void) { -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) uint32_t current_tick = xTaskGetTickCount(); if ((1 == authenticated_flag) && (current_tick - start_tick) < (30 * 1000 / portTICK_RATE_MS)) // once authenticated, valid for 30 seconds only { @@ -161,7 +161,7 @@ static void __process_hard_reset_command(void) TRACE_I("factory reset done, rebooting now ............................................."); vTaskDelay(2000 / portTICK_RATE_MS); EZPI_CORE_reboot(); -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) } else { @@ -181,7 +181,7 @@ static void __process_hard_reset_command(void) static void __process_auth_command(cJSON *root) { -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) uint32_t passkey = CJ_GET_NUMBER("passkey"); uint32_t original_passkey = 0; ezlopi_nvs_read_ble_passkey(&original_passkey); diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c index c240a0179..a19631c74 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c @@ -36,7 +36,7 @@ extern void ezlopi_ble_service_dynamic_config_init(void); static void ezlopi_ble_basic_init(void); -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) static void ezlopi_ble_start_secure_gatt_server(void); #endif @@ -62,8 +62,8 @@ void ezlopi_ble_service_init(void) CHECK_PRINT_ERROR(esp_ble_gatt_set_local_mtu(517), "set local MTU failed"); -#if (1 == EZLOPI_BLE_ENALBE_PAIRING) -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) ezlopi_ble_start_secure_gatt_server(); #else ezlopi_ble_start_secure_gatt_server_open_pairing(); @@ -96,7 +96,7 @@ static void ezlopi_ble_start_secure_gatt_server_open_pairing(void) "failed -set - ESP_BLE_SM_SET_RSP_KEY"); } -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) static void ezlopi_ble_start_secure_gatt_server(void) { const uint32_t default_passkey = 123456; diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c index c9d499251..c313a83ec 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c @@ -30,13 +30,13 @@ typedef enum e_ble_security_commands BLE_CMD_MAX, } e_ble_security_commands_t; -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) static uint32_t start_tick = 0; static uint32_t authenticated_flag = 0; #endif static s_gatt_service_t* security_service = NULL; -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) s_gatt_char_t* passkey_characterstic = NULL; static void passkey_write_func(esp_gatt_value_t* value, esp_ble_gatts_cb_param_t* param); #endif @@ -60,7 +60,7 @@ void ezlopi_ble_service_security_init(void) uuid.uuid.uuid16 = BLE_SECURITY_SERVICE_UUID; security_service = ezlopi_ble_gatt_create_service(BLE_SECURITY_SERVICE_HANDLE, &uuid); -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) uuid.uuid.uuid16 = BLE_SECURITY_CHAR_PASSKEY_UUID; uuid.len = ESP_UUID_LEN_16; permission = ESP_GATT_PERM_WRITE; @@ -75,7 +75,7 @@ void ezlopi_ble_service_security_init(void) factory_reset_characterstic = ezlopi_ble_gatt_add_characteristic(security_service, &uuid, permission, properties, NULL, factory_reset_write_func, NULL); } -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) static void passkey_write_func(esp_gatt_value_t* value, esp_ble_gatts_cb_param_t* param) { if (param->write.len == 4) @@ -141,13 +141,13 @@ static void factory_reset_write_func(esp_gatt_value_t* value, esp_ble_gatts_cb_p static void __process_hard_reset_command(void) { -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) uint32_t current_tick = xTaskGetTickCount(); if ((1 == authenticated_flag) && (current_tick - start_tick) < (30 * 1000 / portTICK_RATE_MS)) // once authenticated, valid for 30 seconds only { #endif EZPI_CORE_factory_restore(); -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) } else { @@ -159,7 +159,7 @@ static void __process_hard_reset_command(void) static void __process_auth_command(cJSON* root) { -#if (1 == EZLOPI_BLE_ENALBE_PASSKEY) +#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) uint32_t passkey = CJ_GET_NUMBER("passkey"); uint32_t original_passkey = 0; ezlopi_nvs_read_ble_passkey(&original_passkey); diff --git a/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h b/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h index 8073ba120..c4a4732d0 100644 --- a/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h +++ b/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h @@ -11,9 +11,9 @@ extern "C" { #endif -#ifdef EZPI_UTIL_ENABLE_TRACE +#ifdef CONFIG_EZPI_UTIL_ENABLE_TRACE #define ENABLE_TRACE 1 -#endif // EZPI_UTIL_ENABLE_TRACE +#endif // CONFIG_EZPI_UTIL_ENABLE_TRACE void __dump(const char* file_name, uint32_t line, char* buffer_name, void* _buff, uint32_t ofs, uint32_t cnt); diff --git a/sdkconfig b/sdkconfig index 82d20c095..8b5498bd4 100644 --- a/sdkconfig +++ b/sdkconfig @@ -144,6 +144,16 @@ CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table +# +# EzloPi User Config +# +CONFIG_EZPI_UTIL_ENABLE_TRACE=y +# CONFIG_EZPI_CORE_ENABLE_ETH is not set +CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y +# CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set +CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y +# end of EzloPi User Config + # # Compiler options # @@ -294,6 +304,7 @@ CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 # CONFIG_BT_GATTS_APPEARANCE_WRITABLE is not set CONFIG_BT_GATTC_ENABLE=y CONFIG_BT_GATTC_MAX_CACHE_CHAR=40 +CONFIG_BT_GATTC_NOTIF_REG_MAX=5 # CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 CONFIG_BT_BLE_SMP_ENABLE=y @@ -728,6 +739,7 @@ CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y # CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set +CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # @@ -1066,6 +1078,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_NETIF_API is not set +CONFIG_LWIP_TCPIP_TASK_PRIO=18 # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y diff --git a/sdkconfig.old b/sdkconfig.old index 07d8de75d..3e8de980c 100644 --- a/sdkconfig.old +++ b/sdkconfig.old @@ -144,6 +144,16 @@ CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table +# +# EzloPi User Config +# +# CONFIG_EZPI_UTIL_ENABLE_TRACE is not set +# CONFIG_EZPI_CORE_ENABLE_ETH is not set +CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y +# CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set +CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y +# end of EzloPi User Config + # # Compiler options # @@ -274,7 +284,7 @@ CONFIG_BT_BLUEDROID_ENABLED=y # # Bluedroid Options # -CONFIG_BT_BTC_TASK_STACK_SIZE=4096 +CONFIG_BT_BTC_TASK_STACK_SIZE=3072 CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y # CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0 @@ -294,6 +304,7 @@ CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 # CONFIG_BT_GATTS_APPEARANCE_WRITABLE is not set CONFIG_BT_GATTC_ENABLE=y CONFIG_BT_GATTC_MAX_CACHE_CHAR=40 +CONFIG_BT_GATTC_NOTIF_REG_MAX=5 # CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 CONFIG_BT_BLE_SMP_ENABLE=y @@ -728,6 +739,7 @@ CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y # CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set +CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # @@ -1066,6 +1078,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_NETIF_API is not set +CONFIG_LWIP_TCPIP_TASK_PRIO=18 # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y @@ -1609,323 +1622,3 @@ CONFIG_LUA_ROOT="/lua" # # CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set # end of Compatibility options - -# Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32s3-elf-" -CONFIG_LOG_BOOTLOADER_LEVEL_NONE=y -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=0 -# CONFIG_APP_ROLLBACK_ENABLE is not set -# CONFIG_FLASH_ENCRYPTION_ENABLED is not set -# CONFIG_FLASHMODE_QIO is not set -# CONFIG_FLASHMODE_QOUT is not set -CONFIG_FLASHMODE_DIO=y -# CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 -CONFIG_MONITOR_BAUD=115200 -CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y -# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set -CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y -# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set -CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_CXX_EXCEPTIONS is not set -CONFIG_STACK_CHECK_NONE=y -# CONFIG_STACK_CHECK_NORM is not set -# CONFIG_STACK_CHECK_STRONG is not set -# CONFIG_STACK_CHECK_ALL is not set -# CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_BLUEDROID_ENABLED=y -# CONFIG_NIMBLE_ENABLED is not set -CONFIG_BTC_TASK_STACK_SIZE=4096 -CONFIG_BLUEDROID_PINNED_TO_CORE_0=y -# CONFIG_BLUEDROID_PINNED_TO_CORE_1 is not set -CONFIG_BLUEDROID_PINNED_TO_CORE=0 -CONFIG_BTU_TASK_STACK_SIZE=4096 -# CONFIG_BLUEDROID_MEM_DEBUG is not set -CONFIG_GATTS_ENABLE=y -# CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set -CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y -CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0 -CONFIG_GATTC_ENABLE=y -# CONFIG_GATTC_CACHE_NVS_FLASH is not set -CONFIG_BLE_SMP_ENABLE=y -# CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set -# CONFIG_HCI_TRACE_LEVEL_NONE is not set -# CONFIG_HCI_TRACE_LEVEL_ERROR is not set -CONFIG_HCI_TRACE_LEVEL_WARNING=y -# CONFIG_HCI_TRACE_LEVEL_API is not set -# CONFIG_HCI_TRACE_LEVEL_EVENT is not set -# CONFIG_HCI_TRACE_LEVEL_DEBUG is not set -# CONFIG_HCI_TRACE_LEVEL_VERBOSE is not set -CONFIG_HCI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTM_TRACE_LEVEL_NONE is not set -# CONFIG_BTM_TRACE_LEVEL_ERROR is not set -CONFIG_BTM_TRACE_LEVEL_WARNING=y -# CONFIG_BTM_TRACE_LEVEL_API is not set -# CONFIG_BTM_TRACE_LEVEL_EVENT is not set -# CONFIG_BTM_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTM_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTM_INITIAL_TRACE_LEVEL=2 -# CONFIG_L2CAP_TRACE_LEVEL_NONE is not set -# CONFIG_L2CAP_TRACE_LEVEL_ERROR is not set -CONFIG_L2CAP_TRACE_LEVEL_WARNING=y -# CONFIG_L2CAP_TRACE_LEVEL_API is not set -# CONFIG_L2CAP_TRACE_LEVEL_EVENT is not set -# CONFIG_L2CAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_L2CAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_L2CAP_INITIAL_TRACE_LEVEL=2 -# CONFIG_RFCOMM_TRACE_LEVEL_NONE is not set -# CONFIG_RFCOMM_TRACE_LEVEL_ERROR is not set -CONFIG_RFCOMM_TRACE_LEVEL_WARNING=y -# CONFIG_RFCOMM_TRACE_LEVEL_API is not set -# CONFIG_RFCOMM_TRACE_LEVEL_EVENT is not set -# CONFIG_RFCOMM_TRACE_LEVEL_DEBUG is not set -# CONFIG_RFCOMM_TRACE_LEVEL_VERBOSE is not set -CONFIG_RFCOMM_INITIAL_TRACE_LEVEL=2 -# CONFIG_SDP_TRACE_LEVEL_NONE is not set -# CONFIG_SDP_TRACE_LEVEL_ERROR is not set -CONFIG_SDP_TRACE_LEVEL_WARNING=y -# CONFIG_SDP_TRACE_LEVEL_API is not set -# CONFIG_SDP_TRACE_LEVEL_EVENT is not set -# CONFIG_SDP_TRACE_LEVEL_DEBUG is not set -# CONFIG_SDP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTH_LOG_SDP_INITIAL_TRACE_LEVEL=2 -# CONFIG_GAP_TRACE_LEVEL_NONE is not set -# CONFIG_GAP_TRACE_LEVEL_ERROR is not set -CONFIG_GAP_TRACE_LEVEL_WARNING=y -# CONFIG_GAP_TRACE_LEVEL_API is not set -# CONFIG_GAP_TRACE_LEVEL_EVENT is not set -# CONFIG_GAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_GAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_GAP_INITIAL_TRACE_LEVEL=2 -CONFIG_BNEP_INITIAL_TRACE_LEVEL=2 -# CONFIG_PAN_TRACE_LEVEL_NONE is not set -# CONFIG_PAN_TRACE_LEVEL_ERROR is not set -CONFIG_PAN_TRACE_LEVEL_WARNING=y -# CONFIG_PAN_TRACE_LEVEL_API is not set -# CONFIG_PAN_TRACE_LEVEL_EVENT is not set -# CONFIG_PAN_TRACE_LEVEL_DEBUG is not set -# CONFIG_PAN_TRACE_LEVEL_VERBOSE is not set -CONFIG_PAN_INITIAL_TRACE_LEVEL=2 -# CONFIG_A2D_TRACE_LEVEL_NONE is not set -# CONFIG_A2D_TRACE_LEVEL_ERROR is not set -CONFIG_A2D_TRACE_LEVEL_WARNING=y -# CONFIG_A2D_TRACE_LEVEL_API is not set -# CONFIG_A2D_TRACE_LEVEL_EVENT is not set -# CONFIG_A2D_TRACE_LEVEL_DEBUG is not set -# CONFIG_A2D_TRACE_LEVEL_VERBOSE is not set -CONFIG_A2D_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVDT_TRACE_LEVEL_NONE is not set -# CONFIG_AVDT_TRACE_LEVEL_ERROR is not set -CONFIG_AVDT_TRACE_LEVEL_WARNING=y -# CONFIG_AVDT_TRACE_LEVEL_API is not set -# CONFIG_AVDT_TRACE_LEVEL_EVENT is not set -# CONFIG_AVDT_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVDT_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVDT_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVCT_TRACE_LEVEL_NONE is not set -# CONFIG_AVCT_TRACE_LEVEL_ERROR is not set -CONFIG_AVCT_TRACE_LEVEL_WARNING=y -# CONFIG_AVCT_TRACE_LEVEL_API is not set -# CONFIG_AVCT_TRACE_LEVEL_EVENT is not set -# CONFIG_AVCT_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVCT_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVCT_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVRC_TRACE_LEVEL_NONE is not set -# CONFIG_AVRC_TRACE_LEVEL_ERROR is not set -CONFIG_AVRC_TRACE_LEVEL_WARNING=y -# CONFIG_AVRC_TRACE_LEVEL_API is not set -# CONFIG_AVRC_TRACE_LEVEL_EVENT is not set -# CONFIG_AVRC_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVRC_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVRC_INITIAL_TRACE_LEVEL=2 -# CONFIG_MCA_TRACE_LEVEL_NONE is not set -# CONFIG_MCA_TRACE_LEVEL_ERROR is not set -CONFIG_MCA_TRACE_LEVEL_WARNING=y -# CONFIG_MCA_TRACE_LEVEL_API is not set -# CONFIG_MCA_TRACE_LEVEL_EVENT is not set -# CONFIG_MCA_TRACE_LEVEL_DEBUG is not set -# CONFIG_MCA_TRACE_LEVEL_VERBOSE is not set -CONFIG_MCA_INITIAL_TRACE_LEVEL=2 -# CONFIG_HID_TRACE_LEVEL_NONE is not set -# CONFIG_HID_TRACE_LEVEL_ERROR is not set -CONFIG_HID_TRACE_LEVEL_WARNING=y -# CONFIG_HID_TRACE_LEVEL_API is not set -# CONFIG_HID_TRACE_LEVEL_EVENT is not set -# CONFIG_HID_TRACE_LEVEL_DEBUG is not set -# CONFIG_HID_TRACE_LEVEL_VERBOSE is not set -CONFIG_HID_INITIAL_TRACE_LEVEL=2 -# CONFIG_APPL_TRACE_LEVEL_NONE is not set -# CONFIG_APPL_TRACE_LEVEL_ERROR is not set -CONFIG_APPL_TRACE_LEVEL_WARNING=y -# CONFIG_APPL_TRACE_LEVEL_API is not set -# CONFIG_APPL_TRACE_LEVEL_EVENT is not set -# CONFIG_APPL_TRACE_LEVEL_DEBUG is not set -# CONFIG_APPL_TRACE_LEVEL_VERBOSE is not set -CONFIG_APPL_INITIAL_TRACE_LEVEL=2 -# CONFIG_GATT_TRACE_LEVEL_NONE is not set -# CONFIG_GATT_TRACE_LEVEL_ERROR is not set -CONFIG_GATT_TRACE_LEVEL_WARNING=y -# CONFIG_GATT_TRACE_LEVEL_API is not set -# CONFIG_GATT_TRACE_LEVEL_EVENT is not set -# CONFIG_GATT_TRACE_LEVEL_DEBUG is not set -# CONFIG_GATT_TRACE_LEVEL_VERBOSE is not set -CONFIG_GATT_INITIAL_TRACE_LEVEL=2 -# CONFIG_SMP_TRACE_LEVEL_NONE is not set -# CONFIG_SMP_TRACE_LEVEL_ERROR is not set -CONFIG_SMP_TRACE_LEVEL_WARNING=y -# CONFIG_SMP_TRACE_LEVEL_API is not set -# CONFIG_SMP_TRACE_LEVEL_EVENT is not set -# CONFIG_SMP_TRACE_LEVEL_DEBUG is not set -# CONFIG_SMP_TRACE_LEVEL_VERBOSE is not set -CONFIG_SMP_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTIF_TRACE_LEVEL_NONE is not set -# CONFIG_BTIF_TRACE_LEVEL_ERROR is not set -CONFIG_BTIF_TRACE_LEVEL_WARNING=y -# CONFIG_BTIF_TRACE_LEVEL_API is not set -# CONFIG_BTIF_TRACE_LEVEL_EVENT is not set -# CONFIG_BTIF_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTIF_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTIF_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTC_TRACE_LEVEL_NONE is not set -# CONFIG_BTC_TRACE_LEVEL_ERROR is not set -CONFIG_BTC_TRACE_LEVEL_WARNING=y -# CONFIG_BTC_TRACE_LEVEL_API is not set -# CONFIG_BTC_TRACE_LEVEL_EVENT is not set -# CONFIG_BTC_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTC_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTC_INITIAL_TRACE_LEVEL=2 -# CONFIG_OSI_TRACE_LEVEL_NONE is not set -# CONFIG_OSI_TRACE_LEVEL_ERROR is not set -CONFIG_OSI_TRACE_LEVEL_WARNING=y -# CONFIG_OSI_TRACE_LEVEL_API is not set -# CONFIG_OSI_TRACE_LEVEL_EVENT is not set -# CONFIG_OSI_TRACE_LEVEL_DEBUG is not set -# CONFIG_OSI_TRACE_LEVEL_VERBOSE is not set -CONFIG_OSI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BLUFI_TRACE_LEVEL_NONE is not set -# CONFIG_BLUFI_TRACE_LEVEL_ERROR is not set -CONFIG_BLUFI_TRACE_LEVEL_WARNING=y -# CONFIG_BLUFI_TRACE_LEVEL_API is not set -# CONFIG_BLUFI_TRACE_LEVEL_EVENT is not set -# CONFIG_BLUFI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BLUFI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK is not set -CONFIG_SMP_ENABLE=y -# CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set -CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30 -CONFIG_ADC2_DISABLE_DAC=y -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -CONFIG_POST_EVENTS_FROM_IRAM_ISR=y -CONFIG_ESP_SYSTEM_PD_FLASH=y -CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y -CONFIG_IPC_TASK_STACK_SIZE=1536 -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# CONFIG_ESP32_REDUCE_PHY_TX_POWER is not set -CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU=y -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y -# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set -CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=3072 -CONFIG_MAIN_TASK_STACK_SIZE=3584 -CONFIG_CONSOLE_UART_DEFAULT=y -# CONFIG_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_UART_NONE is not set -CONFIG_CONSOLE_UART=y -CONFIG_CONSOLE_UART_NUM=0 -CONFIG_CONSOLE_UART_BAUDRATE=115200 -CONFIG_INT_WDT=y -CONFIG_INT_WDT_TIMEOUT_MS=300 -CONFIG_INT_WDT_CHECK_CPU1=y -CONFIG_TASK_WDT=y -# CONFIG_TASK_WDT_PANIC is not set -CONFIG_TASK_WDT_TIMEOUT_S=5 -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set -CONFIG_TIMER_TASK_STACK_SIZE=3584 -CONFIG_SW_COEXIST_ENABLE=y -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_MB_QUEUE_LENGTH=20 -CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096 -CONFIG_MB_SERIAL_BUF_SIZE=256 -CONFIG_MB_SERIAL_TASK_PRIO=10 -CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_MB_CONTROLLER_STACK_SIZE=4096 -CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 -# CONFIG_MB_TIMER_PORT_ENABLED is not set -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set -CONFIG_TIMER_TASK_PRIORITY=1 -CONFIG_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_TIMER_QUEUE_LENGTH=10 -# CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set -CONFIG_ESP_GRATUITOUS_ARP=y -CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=16 -CONFIG_TCP_MAXRTX=12 -CONFIG_TCP_SYNMAXRTX=12 -CONFIG_TCP_MSS=1440 -CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=5744 -CONFIG_TCP_WND_DEFAULT=5744 -CONFIG_TCP_RECVMBOX_SIZE=6 -CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set -CONFIG_TCP_OVERSIZE_MSS=y -# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_TCP_OVERSIZE_DISABLE is not set -CONFIG_UDP_RECVMBOX_SIZE=6 -CONFIG_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_PPP_SUPPORT is not set -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set -# CONFIG_USB_ENABLED is not set -CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_SUPPORT_TERMIOS=y -CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# End of deprecated options From 7a6728f681c05e79812e0a2f8f399a48a3f194ad Mon Sep 17 00:00:00 2001 From: NDJ-Ezlo Date: Mon, 26 Feb 2024 16:38:42 +0545 Subject: [PATCH 3/4] Added service to mDNS --- ezlopi-core/ezlopi-core-mdns/CMakeLists.txt | 4 +- .../ezlopi-core-mdns/ezlopi_core_mdns.c | 64 +++++++++++++++++-- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/ezlopi-core/ezlopi-core-mdns/CMakeLists.txt b/ezlopi-core/ezlopi-core-mdns/CMakeLists.txt index ee88e1469..101ebd7e2 100644 --- a/ezlopi-core/ezlopi-core-mdns/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-mdns/CMakeLists.txt @@ -2,6 +2,8 @@ idf_component_register(SRCS "ezlopi_core_mdns.c" INCLUDE_DIRS . - REQUIRES mdns ezlopi-util-trace) + REQUIRES mdns + ezlopi-core-factory-info + ezlopi-util-trace) diff --git a/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c index d368f46a3..8b063059f 100644 --- a/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c +++ b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c @@ -11,18 +11,20 @@ #include "driver/gpio.h" #include "netdb.h" +#include "ezlopi_core_factory_info.h" + #include "ezlopi_util_trace.h" #include "ezlopi_core_mdns.h" -#define EXAMPLE_MDNS_INSTANCE "esp-instance" -#define EXAMPLE_HOST_NAME "ezlopi-device" +#define EXAMPLE_MDNS_INSTANCE "esp_instance" +#define EXAMPLE_HOST_NAME "ezlopi_device" -static char *generate_hostname(void); +static char* generate_hostname(void); static void initialise_mdns(void) { - char *hostname = generate_hostname(); + char* hostname = generate_hostname(); // initialize mDNS ESP_ERROR_CHECK(mdns_init()); @@ -31,7 +33,55 @@ static void initialise_mdns(void) TRACE_D("mdns hostname set to: [%s]", hostname); // set default mDNS instance name ESP_ERROR_CHECK(mdns_instance_name_set(EXAMPLE_MDNS_INSTANCE)); - ESP_ERROR_CHECK(mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, NULL, 0)); + + uint64_t id_val = ezlopi_factory_info_v3_get_id(); + char* id_val_str = malloc(10 * sizeof(char)); + memset(id_val_str, 0, (10 * sizeof(char))); + snprintf(id_val_str, 10, "%lld", id_val); + + uint16_t firmware_version_val = ezlopi_factory_info_v3_get_version(); + char* firmware_version_val_str = malloc(10 * sizeof(char)); + memset(firmware_version_val_str, 0, 10 * sizeof(char)); + snprintf(firmware_version_val_str, 10, "%d", firmware_version_val); + + // Define mdns serive context + mdns_txt_item_t service_context_item[8] = + { + { + .key = "ID", + .value = id_val_str, + }, + { + .key = "name", + .value = (NULL == ezlopi_factory_info_v3_get_name() ? "null" : ezlopi_factory_info_v3_get_name()), + }, + { + .key = "manufacturer", + .value = (NULL == ezlopi_factory_info_v3_get_manufacturer() ? "null" : ezlopi_factory_info_v3_get_manufacturer()), + }, + { + .key = "brand", + .value = (NULL == ezlopi_factory_info_v3_get_brand() ? "null" : ezlopi_factory_info_v3_get_brand()) + }, + { + .key = "Model", + .value = (NULL == ezlopi_factory_info_v3_get_model() ? "null" : ezlopi_factory_info_v3_get_model()), + }, + { + .key = "ezlopi_device_type", + .value = (NULL == ezlopi_factory_info_v3_get_device_type() ? "null" : ezlopi_factory_info_v3_get_device_type()), + }, + { + .key = "ezlopi_firmware_version", + .value = firmware_version_val_str, + }, + { + .key = "ezlopi_firmware_build", + .value = "1.8.2", + }, + }; + + ESP_ERROR_CHECK(mdns_service_add("EzloPi_Serial", "_http", "_tcp", 80, service_context_item, 8)); free(hostname); } @@ -45,13 +95,13 @@ int ezlopi_core_initialize_mdns(void) /** Generate host name based on sdkconfig, optionally adding a portion of MAC address to it. * @return host name string allocated from the heap */ -static char *generate_hostname(void) +static char* generate_hostname(void) { #ifndef CONFIG_MDNS_ADD_MAC_TO_HOSTNAME return strdup(EXAMPLE_HOST_NAME); #else uint8_t mac[6]; - char *hostname; + char* hostname; esp_read_mac(mac, ESP_MAC_WIFI_STA); if (-1 == asprintf(&hostname, "%s-%02X%02X%02X", EXAMPLE_HOST_NAME, mac[3], mac[4], mac[5])) { From 73730fc2eb47ce6cf610ac22bc301dd41dcecdc3 Mon Sep 17 00:00:00 2001 From: NDJ-Ezlo Date: Tue, 27 Feb 2024 11:23:21 +0545 Subject: [PATCH 4/4] Added Kconfig as project configuration file --- ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c | 10 ++++------ ezlopi-main/Kconfig.projbuild | 12 ++++++++++++ sdkconfig | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c index 8b063059f..19bf5a8b9 100644 --- a/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c +++ b/ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c @@ -17,8 +17,6 @@ #include "ezlopi_core_mdns.h" -#define EXAMPLE_MDNS_INSTANCE "esp_instance" -#define EXAMPLE_HOST_NAME "ezlopi_device" static char* generate_hostname(void); @@ -32,7 +30,7 @@ static void initialise_mdns(void) ESP_ERROR_CHECK(mdns_hostname_set(hostname)); TRACE_D("mdns hostname set to: [%s]", hostname); // set default mDNS instance name - ESP_ERROR_CHECK(mdns_instance_name_set(EXAMPLE_MDNS_INSTANCE)); + ESP_ERROR_CHECK(mdns_instance_name_set(CONFIG_EZPI_MDNS_INSTANCE_NAME)); uint64_t id_val = ezlopi_factory_info_v3_get_id(); char* id_val_str = malloc(10 * sizeof(char)); @@ -81,7 +79,7 @@ static void initialise_mdns(void) }, }; - ESP_ERROR_CHECK(mdns_service_add("EzloPi_Serial", "_http", "_tcp", 80, service_context_item, 8)); + ESP_ERROR_CHECK(mdns_service_add(CONFIG_EZPI_MDNS_INSTANCE_NAME, "_http", "_tcp", 80, service_context_item, 8)); free(hostname); } @@ -98,12 +96,12 @@ int ezlopi_core_initialize_mdns(void) static char* generate_hostname(void) { #ifndef CONFIG_MDNS_ADD_MAC_TO_HOSTNAME - return strdup(EXAMPLE_HOST_NAME); + return strdup(CONFIG_EZPI_MDNS_INSTANCE_NAME); #else uint8_t mac[6]; char* hostname; esp_read_mac(mac, ESP_MAC_WIFI_STA); - if (-1 == asprintf(&hostname, "%s-%02X%02X%02X", EXAMPLE_HOST_NAME, mac[3], mac[4], mac[5])) + if (-1 == asprintf(&hostname, "%s-%02X%02X%02X", CONFIG_EZPI_MDNS_INSTANCE_NAME, mac[3], mac[4], mac[5])) { abort(); } diff --git a/ezlopi-main/Kconfig.projbuild b/ezlopi-main/Kconfig.projbuild index 26fcdadd0..51bb152de 100644 --- a/ezlopi-main/Kconfig.projbuild +++ b/ezlopi-main/Kconfig.projbuild @@ -31,6 +31,18 @@ menu "EzloPi User Config" default y help Enable BLE pairing + + config EZPI_MDNS_HOSTNAME + string "mDNS hostname" + default "ezlopi_device" + help + Set mDNS hostname + + config EZPI_MDNS_INSTANCE_NAME + string "mDNS instance name" + default "ezlopi_serial" + help + Set mDNS instance name endmenu diff --git a/sdkconfig b/sdkconfig index 8b5498bd4..e7e5b16ac 100644 --- a/sdkconfig +++ b/sdkconfig @@ -152,6 +152,8 @@ CONFIG_EZPI_UTIL_ENABLE_TRACE=y CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y # CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y +CONFIG_EZPI_MDNS_HOSTNAME="ezlopi_device" +CONFIG_EZPI_MDNS_INSTANCE_NAME="ezlopi_serial" # end of EzloPi User Config #