初步测试OK

This commit is contained in:
edisondeng
2026-05-10 08:57:34 +08:00
parent ee67076ec7
commit 485fb32a72
7 changed files with 4343 additions and 4263 deletions

View File

@ -388,13 +388,21 @@ int main(void)
#if USE_IO_MONITOR
if (HAL_GetTick() - g_last_hb_tick >= 30000) {
g_last_hb_tick = HAL_GetTick();
uint8_t hb_payload[3];
uint8_t hb_payload[5]; // 扩充为 5 字节
hb_payload[0] = IO_Monitor_GetAllStates();
hb_payload[1] = (uint8_t)(g_hb_seq >> 8);
hb_payload[2] = (uint8_t)(g_hb_seq & 0xFF);
uint16_t modbus_val = 0xFFFF; // 默认值
#if USE_W5500
modbus_val = ModbusTCP_Get_LastRegVal(); // 获取最新 Modbus 寄存器值
#endif
hb_payload[3] = (uint8_t)(modbus_val >> 8);
hb_payload[4] = (uint8_t)(modbus_val & 0xFF);
g_hb_seq++;
RF433_SendPacket(PROTO_TYPE_HB, hb_payload, 3);
RF433_SendPacket(PROTO_TYPE_HB, hb_payload, 5); // 发送 5 字节
}
#endif