雷达与VOBC协议解码,调整

This commit is contained in:
tiger_zhou 2024-01-23 10:19:41 +08:00
parent 5379bc11f3
commit 6b16afc7b3

View File

@ -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) {