feat: Update esp_local_ctrl example for ESP32P4

This commit is contained in:
Harshit Malpani 2024-02-15 11:11:06 +05:30
parent 2df1ba8535
commit bae89606c3
No known key found for this signature in database
GPG Key ID: 441A8ACC7853D493
4 changed files with 15 additions and 13 deletions

View File

@ -2,19 +2,19 @@ menu "Example Configuration"
choice EXAMPLE_LOCAL_CTRL_TRANSPORT
bool "Local Control Transport"
default EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE if !SOC_WIFI_SUPPORTED
default EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
default EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
default EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE if SOC_BT_SUPPORTED
help
Local Control component offers both, SoftAP and BLE transports. Choose any one.
Local Control component offers both, HTTP/S and BLE transports. Choose any one.
config EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
bool "Soft AP"
config EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
bool "HTTP/S"
select LWIP_IPV4
depends on SOC_WIFI_SUPPORTED
config EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE
bool "BLE"
select BT_ENABLED
depends on SOC_BT_SUPPORTED
endchoice
choice EXAMPLE_PROTOCOMM_SECURITY_VERSION

View File

@ -39,7 +39,7 @@ void app_main(void)
}
ESP_ERROR_CHECK(ret);
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
@ -47,7 +47,7 @@ void app_main(void)
ESP_LOGI(TAG, "Connection failed, not starting esp_local_ctrl service");
vTaskDelay(portMAX_DELAY);
}
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
start_esp_local_ctrl_service();
ESP_LOGI(TAG, "esp_local_ctrl service started");

View File

@ -225,7 +225,7 @@ static void free_str(void *arg)
/* Function used by app_main to start the esp_local_ctrl service */
void start_esp_local_ctrl_service(void)
{
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
#ifdef CONFIG_ESP_HTTPS_SERVER_ENABLE
/* Set the configuration */
httpd_ssl_config_t https_conf = HTTPD_SSL_CONFIG_DEFAULT();
@ -262,7 +262,7 @@ void start_esp_local_ctrl_service(void)
0xb4, 0x42, 0xeb, 0x31, 0x4a, 0x1e, 0x98, 0x3d,
}
};
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
#ifdef CONFIG_EXAMPLE_PROTOCOMM_SECURITY_VERSION_1
/* What is the security level that we want (0, 1, 2):
@ -306,7 +306,7 @@ void start_esp_local_ctrl_service(void)
#endif
esp_local_ctrl_config_t config = {
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
.transport = ESP_LOCAL_CTRL_TRANSPORT_HTTPD,
.transport_config = {
#ifdef CONFIG_ESP_HTTPS_SERVER_ENABLE
@ -320,7 +320,7 @@ void start_esp_local_ctrl_service(void)
.transport_config = {
.ble = ble_conf,
},
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
.proto_sec = {
.version = security,
.custom_handle = NULL,
@ -337,7 +337,7 @@ void start_esp_local_ctrl_service(void)
.max_properties = 10
};
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
mdns_init();
mdns_hostname_set(SERVICE_NAME);
#endif

View File

@ -0,0 +1,2 @@
CONFIG_MDNS_PREDEF_NETIF_STA=n
CONFIG_MDNS_PREDEF_NETIF_AP=n