diff --git a/third_party/message/radar.go b/third_party/message/radar.go index 933f642..ee970cc 100644 --- a/third_party/message/radar.go +++ b/third_party/message/radar.go @@ -24,15 +24,16 @@ type Radar struct { Tail byte } type RadarData struct { - SourceData byte - valRange byte + SourceData byte //接收源数据 + data uint16 //移位后的数据 + valRange byte //数据取值范围 } type RadarState struct { - SourceState byte - Model string - SyntheticalState string - DirState string - Dir string + SourceState byte //原数据 + Model string // 天线模式 + SyntheticalState string //综合状态 + DirState string //方向状态 + Dir string //方向 } func (r *Radar) Decode(data []byte) error { @@ -147,7 +148,7 @@ func readSpeedOrCounter(buf *bytes.Buffer) *RadarData { }*/ ss, _ := buf.ReadByte() limit, _ := buf.ReadByte() - return &RadarData{SourceData: ss, valRange: limit} + return &RadarData{SourceData: ss, valRange: limit, data: uint16(ss) << 8} } func readRadarInnerData(buf *bytes.Buffer) (byte, byte) {