feat: add a new 485 type weather station

This commit is contained in:
yarnom 2025-08-01 21:40:55 +08:00
parent 686cf8847e
commit 5f0aed7258

View File

@ -271,14 +271,16 @@ func ParseWH65LPData(data []byte) (*WH65LPData, error) {
wd.LowBattery = (data[3]>>4)&0x01 == 1
// 7. 温度 (bits 29-39) - 11位数据
// 从第4字节的高3位 + 第5字节的完整8位
tempLow := uint16(data[4]) // bits 29-36 (实际是32-39)
tempHigh := uint16((data[3] >> 5) & 0x07) // bits 29-31
// 协议说明温度数据实际上是从第4字节的低4位开始 + 第5字节的低3位
// 但根据示例数据分析应该是第4字节完整8位 + 第5字节低3位
tempLow := uint16(data[4]) // 第4字节的8位
tempHigh := uint16(data[5] & 0x07) // 第5字节的低3位
tempRaw := tempLow | (tempHigh << 8)
wd.Temperature = float64(tempRaw-400) / 10.0
// 8. 湿度 (bits 40-47)
wd.Humidity = int(data[5])
// 湿度应该是第5字节的高5位
wd.Humidity = int(data[5] >> 3)
// 9. 风速 (bits 48-55 + WSP_9,WSP_8)
windSpeedLow := uint16(data[6]) // bits 48-55