This commit is contained in:
edisondeng
2026-05-09 19:53:47 +08:00
parent 6e2b13dbb3
commit ee67076ec7
29 changed files with 4793 additions and 101 deletions

View File

@ -47,6 +47,7 @@
#include "wiz_interface.h"
#include "wizchip_conf.h"
#include "loopback.h"
#include "modbus_tcp_client.h"
#endif
extern void wiz_timer_handler(void);
#if (RF433_MODE == RF433_MODE_TX) || (RF433_MODE == RF433_MODE_BOTH)
@ -263,8 +264,16 @@ int main(void)
printf("[DEBUG] 4. 进入 network_init()\r\n");
network_init(ethernet_buf, &default_net_info);
printf("[DEBUG] 5. network_init() 成功返回!\r\n");
printf("wizchip UDP example started\r\n");
printf("[DEBUG] 5. network_init() 成功返回!\n");
printf("--- Socket Status Diagnostic ---\n");
for (int i=0; i<8; i++) {
printf("Socket %d SR: 0x%02X\n", i, getSn_SR(i));
}
printf("--------------------------------\n");
printf("Modbus TCP Client starting\n");
ModbusTCP_Client_Init(1); // 暂时使用 Socket 1 进行测试,避开可能被污染的 Socket 0
#endif
/* ======================================= */
@ -307,9 +316,9 @@ int main(void)
rf433_rx_app_task();
#endif
/* W5500 UDP回环任务 */
/* W5500 UDP回环任务(为了测试 PING 功能,放到了单独的 Socket 2 */
#if USE_W5500
loopback_udps(SOCKET_ID, ethernet_buf, local_port);
loopback_udps(2, ethernet_buf, local_port);
#endif
@ -389,9 +398,8 @@ int main(void)
}
#endif
// (D) W5500 以太网轮询处理 (Type 0x55)
#if USE_W5500
loopback_udps(SOCKET_ID, ethernet_buf, local_port);
ModbusTCP_Client_Task();
#endif
/* USER CODE END WHILE */