本次重构完成了 433MHz 全链路协议统一:实现了 AA TYPE LEN ID PAYLOAD SUM 统一帧格式;引入了基于 AUX 的 LBT 避让与 TX 优先调度,确保高频发送稳定;完成了端口语义化重命名;并成功集成了 IO 监控、RS485 及 W5500 以太网 的标准化打包转发,实现了多源数据的高效、稳定透传。

This commit is contained in:
edisondeng
2026-05-08 15:25:19 +08:00
parent de67b86952
commit 878379f101
11 changed files with 793 additions and 121 deletions

View File

@ -245,22 +245,10 @@ int32_t loopback_udps(uint8_t sn, uint8_t *buf, uint16_t port)
}
size = (uint16_t)ret;
/* ========================================================== *
/* 🚀 核心修改:网络数据透传时,加上 [0xAA] 和设备 ID */
uint8_t tx_buf[2048];
// 1. 添加统一的空中协议头 (0xAA + ID)
tx_buf[0] = 0xAA;
tx_buf[1] = MY_DEVICE_ID;
// 2. 把网络标识 "[NET]" 写进数组,注意要从第 2 个字节开始写
int tag_len = sprintf((char*)&tx_buf[2], "[NET]");
// 3. 把网络收到的真实数据 (buf) 紧挨着拼接到后面
memcpy(&tx_buf[2 + tag_len], buf, size);
// 4. 把拼接好的整串数据 (头 + ID + [NET] + 数据) 发给 RF433
MultiUART_Send(PORT_UART1, tx_buf, 2 + tag_len + size);
/* ========================================================== *
* 🚀 核心修改:使用统一协议函数发送网络数据 (Type 0x55)
* ========================================================== */
RF433_SendPacket(PROTO_TYPE_NET, buf, size);
/* ========================================================== */
sentsize = 0;
while (sentsize != size)

View File

@ -24,7 +24,7 @@ wiz_NetInfo default_net_info = {
//.dhcp = NETINFO_STATIC //static ip
};
uint16_t local_port = 8000;
static uint8_t ethernet_buf[ETHERNET_BUF_MAX_SIZE] = {0};
uint8_t ethernet_buf[ETHERNET_BUF_MAX_SIZE] = {0};
/**
* @brief User Run Program
* @param none