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)