Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ezpi 395 distro clean #135

Merged
merged 3 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ void ezlopi_init(void)

ezlopi_timer_start_1000ms();

// #if defined(EZPI_ENABLE_MDNS_SERVICE)
#ifdef CONFIG_EZPI_SERV_MDNS_EN
EZPI_core_init_mdns();
// #endif
#endif // CONFIG_EZPI_SERV_MDNS_EN
}

l_ezlopi_device_t* link_next_parent_id(uint32_t target_to_clear_parent_id)
Expand Down
4 changes: 3 additions & 1 deletion ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

#if 1 // def CONFIG_EZPI_SERV_MDNS_EN
#include "../../build/config/sdkconfig.h"

#ifdef CONFIG_EZPI_SERV_MDNS_EN

#include <string.h>
#include "freertos/FreeRTOS.h"
Expand Down
6 changes: 4 additions & 2 deletions ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#ifndef __EZLOPI_CORE_MDNS_H_
#define __EZLOPI_CORE_MDNS_H_

// #ifdef CONFIG_EZPI_SERV_MDNS_EN
#include "../../build/config/sdkconfig.h"

#ifdef CONFIG_EZPI_SERV_MDNS_EN

#include "mdns.h"

Expand All @@ -18,6 +20,6 @@ typedef struct l_ezlopi_mdns_context

int EZPI_core_init_mdns();

// #endif // __EZLOPI_CORE_MDNS_H_
#endif // CONFIG_EZPI_SERV_MDNS_EN
#endif // __EZLOPI_CORE_MDNS_H_

2 changes: 1 addition & 1 deletion ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define EZLOPI_CORE_SCENES_SCRIPT_PROCESS_TASK_DEPTH ( 2 * EZLOPI_MINIMAL_STACK_SIZE )
#define EZLOPI_CORE_WIFI_SCANNER_TASK_DEPTH ( 2 * EZLOPI_MINIMAL_STACK_SIZE )

#define EZLOPI_MAIN_BLINKY_TASK_DEPTH ( 6 * EZLOPI_MINIMAL_STACK_SIZE )
#define EZLOPI_MAIN_BLINKY_TASK_DEPTH ( 2 * EZLOPI_MINIMAL_STACK_SIZE )

#define EZLOPI_HAL_UART_TASK_DEPTH ( 2 * EZLOPI_MINIMAL_STACK_SIZE )

Expand Down
71 changes: 11 additions & 60 deletions ezlopi-main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -1,40 +1,6 @@

menu "EzloPi User Config"

choice EZPI_DISTRO
prompt "Select from available distros:"
depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32
default EZPI_DISTRO_FULL_OPTION

config EZPI_DISTRO_FULL_OPTION
bool "1. EZPI_DISTRO_FULL_OPTION"

config EZPI_DISTRO_LOCAL
bool "2. EZPI_DISTRO_LOCAL"

config EZPI_DISTRO_LOCAL_MESHBOT
bool "3. EZPI_DISTRO_LOCAL_MESHBOT"

config EZPI_DISTRO_CLOUD
bool "4. EZPI_DISTRO_CLOUD"

config EZPI_DISTRO_CLOUD_MESHBOT
bool "5. EZPI_DISTRO_CLOUD_MESHBOT"

config EZPI_DISTRO_BLE_CLOUD
bool "6. EZPI_DISTRO_BLE_CLOUD"

config EZPI_DISTRO_WIFI_HUB
bool "7. EZPI_DISTRO_WIFI_HUB"

config EZPI_DISTRO_BLE_HUB
bool "8. EZPI_DISTRO_BLE_HUB"

config EZPI_DISTRO_MINIMAL
bool "9. EZPI_DISTRO_MINIMAL"

endchoice

config EZPI_HEAP_ENABLE
bool "Enable ezlopi heap"
default n
Expand All @@ -53,8 +19,7 @@ menu "EzloPi User Config"
help
ezlopi-util-trace component is enabled to log the outputs to the serial monitor

config EZPI_BLE_ENABLE
depends on EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL || EZPI_DISTRO_LOCAL_MESHBOT || EZPI_DISTRO_CLOUD_MESHBOT || EZPI_DISTRO_BLE_CLOUD || EZPI_DISTRO_BLE_HUB || EZPI_DISTRO_MINIMAL
config EZPI_BLE_ENABLE
bool "Enable BLE"
default n
help
Expand All @@ -76,7 +41,7 @@ menu "EzloPi User Config"

