From 6b16afc7b388fadaffc154fb0a854852589119a2 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Tue, 23 Jan 2024 10:19:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=B7=E8=BE=BE=E4=B8=8EVOBC=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E8=A7=A3=E7=A0=81,=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/message/radar.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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) {