From abc68eca2eb2c97dbcc405db1a2acddaa2b75e54 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 28 Sep 2023 13:56:54 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E9=98=BB=E5=8A=9B?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dynamics/udp.go | 8 ++++---- dynamics/udpData.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dynamics/udp.go b/dynamics/udp.go index 5e5839f..f76c51c 100644 --- a/dynamics/udp.go +++ b/dynamics/udp.go @@ -230,10 +230,10 @@ func decoderDynamicsTrainInfo(buf []byte) *TrainInfo { b := buf[12] trainInfo.UpSlope = (b & (1 << 7)) != 0 trainInfo.Up = (b & (1 << 6)) != 0 - trainInfo.TotalResistance = binary.BigEndian.Uint32(buf[14:18]) - trainInfo.AirResistance = binary.BigEndian.Uint32(buf[18:22]) - trainInfo.SlopeResistance = binary.BigEndian.Uint32(buf[22:26]) - trainInfo.CurveResistance = binary.BigEndian.Uint32(buf[26:30]) + trainInfo.TotalResistance = int32(binary.BigEndian.Uint32(buf[14:18])) + trainInfo.AirResistance = int32(binary.BigEndian.Uint32(buf[18:22])) + trainInfo.SlopeResistance = int32(binary.BigEndian.Uint32(buf[22:26])) + trainInfo.CurveResistance = int32(binary.BigEndian.Uint32(buf[26:30])) trainInfo.Speed = math.Float32frombits(binary.BigEndian.Uint32(buf[30:34])) trainInfo.HeadSpeed1 = math.Float32frombits(binary.BigEndian.Uint32(buf[34:38])) trainInfo.HeadSpeed2 = math.Float32frombits(binary.BigEndian.Uint32(buf[38:42])) diff --git a/dynamics/udpData.go b/dynamics/udpData.go index 8e9818f..b163497 100644 --- a/dynamics/udpData.go +++ b/dynamics/udpData.go @@ -25,13 +25,13 @@ type TrainInfo struct { //列车当前运行方向(偏移量增大/减小方向) Up bool //实际运行阻力(总)(N) - TotalResistance uint32 + TotalResistance int32 //阻力1(空气阻力)(N) - AirResistance uint32 + AirResistance int32 //阻力2(坡道阻力)(N) - SlopeResistance uint32 + SlopeResistance int32 //阻力3(曲线阻力)(N) - CurveResistance uint32 + CurveResistance int32 //列车运行速度(m/s) Speed float32 //头车速传1速度值(m/s)