config EZPI_CORE_ENABLE_ETH
bool "Enable ethernet"
depends on ETH_USE_SPI_ETHERNET || EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL
depends on ETH_USE_SPI_ETHERNET
default n
help
ezlopi-core-ethernet component is enabled
Expand All @@ -86,7 +51,6 @@ menu "EzloPi User Config"
default y
help
ezlopi-core-wifi component is enabled


config EZPI_ENABLE_OTA
depends on EZPI_ENABLE_WIFI || EZPI_CORE_ENABLE_ETH
Expand All @@ -95,6 +59,12 @@ menu "EzloPi User Config"
help
Enable OTA

config EZPI_SERV_MDNS_EN
bool "Enable mDNS service"
default y
help
Enable mDNS service. mDNS broadcast informations of device.

config EZPI_ENABLE_PING
depends on EZPI_ENABLE_WIFI || EZPI_CORE_ENABLE_ETH
bool "Enable ping"
Expand All @@ -104,20 +74,19 @@ menu "EzloPi User Config"

config EZPI_ENABLE_UART_PROVISIONING
bool "Enable UART provisioning"
depends on EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_CLOUD_MESHBOT || EZPI_DISTRO_MINIMAL
default n
help
Enable provisioning and monitoring via UART

config EZPI_LOCAL_WEBSOCKET_SERVER
depends on (HTTPD_WS_SUPPORT && (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL || EZPI_DISTRO_LOCAL_MESHBOT))
depends on (HTTPD_WS_SUPPORT && (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ))
bool "Enable local websocket server"
default n
help
Enable local websocket server

config EZPI_WEBSOCKET_CLIENT
depends on (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_CLOUD || EZPI_DISTRO_CLOUD_MESHBOT || EZPI_DISTRO_BLE_CLOUD || EZPI_DISTRO_WIFI_HUB || EZPI_DISTRO_BLE_HUB || EZPI_DISTRO_MINIMAL)
depends on (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI )
bool "Enable Web-Socket client"
default n
help
Expand All @@ -131,7 +100,7 @@ menu "EzloPi User Config"
Static buffer is used to broadcast data. Data is broadcasted by local-websocket-server and websocket-client. Default value is 10KB"

config EZPI_SERV_ENABLE_MESHBOTS
depends on (EZPI_WEBSOCKET_CLIENT || EZPI_LOCAL_WEBSOCKET_SERVER) && (EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL_MESHBOT || EZPI_DISTRO_CLOUD_MESHBOT )
depends on (EZPI_WEBSOCKET_CLIENT || EZPI_LOCAL_WEBSOCKET_SERVER)
bool "Enable meshbot service"
default n
help
Expand All @@ -150,28 +119,10 @@ menu "EzloPi User Config"
help
Enable indicator LED available in the device

config EZPI_SERV_MDNS_EN
bool "Enable mDNS service"
default n
help
Enable mDNS service. mDNS broadcast informations of device.


menu "EzloPi mDNS config"
depends on EZPI_SERV_MDNS_EN

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

config EZPI_MDNS_ENABLE_EXTRA_SERVICES
bool "mDNS enable extra services"
default n
Expand Down
26 changes: 2 additions & 24 deletions ezlopi-main/ezlopi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ void app_main(void)


TaskHandle_t ezlopi_main_blinky_task_handle = NULL;

#if defined(CONFIG_EZPI_HEAP_ENABLE)
xTaskCreate(blinky, "blinky", 3 * EZLOPI_MAIN_BLINKY_TASK_DEPTH, NULL, 1, &ezlopi_main_blinky_task_handle);
xTaskCreate(__blinky, "blinky", 3 * EZLOPI_MAIN_BLINKY_TASK_DEPTH, NULL, 1, &ezlopi_main_blinky_task_handle);
ezlopi_core_process_set_process_info(ENUM_EZLOPI_MAIN_BLINKY_TASK, &ezlopi_main_blinky_task_handle, 3 * EZLOPI_MAIN_BLINKY_TASK_DEPTH);
#else
xTaskCreate(__blinky, "blinky", EZLOPI_MAIN_BLINKY_TASK_DEPTH, NULL, 1, &ezlopi_main_blinky_task_handle);
Expand All @@ -105,18 +106,13 @@ static void __blinky(void* pv)

