feat(802.15.4): IEEE802.15.4 add documentation and refactor component structure

This commit is contained in:
Tan Yan Quan
2024-12-16 10:53:32 +08:00
parent 199b866187
commit f1393f7687
8 changed files with 90 additions and 14 deletions
@@ -401,15 +401,15 @@ void ieee802154_rx_buffer_statistic_print(void)
for (uint8_t i = 0; i < (IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL + 1); i++) {
total_times += s_rx_buffer_used_water_level[i];
}
ESP_LOGW(IEEE802154_TAG, "+--------------------+-------------------------+-------------------------+");
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-25s|%-25u|", "rx buff total size:", "", CONFIG_IEEE802154_RX_BUFFER_SIZE);
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-25s|%-25llu|", "buffer alloc times:", "", total_times);
ESP_LOGW(IEEE802154_TAG, "+--------------------+-------------------------+-------------------------+");
ESP_LOGW(IEEE802154_TAG, "+-------------------------+-------------------------+");
ESP_LOGW(IEEE802154_TAG, "|%25s|%-25u|", "rx buff total size:", CONFIG_IEEE802154_RX_BUFFER_SIZE);
ESP_LOGW(IEEE802154_TAG, "|%25s|%-25llu|", "buffer alloc times:", total_times);
ESP_LOGW(IEEE802154_TAG, "+-------------------------+-------------------------+");
for (uint8_t i = 0; i < (IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL); i++) {
ESP_LOGW(IEEE802154_TAG, "|%-20s|%4d%%%5s%4d%%%-10s|%-15llu%9.2f%%|", "", ((i) * 100 / IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL), "~", ((i + 1) * 100 / IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL), " used:", s_rx_buffer_used_water_level[i], ((float)s_rx_buffer_used_water_level[i] / (float)total_times)*100);
ESP_LOGW(IEEE802154_TAG, "|%4d%%%5s%4d%%%10s|%-15llu%9.2f%%|", ((i) * 100 / IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL), "~", ((i + 1) * 100 / IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL), " used:", s_rx_buffer_used_water_level[i], ((float)s_rx_buffer_used_water_level[i] / (float)total_times)*100);
}
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-25s|%-15llu%9.2f%%|", "", "full used:", s_rx_buffer_used_water_level[IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL], ((float)s_rx_buffer_used_water_level[IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL] / (float)total_times)*100);
ESP_LOGW(IEEE802154_TAG, "+--------------------+-------------------------+-------------------------+");
ESP_LOGW(IEEE802154_TAG, "|%25s|%-15llu%9.2f%%|", "full used:", s_rx_buffer_used_water_level[IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL], ((float)s_rx_buffer_used_water_level[IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL] / (float)total_times)*100);
ESP_LOGW(IEEE802154_TAG, "+-------------------------+-------------------------+");
}
#endif // CONFIG_IEEE802154_RX_BUFFER_STATISTIC
@@ -8,5 +8,6 @@ set(include "."
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS include
PRIV_REQUIRES ieee802154 console fatfs nvs_flash esp_phy cmd_ieee802154 cmd_ieee802154_stats cmd_system
PRIV_REQUIRES ieee802154 console fatfs nvs_flash esp_phy cmd_ieee802154
cmd_ieee802154_debug cmd_system
WHOLE_ARCHIVE)
@@ -16,7 +16,7 @@
#include "esp_phy_init.h"
#include "ieee802154_cmd.h"
#include "cmd_system.h"
#include "ieee802154_stats.h"
#include "ieee802154_debug.h"
#define PROMPT_STR "ieee802154"