【修改传输给半实物数据】

This commit is contained in:
weizhihong 2023-10-16 17:17:34 +08:00
parent 3acff508ec
commit efc9659561

View File

@ -161,11 +161,12 @@ func sendVobcMsg(buf []byte) error {
// 将道岔转为动力学的消息
func encoderVobcTrainInfo(info *SendTrainInfo) []byte {
slog.Info("收到的动力学传输的信息:", info)
var data []byte
data = binary.BigEndian.AppendUint16(data, info.LifeSignal)
data = binary.BigEndian.AppendUint16(data, info.Speed)
if info.Upslope {
data = append(data, 1<<7)
data = append(data, 1)
} else {
data = append(data, 0)
}
@ -178,5 +179,6 @@ func encoderVobcTrainInfo(info *SendTrainInfo) []byte {
data = binary.BigEndian.AppendUint32(data, info.SlopeResistance) // 坡道阻力 100 = 1KN
data = binary.BigEndian.AppendUint32(data, info.CurveResistance) // 曲线阻力 100 = 1KN
data = binary.BigEndian.AppendUint16(data, info.Slope) // 坡度值 1= 1‰
slog.Info("收到的动力转换后的信息:", data)
return data
}