feat: add a new 485 type weather station
This commit is contained in:
parent
c09b3e789a
commit
9a7d2b5f79
8
main.go
8
main.go
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user