diff --git a/COMPLETION.md b/COMPLETION.md index 0a003e3..8d20a66 100644 --- a/COMPLETION.md +++ b/COMPLETION.md @@ -41,7 +41,7 @@ | Modbus 主站管理 | `libmodbus_m`(原工程自研模块,导入+适配) | ✅ | | 通讯通道解码 | `libcom_decode` | ⬜ | | Web 管理服务 | `libweb_server` | ⬜ | -| 主程序入口 | `RTU` | ⬜ | +| 主程序入口 | `RTU`(系统模块框架 + app_modules.c + main.c) | ✅ | ## 阶段 3:系统集成 diff --git a/release/copy_headers.sh b/release/copy_headers.sh index 0d9deaa..cc210cf 100755 --- a/release/copy_headers.sh +++ b/release/copy_headers.sh @@ -106,6 +106,5 @@ copy_proto_module "lib60870" "myIec60870.h" # 系统模块(system/) # ================================================================ copy_sys_header "mySystem.h" -copy_sys_module "libmodbus_m" "myModbusM.h" echo "=== done ===" diff --git a/src/system/libmodbus_m/inc/myModbusM.h b/src/system/libmodbus_m/inc/myModbusM.h deleted file mode 100644 index 1f161d9..0000000 --- a/src/system/libmodbus_m/inc/myModbusM.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @file myModbusM.h - * @brief Modbus 主站管理模块统一入口 - * @details 原工程自研模块,通过 XML 配置通道和点表,轮询读取 Modbus 从站数据, - * 写入 libdatacenter,支持遥控/遥调异步写入。 - * 调用者只需 #include "myModbusM.h"。 - */ -#ifndef _MY_MODBUS_M_H_ -#define _MY_MODBUS_M_H_ - -#include "modbus_m.h" - -#endif /* _MY_MODBUS_M_H_ */ diff --git a/src/system/libmodbus_m/src/modbus_m.cpp b/src/system/libmodbus_m/src/modbus_m.cpp index beff9a6..61bbcfa 100644 --- a/src/system/libmodbus_m/src/modbus_m.cpp +++ b/src/system/libmodbus_m/src/modbus_m.cpp @@ -1017,3 +1017,19 @@ void *app_modbus_m(void *arg) return NULL; } + +// ==================== 模块注册 ==================== + +static stru_app g_app_modbus_m; + +extern "C" void app_modbus_m_register(void) +{ + memset(&g_app_modbus_m, 0, sizeof(g_app_modbus_m)); + g_app_modbus_m.name = MODULE_MODBUS_M; + + app_module_register(MODULE_MODBUS_M, + app_modbus_m_init1, + app_modbus_m_init2, + app_modbus_m, + &g_app_modbus_m); +}