From 38b9663320366ec4a48d3885e06bd6f7b50d272b Mon Sep 17 00:00:00 2001 From: YuanHongbin <975559679@qq.com> Date: Mon, 13 Jul 2026 15:51:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(eth):=20=E5=88=A0=E9=99=A4ETH=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=85=8D=E7=BD=AE/=E6=98=BE=E7=A4=BA=E5=8F=8A?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E7=BB=93=E6=9E=84=E4=BD=93,=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E5=9F=BA=E6=9C=AC=E9=80=9A=E8=AE=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 EthIpMode_m/EthWorkMode_m 枚举,EthNetPara_t 改用 uint8_t - 删除 ETHApplyNetPara() 函数及其调用 - 删除 main.c 中 ETH 默认参数初始化 - 删除 DebugCmdEthNet CLI配置命令 - 删除 DebugCmdGetPara 中 ETH 参数显示 - 保留 ETHTriggerRegister/EthLoopHandler 等基本通讯 --- .../source/Module/GateWay_Debug/DebugCmd.c | 233 ------------------ Project/GateWay/source/User/Inc/CatOneTask.h | 1 - Project/GateWay/source/User/Inc/Public.h | 13 +- Project/GateWay/source/User/Src/CatOneTask.c | 110 --------- Project/GateWay/source/User/Src/main.c | 24 +- 5 files changed, 4 insertions(+), 377 deletions(-) diff --git a/Project/GateWay/source/Module/GateWay_Debug/DebugCmd.c b/Project/GateWay/source/Module/GateWay_Debug/DebugCmd.c index 2495bee..c2ccec5 100644 --- a/Project/GateWay/source/Module/GateWay_Debug/DebugCmd.c +++ b/Project/GateWay/source/Module/GateWay_Debug/DebugCmd.c @@ -1288,221 +1288,6 @@ static void DebugCmdSetMac(int argc, char *argv[]) DBG_LOG("Set gateway mac Address completed.\r\n"); } -/***************************************************************************************** -* : DebugCmdEthNet -* : EthNet̫ģ -* : argc, - argv, -* ֵ: -*****************************************************************************************/ -static void DebugCmdEthNet(int argc, char *argv[]) -{ - DBG_LOG("\r\n"); - int IP[4]; - - if(argc < 2) - return; - - if(strcmp(argv[1], "?") == 0) { - DBG_LOG("Debug Cmd: eth arg1 arg2\r\n"); - DBG_LOG(" brief --> Configure EthNet Ethernet module parameters.\r\n"); - DBG_LOG(" arg1 --> subcommand\r\n"); - DBG_LOG(" arg2 --> parameter value\r\n\r\n"); - DBG_LOG(" Subcommands:\r\n"); - DBG_LOG(" mode dhcp/static - Set IP mode (DHCP or Static)\r\n"); - DBG_LOG(" ip x.x.x.x - Set local IP address\r\n"); - DBG_LOG(" port xxxx - Set local port\r\n"); - DBG_LOG(" wmode tcp/udp - Set work mode (TCP client/UDP)\r\n"); - DBG_LOG(" mask x.x.x.x - Set subnet mask\r\n"); - DBG_LOG(" gw x.x.x.x - Set gateway\r\n"); - DBG_LOG(" dip x.x.x.x - Set destination IP\r\n"); - DBG_LOG(" dport xxxx - Set destination port\r\n"); - DBG_LOG(" save - Save parameters to Flash\r\n"); - DBG_LOG(" apply - Apply and restart ETH module\r\n\r\n"); - return; - } - - if(strcmp(argv[1], "save") == 0) { - WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t)); - DBG_LOG("EthNet parameters saved to Flash.\r\n"); - return; - } - - if(strcmp(argv[1], "apply") == 0) { - WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t)); - /* жϵǰͨѶ״̬,ETHCAT1ǻ */ - if(GateWay->ConfigPara.Comm == CATONE_COMM) { - DBG_LOG("EthCmd Error: Currently using CAT1 communication.\r\n"); - DBG_LOG("Please switch to ETH mode first using 'comm eth' command.\r\n"); - return; - } - GateWay->SvrRegFlag = false; - ETHReset(); - DBG_LOG("EthNet parameters saved and ETH module restarting...\r\n"); - return; - } - - if(argc < 3) { - DBG_LOG("EthCmd: Missing parameter value.\r\n"); - return; - } - - if(strcmp(argv[1], "mode") == 0) { - if(strcmp(argv[2], "dhcp") == 0) { - GateWay->ConfigPara.EthNet.IpMode = ETH_IP_DHCP; - DBG_LOG("IpMode set to DHCP.\r\n"); - } - else if(strcmp(argv[2], "static") == 0) { - GateWay->ConfigPara.EthNet.IpMode = ETH_IP_STATIC; - DBG_LOG("IpMode set to STATIC.\r\n"); - } - else { - DBG_LOG("EthCmd: Invalid mode, use dhcp or static.\r\n"); - } - return; - } - - if(strcmp(argv[1], "ip") == 0) { - if(argc < 3) { - DBG_LOG("EthCmd: Missing IP address\r\n"); - return; - } - int ret = sscanf(argv[2], "%d.%d.%d.%d", &IP[0], &IP[1], &IP[2], &IP[3]); - if(ret != 4) { - DBG_LOG("EthCmd: Invalid IP format, use x.x.x.x\r\n"); - return; - } - if(IP[0] > 255 || IP[1] > 255 || IP[2] > 255 || IP[3] > 255) { - DBG_LOG("EthCmd: IP address out of range.\r\n"); - return; - } - GateWay->ConfigPara.EthNet.IpAddr[0] = IP[0]; - GateWay->ConfigPara.EthNet.IpAddr[1] = IP[1]; - GateWay->ConfigPara.EthNet.IpAddr[2] = IP[2]; - GateWay->ConfigPara.EthNet.IpAddr[3] = IP[3]; - DBG_LOG("Local IP set to %d.%d.%d.%d\r\n", IP[0], IP[1], IP[2], IP[3]); - return; - } - - if(strcmp(argv[1], "port") == 0) { - if(argc < 3) { - DBG_LOG("EthCmd: Missing port number\r\n"); - return; - } - int port = atoi(argv[2]); - if(port <= 0 || port > 65535) { - DBG_LOG("EthCmd: Port out of range (1-65535).\r\n"); - return; - } - GateWay->ConfigPara.EthNet.IpPort = port; - DBG_LOG("Local Port set to %d\r\n", port); - return; - } - - if(strcmp(argv[1], "wmode") == 0) { - if(argc < 3) { - DBG_LOG("EthCmd: Missing work mode (tcp/udp)\r\n"); - return; - } - if(strcmp(argv[2], "tcp") == 0) { - GateWay->ConfigPara.EthNet.WorkMode = ETH_MODE_TCP_CLIENT; - DBG_LOG("WorkMode set to TCP_CLIENT.\r\n"); - } - else if(strcmp(argv[2], "udp") == 0) { - GateWay->ConfigPara.EthNet.WorkMode = ETH_MODE_UDP; - DBG_LOG("WorkMode set to UDP.\r\n"); - } - else { - DBG_LOG("EthCmd: Invalid work mode, use tcp or udp.\r\n"); - } - return; - } - - if(strcmp(argv[1], "mask") == 0) { - if(argc < 3) { - DBG_LOG("EthCmd: Missing subnet mask\r\n"); - return; - } - int ret = sscanf(argv[2], "%d.%d.%d.%d", &IP[0], &IP[1], &IP[2], &IP[3]); - if(ret != 4) { - DBG_LOG("EthCmd: Invalid mask format, use x.x.x.x\r\n"); - return; - } - if(IP[0] > 255 || IP[1] > 255 || IP[2] > 255 || IP[3] > 255) { - DBG_LOG("EthCmd: Subnet mask out of range.\r\n"); - return; - } - GateWay->ConfigPara.EthNet.SubnetMask[0] = IP[0]; - GateWay->ConfigPara.EthNet.SubnetMask[1] = IP[1]; - GateWay->ConfigPara.EthNet.SubnetMask[2] = IP[2]; - GateWay->ConfigPara.EthNet.SubnetMask[3] = IP[3]; - DBG_LOG("SubnetMask set to %d.%d.%d.%d\r\n", IP[0], IP[1], IP[2], IP[3]); - return; - } - - if(strcmp(argv[1], "gw") == 0) { - if(argc < 3) { - DBG_LOG("EthCmd: Missing gateway address\r\n"); - return; - } - int ret = sscanf(argv[2], "%d.%d.%d.%d", &IP[0], &IP[1], &IP[2], &IP[3]); - if(ret != 4) { - DBG_LOG("EthCmd: Invalid gateway format, use x.x.x.x\r\n"); - return; - } - if(IP[0] > 255 || IP[1] > 255 || IP[2] > 255 || IP[3] > 255) { - DBG_LOG("EthCmd: Gateway out of range.\r\n"); - return; - } - GateWay->ConfigPara.EthNet.Gateway[0] = IP[0]; - GateWay->ConfigPara.EthNet.Gateway[1] = IP[1]; - GateWay->ConfigPara.EthNet.Gateway[2] = IP[2]; - GateWay->ConfigPara.EthNet.Gateway[3] = IP[3]; - DBG_LOG("Gateway set to %d.%d.%d.%d\r\n", IP[0], IP[1], IP[2], IP[3]); - return; - } - - if(strcmp(argv[1], "dip") == 0) { - if(argc < 3) { - DBG_LOG("EthCmd: Missing destination IP address\r\n"); - return; - } - int ret = sscanf(argv[2], "%d.%d.%d.%d", &IP[0], &IP[1], &IP[2], &IP[3]); - if(ret != 4) { - DBG_LOG("EthCmd: Invalid destination IP format, use x.x.x.x\r\n"); - return; - } - if(IP[0] > 255 || IP[1] > 255 || IP[2] > 255 || IP[3] > 255) { - DBG_LOG("EthCmd: Destination IP out of range.\r\n"); - return; - } - GateWay->ConfigPara.EthNet.DestIp[0] = IP[0]; - GateWay->ConfigPara.EthNet.DestIp[1] = IP[1]; - GateWay->ConfigPara.EthNet.DestIp[2] = IP[2]; - GateWay->ConfigPara.EthNet.DestIp[3] = IP[3]; - DBG_LOG("DestIP set to %d.%d.%d.%d\r\n", IP[0], IP[1], IP[2], IP[3]); - return; - } - - if(strcmp(argv[1], "dport") == 0) { - if(argc < 3) { - DBG_LOG("EthCmd: Missing destination port\r\n"); - return; - } - int port = atoi(argv[2]); - if(port <= 0 || port > 65535) { - DBG_LOG("EthCmd: DestPort out of range (1-65535).\r\n"); - return; - } - GateWay->ConfigPara.EthNet.DestPort = port; - DBG_LOG("DestPort set to %d\r\n", port); - return; - } - - DBG_LOG("EthCmd: Unknown subcommand '%s'\r\n", argv[1]); -} - - /***************************************************************************************** * : DebugCmdGetPara * : 鿴 @@ -1546,23 +1331,6 @@ static void DebugCmdGetPara(int argc, char *argv[]) GateWay->ConfigPara.LTENet.LocalAddr[0], GateWay->ConfigPara.LTENet.LocalAddr[1], GateWay->ConfigPara.LTENet.LocalAddr[2], GateWay->ConfigPara.LTENet.LocalAddr[3]); DBG_LOG("LocalPort: %d (Reserved)\r\n", GateWay->ConfigPara.LTENet.LocalPort); - /* EthNet (Ethernet) Parameters */ - DBG_LOG("=== EthNet (Ethernet) Parameters ===\r\n"); - DBG_LOG("IpMode: %s\r\n", (GateWay->ConfigPara.EthNet.IpMode == ETH_IP_DHCP) ? "DHCP" : "STATIC"); - DBG_LOG("LocalIP: %d.%d.%d.%d\r\n", - GateWay->ConfigPara.EthNet.IpAddr[0], GateWay->ConfigPara.EthNet.IpAddr[1], GateWay->ConfigPara.EthNet.IpAddr[2], GateWay->ConfigPara.EthNet.IpAddr[3]); - DBG_LOG("LocalPort: %d\r\n", GateWay->ConfigPara.EthNet.IpPort); - DBG_LOG("WorkMode: %s\r\n", - (GateWay->ConfigPara.EthNet.WorkMode == ETH_MODE_TCP_CLIENT) ? "TCP_CLIENT" : - (GateWay->ConfigPara.EthNet.WorkMode == ETH_MODE_TCP_SERVER) ? "TCP_SERVER" : "UDP"); - DBG_LOG("SubnetMask: %d.%d.%d.%d\r\n", - GateWay->ConfigPara.EthNet.SubnetMask[0], GateWay->ConfigPara.EthNet.SubnetMask[1], GateWay->ConfigPara.EthNet.SubnetMask[2], GateWay->ConfigPara.EthNet.SubnetMask[3]); - DBG_LOG("Gateway: %d.%d.%d.%d\r\n", - GateWay->ConfigPara.EthNet.Gateway[0], GateWay->ConfigPara.EthNet.Gateway[1], GateWay->ConfigPara.EthNet.Gateway[2], GateWay->ConfigPara.EthNet.Gateway[3]); - DBG_LOG("DestIP: %d.%d.%d.%d\r\n", - GateWay->ConfigPara.EthNet.DestIp[0], GateWay->ConfigPara.EthNet.DestIp[1], GateWay->ConfigPara.EthNet.DestIp[2], GateWay->ConfigPara.EthNet.DestIp[3]); - DBG_LOG("DestPort: %d\r\n", GateWay->ConfigPara.EthNet.DestPort); - DBG_LOG("RS485Ch1 Mac: %02X-%02X-%02X-%02X-%02X-%02X\r\n", GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][0],GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][1], GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][2],GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][3], @@ -2203,5 +1971,4 @@ const DBGFunType DebugFun[DEBUG_CMD_CNT] = { "reboot", DebugCmdReboot, "up", DebugCmdUpload, "reg", DebugCmdRegister, - "eth", DebugCmdEthNet, }; diff --git a/Project/GateWay/source/User/Inc/CatOneTask.h b/Project/GateWay/source/User/Inc/CatOneTask.h index b0e4edf..3e00414 100644 --- a/Project/GateWay/source/User/Inc/CatOneTask.h +++ b/Project/GateWay/source/User/Inc/CatOneTask.h @@ -133,7 +133,6 @@ bool CatOneGetStatus(void); bool CatOneEthSendQueue(uint8_t *sData, uint16_t sLen); void CatOneTriggerRegister(void); void ETHTriggerRegister(void); -void ETHApplyNetPara(void); void CatOne_Eth_Thread_Entry(void *parameter); void EthRxOverhandler(void); void CatReadImeiOrSim(char *Imei, char *Sim); diff --git a/Project/GateWay/source/User/Inc/Public.h b/Project/GateWay/source/User/Inc/Public.h index 0fb7e2c..16ed63d 100644 --- a/Project/GateWay/source/User/Inc/Public.h +++ b/Project/GateWay/source/User/Inc/Public.h @@ -257,22 +257,13 @@ typedef struct { uint16_t LocalPort; //ؿͻ˶˿(Ԥ) }LTENetPara_t, *pLTENetPara; -typedef enum { - ETH_IP_DHCP, //̬IP - ETH_IP_STATIC, //̬IP -}EthIpMode_m; -typedef enum { - ETH_MODE_TCP_CLIENT, //TCPͻ - ETH_MODE_TCP_SERVER, //TCP - ETH_MODE_UDP, //UDPģʽ -}EthWorkMode_m; typedef struct { - EthIpMode_m IpMode; //IPģʽDHCP/̬ + uint8_t IpMode; //IPģʽDHCP/̬ uint8_t IpAddr[4]; //IPַ uint16_t IpPort; //ض˿ - EthWorkMode_m WorkMode; //ģʽ + uint8_t WorkMode; //ģʽ uint8_t SubnetMask[4]; // uint8_t Gateway[4]; // uint8_t DestIp[4]; //ĿIPַ diff --git a/Project/GateWay/source/User/Src/CatOneTask.c b/Project/GateWay/source/User/Src/CatOneTask.c index 8f37793..696643d 100644 --- a/Project/GateWay/source/User/Src/CatOneTask.c +++ b/Project/GateWay/source/User/Src/CatOneTask.c @@ -618,7 +618,6 @@ void EthLoopHandler(void) rt_thread_delay(10); ETH_RESET_SET(); rt_thread_delay(2000); // ӳλȶʱ䵽2 - ETHApplyNetPara(); // EthNet CatOne.EthStatus = ETH_WAIT_LINK; CatOne.EthLinkWaitCnt = 0; CatOne.EthFirstRegFlag = true; // ״ע־ @@ -899,112 +898,3 @@ void ETHTriggerRegister(void) { CatOne.EthStatus = ETH_REG_SVR; } - -void ETHApplyNetPara(void) -{ - uint8_t cmdBuf[128]; - uint16_t idx = 0; - GWConfigPara_t *pCfg = (GWConfigPara_t *)&CatOne.GateWay->ConfigPara; - - /* EthNetģЭ: - * ʶ(10B): ED F2 A3 56 CA DB 91 84 B0 D7 - * 00: /״̬ - * 03: д浽Flash - * 07: д++ģ - * - * ƫ: 0x00=LocalIP(4B), 0x04=NetMask(4B), 0x08=Gateway(4B), - * 0x0C=DestIP(4B), 0x10=LocalPort(2B), 0x12=DestPort(2B), - * 0x14=WorkMode(1B: 0=TCP Server,1=TCP Client,2=UDP), - * 0x38=DHCP(1B: 0=̬,1=DHCP) - */ - - /* 0: ϵͳǷʼ - * : ed f2 a3 56 ca db 91 84 b0 d7 00 3d 01 - * 0001ʾʼ,Խд - */ - CAT1_DBG_LOG("ETH Check init..."); - for(int waitCnt = 0; waitCnt < 50; waitCnt++) { - idx = 0; - cmdBuf[idx++] = 0xED; cmdBuf[idx++] = 0xF2; cmdBuf[idx++] = 0xA3; cmdBuf[idx++] = 0x56; - cmdBuf[idx++] = 0xCA; cmdBuf[idx++] = 0xDB; cmdBuf[idx++] = 0x91; cmdBuf[idx++] = 0x84; - cmdBuf[idx++] = 0xB0; cmdBuf[idx++] = 0xD7; - cmdBuf[idx++] = 0x00; /* */ - cmdBuf[idx++] = 0x3D; /* ƫ: 0x3D (Status) */ - cmdBuf[idx++] = 0x01; /* : 1ֽ */ - EthOrCat1UartSend(cmdBuf, idx); - rt_thread_delay(100); - /* ʵӦü鷵ֵ,򵥵ȴ */ - } - CAT1_DBG_LOG("ETH Init check done"); - - /* 1: һд0x00ʼ(LocalIP~WorkMode, 0x15ֽ) - * ƫ0x00~0x14: LocalIP(4) + NetMask(4) + Gateway(4) + DestIP(4) + LocalPort(2) + DestPort(2) + WorkMode(1) - */ - idx = 0; - cmdBuf[idx++] = 0xED; cmdBuf[idx++] = 0xF2; cmdBuf[idx++] = 0xA3; cmdBuf[idx++] = 0x56; - cmdBuf[idx++] = 0xCA; cmdBuf[idx++] = 0xDB; cmdBuf[idx++] = 0x91; cmdBuf[idx++] = 0x84; - cmdBuf[idx++] = 0xB0; cmdBuf[idx++] = 0xD7; - cmdBuf[idx++] = 0x01; /* : д,ֲ޸ĺԶ */ - cmdBuf[idx++] = 0x00; /* ƫ: 0x00 */ - cmdBuf[idx++] = 0x15; /* : 21ֽ */ - - /* Local IP */ - cmdBuf[idx++] = pCfg->EthNet.IpAddr[0]; - cmdBuf[idx++] = pCfg->EthNet.IpAddr[1]; - cmdBuf[idx++] = pCfg->EthNet.IpAddr[2]; - cmdBuf[idx++] = pCfg->EthNet.IpAddr[3]; - /* Net Mask */ - cmdBuf[idx++] = pCfg->EthNet.SubnetMask[0]; - cmdBuf[idx++] = pCfg->EthNet.SubnetMask[1]; - cmdBuf[idx++] = pCfg->EthNet.SubnetMask[2]; - cmdBuf[idx++] = pCfg->EthNet.SubnetMask[3]; - /* Gateway */ - cmdBuf[idx++] = pCfg->EthNet.Gateway[0]; - cmdBuf[idx++] = pCfg->EthNet.Gateway[1]; - cmdBuf[idx++] = pCfg->EthNet.Gateway[2]; - cmdBuf[idx++] = pCfg->EthNet.Gateway[3]; - /* Dest IP */ - cmdBuf[idx++] = pCfg->EthNet.DestIp[0]; - cmdBuf[idx++] = pCfg->EthNet.DestIp[1]; - cmdBuf[idx++] = pCfg->EthNet.DestIp[2]; - cmdBuf[idx++] = pCfg->EthNet.DestIp[3]; - /* Local Port () */ - cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.IpPort >> 8); - cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.IpPort & 0xFF); - /* Dest Port () */ - cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.DestPort >> 8); - cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.DestPort & 0xFF); - /* Work Mode: 0=TCP Server, 1=TCP Client, 2=UDP */ - if(pCfg->EthNet.WorkMode == ETH_MODE_TCP_SERVER) { - cmdBuf[idx++] = 0x00; - } else if(pCfg->EthNet.WorkMode == ETH_MODE_TCP_CLIENT) { - cmdBuf[idx++] = 0x01; - } else { - cmdBuf[idx++] = 0x02; - } - - CAT1_DBG_LOG("ETH Write IP/Mode, len=%d", idx); - EthOrCat1UartSend(cmdBuf, idx); - rt_thread_delay(500); - - /* 2: дDHCP/IPģʽ (ƫ0x38, 1ֽ) - * 0=̬IP, 1=DHCP - */ - idx = 0; - cmdBuf[idx++] = 0xED; cmdBuf[idx++] = 0xF2; cmdBuf[idx++] = 0xA3; cmdBuf[idx++] = 0x56; - cmdBuf[idx++] = 0xCA; cmdBuf[idx++] = 0xDB; cmdBuf[idx++] = 0x91; cmdBuf[idx++] = 0x84; - cmdBuf[idx++] = 0xB0; cmdBuf[idx++] = 0xD7; - cmdBuf[idx++] = 0x01; /* : д,DHCP޸ĺԶ */ - cmdBuf[idx++] = 0x38; /* ƫ: 0x38 (DHCP en) */ - cmdBuf[idx++] = 0x01; /* : 1ֽ */ - cmdBuf[idx++] = (pCfg->EthNet.IpMode == ETH_IP_DHCP) ? 0x01 : 0x00; - - CAT1_DBG_LOG("ETH Write DHCP=%d", cmdBuf[idx - 1]); - EthOrCat1UartSend(cmdBuf, idx); - rt_thread_delay(3000); /* ȴģ */ - - /* ע⣺ҪDevID(ƫ0x1F)дݣֲ˵ - * дIDȷ豸ᶪдIJ - * ģ´ϵʱԶʹFlashбIJ - */ -} diff --git a/Project/GateWay/source/User/Src/main.c b/Project/GateWay/source/User/Src/main.c index 7d3571f..971f8a4 100644 --- a/Project/GateWay/source/User/Src/main.c +++ b/Project/GateWay/source/User/Src/main.c @@ -148,27 +148,6 @@ void GateWayInit(void) GateWay.ConfigPara.LTENet.DestPort = 12111; #endif - GateWay.ConfigPara.EthNet.IpMode = ETH_IP_STATIC; - GateWay.ConfigPara.EthNet.IpAddr[0] = 192; - GateWay.ConfigPara.EthNet.IpAddr[1] = 168; - GateWay.ConfigPara.EthNet.IpAddr[2] = 1; - GateWay.ConfigPara.EthNet.IpAddr[3] = 101; - GateWay.ConfigPara.EthNet.IpPort = 10000; - GateWay.ConfigPara.EthNet.WorkMode = ETH_MODE_TCP_CLIENT; - GateWay.ConfigPara.EthNet.SubnetMask[0] = 255; - GateWay.ConfigPara.EthNet.SubnetMask[1] = 255; - GateWay.ConfigPara.EthNet.SubnetMask[2] = 255; - GateWay.ConfigPara.EthNet.SubnetMask[3] = 0; - GateWay.ConfigPara.EthNet.Gateway[0] = 192; - GateWay.ConfigPara.EthNet.Gateway[1] = 168; - GateWay.ConfigPara.EthNet.Gateway[2] = 1; - GateWay.ConfigPara.EthNet.Gateway[3] = 1; - GateWay.ConfigPara.EthNet.DestIp[0] = 192; - GateWay.ConfigPara.EthNet.DestIp[1] = 168; - GateWay.ConfigPara.EthNet.DestIp[2] = 1; - GateWay.ConfigPara.EthNet.DestIp[3] = 100; - GateWay.ConfigPara.EthNet.DestPort = 8080; - GateWay.ConfigPara.CommUnitReadInterval = COMMUNIT_READ_SENSOR_INTERVAL_MAX;//ǵ͹豸 memset(GateWay.ConfigPara.CommUnitArray, 0x00, sizeof(CommUnitData_t) * COMMUNIT_NUM_MAX); GateWay.ConfigPara.Rs485Ch1.Enable = true; @@ -198,7 +177,8 @@ void GateWayInit(void) #if MAC_ADDR_TYPE == 0 memcpy(GateWay.ConfigPara.GwMac, GateWayMac_Test, 6); - GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1; +// GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1; + GateWay.ConfigPara.DebugChannel = DEBUG_CH_DBG; #elif MAC_ADDR_TYPE == 1 memcpy(GateWay.ConfigPara.GwMac, GateWayMac_BL1, 6); GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;