feat: add a new 485 type weather station

This commit is contained in:
yarnom 2025-08-01 21:12:27 +08:00
parent c09b3e789a
commit 9a7d2b5f79

View File

@ -141,7 +141,13 @@ func startUDP() {
log.Println(weatherData)
if weatherData.StationID != "" {
model.RegisterDevice(weatherData.StationID, addr)
// 更新内存中的设备信息
model.UpdateDeviceInMemory(weatherData.StationID, addr, model.DeviceTypeEcowitt)
// 注册设备到数据库
err = model.RegisterDeviceInDB(weatherData.StationID, addr)
if err != nil {
log.Printf("注册设备失败: %v", err)
}
log.Printf("设备 %s 已注册IP: %s", weatherData.StationID, addr.String())
} else {
log.Printf("警告: 收到的数据没有站点ID")