while (1)
{
#if 0
UBaseType_t total_task_numbers = uxTaskGetNumberOfTasks();
TaskStatus_t task_array[total_task_numbers];
#endif

TRACE_I("----------------------------------------------");
uint32_t free_heap = esp_get_free_heap_size();
uint32_t watermark_heap = esp_get_minimum_free_heap_size();
TRACE_W("Free Heap Size: %d B %.4f KB", free_heap, free_heap / 1024.0);
TRACE_W("Heap Watermark: %d B %.4f KB", watermark_heap, watermark_heap / 1024.0);
TRACE_I("----------------------------------------------");
// char heartbeat[100];
printf("{\"cmd\":99,\"free_heap\":%d,\"heap_watermark\":%d}\n", free_heap, watermark_heap);

if (free_heap <= (10 * 1024))
Expand All @@ -137,29 +133,11 @@ static void __blinky(void* pv)
low_heap_start_time = xTaskGetTickCount();
}


#ifdef CONFIG_EZPI_HEAP_ENABLE
ezlopi_util_heap_trace(false);
ezlopi_util_heap_flush();
#endif // CONFIG_EZPI_HEAP_ENABLE

#if 0

uxTaskGetSystemState(task_array, total_task_numbers, NULL);

for (int i = 0; i < total_task_numbers; i++) {
if (task_array[i].pcTaskName)
{
TRACE_D("Process Name: %s, \tPID: %d, \tBase: %p, \tWatermark: %.2f KB",
task_array[i].pcTaskName,
task_array[i].xTaskNumber,
task_array[i].pxStackBase,
task_array[i].usStackHighWaterMark / 1024.0);
}
}
#endif


vTaskDelay(5000 / portTICK_PERIOD_MS);
}
}
8 changes: 4 additions & 4 deletions ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ static void ezlopi_ble_basic_init(void)
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));
CHECK_PRINT_ERROR(esp_bt_controller_init(&bt_cfg), "initialize controller failed");

// #if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
CHECK_PRINT_ERROR(esp_bt_controller_enable(ESP_BT_MODE_BLE), "enable controller failed");
// #elif defined(CONFIG_IDF_TARGET_ESP32)
// CHECK_PRINT_ERROR(esp_bt_controller_enable(ESP_BT_MODE_BTDM), "enable controller failed");
// #endif
#elif defined(CONFIG_IDF_TARGET_ESP32)
CHECK_PRINT_ERROR(esp_bt_controller_enable(ESP_BT_MODE_BLE), "enable controller failed");
#endif

CHECK_PRINT_ERROR(esp_bluedroid_init(), "init bluetooth failed");
CHECK_PRINT_ERROR(esp_bluedroid_enable(), "enable bluetooth failed");
Expand Down
4 changes: 2 additions & 2 deletions ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void __dump(const char* file_name, uint32_t line, char* buffer_name, void* _buff
int lines = cnt >> 4;
int l;

printf("%s (%d):: %s: Total Size: %d\r\n", file_name, line, buffer_name, cnt);
printf("%s (%d):: %s: Total Size: %d\n", file_name, line, buffer_name, cnt);

for (l = 0; l < lines; l++)
{
Expand All @@ -66,7 +66,7 @@ void __dump(const char* file_name, uint32_t line, char* buffer_name, void* _buff
put_idump(&buff[l * 16], ofs + l * 16, cnt & 0x0F);
}

ets_printf("\n\n");
ets_printf("\n");
fflush(stdout);
}

Expand Down
6 changes: 3 additions & 3 deletions ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern "C"

#define trace_color(txt_color, X, reg...) \
{ \
printf("\x1B[%sm %s[%d]:" X "\x1B[0m\r\n", txt_color, __FILE__, __LINE__, ##reg); \
printf("\x1B[%sm %s[%d]:" X "\x1B[0m\n", txt_color, __FILE__, __LINE__, ##reg); \
}

#if 0
Expand All @@ -71,7 +71,7 @@ extern "C"

#define trace(X, reg...) \
{ \
printf("%s[%d]:" X "\r\n", __FILE__, __LINE__, ##reg); \
printf("%s[%d]:" X "\n", __FILE__, __LINE__, ##reg); \
}

#define trace_log_sev_error(X, reg...) trace_color_print(COLOR_FONT_RED, 1, __FILE__, __LINE__, X, ##reg)
Expand All @@ -98,7 +98,7 @@ extern "C"

#define TRACE_Dg(bg, txt, X, reg...) \
{ \
printf("\x1B[%s;%sm %s[%d]:" X "\x1B[0m\r\n", txt, bg, __FILE__, __LINE__, ##reg); \
printf("\x1B[%s;%sm %s[%d]:" X "\x1B[0m\n", txt, bg, __FILE__, __LINE__, ##reg); \
}

#define TRACE_Dw(X, reg...) TRACE_Dg(COLOR_BG_BLACK, COLOR_FONT_WHITE, X, ##reg)
Expand Down
Loading