From 5bac7ae67b3dafe931773c946c4f825c5d2f7203 Mon Sep 17 00:00:00 2001 From: kerms Date: Sat, 22 Jun 2024 14:57:34 +0800 Subject: [PATCH] change system api ID to 0 --- .gitignore | 2 +- partitions.csv | 12 ++++---- .../wifi_manager/wifi_api_json.c | 2 -- .../wifi_manager/wifi_api_json.h | 4 --- project_components/wt_common/CMakeLists.txt | 7 ++++- project_components/wt_common/wt_data_def.h | 30 +++++++++++-------- project_components/wt_system/CMakeLists.txt | 17 +++++++++-- project_components/wt_system/wt_system_api.h | 2 +- 8 files changed, 47 insertions(+), 29 deletions(-) delete mode 100644 project_components/wifi_manager/wifi_api_json.h diff --git a/.gitignore b/.gitignore index 5163390..3141ce8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ sdkconfig dependencies.lock package-lock.json managed_components/ -version.txt \ No newline at end of file +/version.txt \ No newline at end of file diff --git a/partitions.csv b/partitions.csv index ecf6af0..c641bc8 100755 --- a/partitions.csv +++ b/partitions.csv @@ -2,9 +2,9 @@ # 1st stage ROM ,data, , # 2nd stage boot ,data,0x1000, # partition table,data,0xF000,4K(0x1000), -begin ,0x40,0x00 , ,0k , -nvs ,data,nvs ,0x10000,16K , -phy_init ,data,phy , ,4K , -none0 ,0x40,0x00 , ,0k , -ota_0 ,app ,ota_0 ,0x20000,0x1B0000, -wt_nvs ,data,nvs , ,64K , +begin ,0x40,0x00 , ,0k , +nvs ,data,nvs ,0x10000 ,16K , +phy_init,data,phy , ,4K , +none0 ,0x40,0x00 , ,0k , +ota_0 ,app ,ota_0,0x20000 ,0x1B0000, +wt_nvs ,data,nvs , ,64K , diff --git a/project_components/wifi_manager/wifi_api_json.c b/project_components/wifi_manager/wifi_api_json.c index e292b19..ae2d08a 100644 --- a/project_components/wifi_manager/wifi_api_json.c +++ b/project_components/wifi_manager/wifi_api_json.c @@ -1,5 +1,3 @@ -#include "wifi_api_json.h" - #include "api_json_module.h" #include "wifi_api.h" #include "wifi_json_utils.h" diff --git a/project_components/wifi_manager/wifi_api_json.h b/project_components/wifi_manager/wifi_api_json.h deleted file mode 100644 index 2e7a56d..0000000 --- a/project_components/wifi_manager/wifi_api_json.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef WIFI_API_JSON_H_GUARD -#define WIFI_API_JSON_H_GUARD - -#endif //WIFI_API_JSON_H_GUARD \ No newline at end of file diff --git a/project_components/wt_common/CMakeLists.txt b/project_components/wt_common/CMakeLists.txt index 5b1ca69..4cec55b 100644 --- a/project_components/wt_common/CMakeLists.txt +++ b/project_components/wt_common/CMakeLists.txt @@ -1,3 +1,8 @@ +file(GLOB SOURCES *.c + ) + + idf_component_register( + SRCS ${SOURCES} INCLUDE_DIRS "." -) +) \ No newline at end of file diff --git a/project_components/wt_common/wt_data_def.h b/project_components/wt_common/wt_data_def.h index 583d9da..cd1e3ae 100644 --- a/project_components/wt_common/wt_data_def.h +++ b/project_components/wt_common/wt_data_def.h @@ -9,33 +9,34 @@ #include +#define DECLARE_HANDLE(name) struct name##__ { int unused[0]; }; \ + typedef struct name##__ *name + typedef enum wt_data_type_t { WT_DATA_RESERVED = 0x00, + /* primitive type */ WT_DATA_EVENT = 0x02, + WT_DATA_ROUTE_HDR = 0x03, + WT_DATA_RAW_BROADCAST = 0x04, + /* data_type */ /* broadcast data */ - WT_DATA_RAW_BROADCAST = 0x10, WT_DATA_CMD_BROADCAST = 0x11, /* targeted data */ - WT_DATA_ROUTE_HDR = 0x20, - WT_DATA_RAW = 0x21, - WT_DATA_CMD = 0x22, - WT_DATA_RESPONSE = 0x23, + WT_DATA_RAW = 0x20, + WT_DATA_CMD = 0x21, + WT_DATA_RESPONSE = 0x22, /* standard protocols */ WT_DATA_PROTOBUF = 0x40, WT_DATA_JSON = 0x41, WT_DATA_MQTT = 0x42, - - WT_USER_DATA_TYPE_BEGIN = 0xA0, - WT_USER_DATA_TYPE_END = 0xFE, - WT_DATA_TYPE_MAX = 0xFF, } __attribute__((packed)) wt_data_type_t; _Static_assert(sizeof(wt_data_type_t) == 1, "wt_data_type_t must be 1 byte"); typedef struct wt_bin_data_hdr_t { - wt_data_type_t data_type; /* type of the hdr+payload */ + wt_data_type_t data_type; /* type of the payload */ union { /* when targeted message -> bin data handle */ struct { @@ -61,12 +62,17 @@ typedef struct wt_bin_data_internal_t { struct { uint64_t Dummy1; uint64_t Dummy2; - } Dummy; /* 16 byte padding for httpd_ws_frame */ - struct { + } ws_frame_slot; /* 16 byte padding for httpd_ws_frame */ + struct { /* */ uint16_t data_len; uint8_t src_module; uint8_t src_sub_module; }; + struct { /* */ + uint8_t send_count; + uint8_t reserved1; + uint16_t reserved2; + }; wt_bin_data_t data; } wt_bin_data_internal_t; diff --git a/project_components/wt_system/CMakeLists.txt b/project_components/wt_system/CMakeLists.txt index 67195b1..c74f790 100644 --- a/project_components/wt_system/CMakeLists.txt +++ b/project_components/wt_system/CMakeLists.txt @@ -8,6 +8,19 @@ idf_component_register( global_resource esp_app_format api_router ) -string(TIMESTAMP CURRENT_DATE "%Y-%m-%d") -add_compile_definitions(FW_UPD_DATE="${CURRENT_DATE}") +# Execute the Git command to get the formatted commit date +execute_process( + COMMAND git show -s --format=%cd --date=format:'%Y-%m-%d' + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE FM_DATE + RESULT_VARIABLE result + ERROR_VARIABLE git_error + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +if(NOT "${result}" STREQUAL "0") + message(WARNING "Git command failed with: ${git_error}") +endif() + +target_compile_definitions(${COMPONENT_LIB} PRIVATE FW_UPD_DATE="${FM_DATE}") idf_component_set_property(${COMPONENT_NAME} WHOLE_ARCHIVE ON) diff --git a/project_components/wt_system/wt_system_api.h b/project_components/wt_system/wt_system_api.h index 0719d77..2a2a10a 100644 --- a/project_components/wt_system/wt_system_api.h +++ b/project_components/wt_system/wt_system_api.h @@ -7,7 +7,7 @@ #ifndef WT_SYSTEM_API_H_GUARD #define WT_SYSTEM_API_H_GUARD -#define SYSTEM_MODULE_ID 6 +#define SYSTEM_MODULE_ID 0 typedef enum wt_system_cmd_t { WT_SYS_GET_FM_INFO = 1,