From c23c70ce05cf944844675193b4b7f60c25ae7e4b Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Thu, 6 Jun 2024 18:40:48 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]12=E5=8F=B7=E7=BA=BF?= =?UTF-8?q?=E8=81=94=E9=94=81=E9=80=9A=E4=BF=A1=E5=A2=9E=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=EF=BC=9B=20[bug]12=E5=8F=B7=E7=BA=BF=E8=81=94?= =?UTF-8?q?=E9=94=81=E9=A9=B1=E5=8A=A8=E5=AD=97=E8=8A=82=E8=A7=A3=E6=9E=90?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/interlock/beijing12/interlock.go | 6 +++++- third_party/message/interlock.go | 6 +++--- ts/simulation/wayside/memory/wayside_simulation.go | 5 ++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/third_party/interlock/beijing12/interlock.go b/third_party/interlock/beijing12/interlock.go index 710d868..7c6a562 100644 --- a/third_party/interlock/beijing12/interlock.go +++ b/third_party/interlock/beijing12/interlock.go @@ -14,6 +14,10 @@ import ( "joylink.club/bj-rtsts-server/third_party/udp" ) +const ( + logTag = "[北京12号线联锁通信]" +) + // 联锁代理通信接口 type InterlockMessageManager interface { CollectInterlockRelayInfo(code string) *message.InterlockSendMsgPkg @@ -53,7 +57,7 @@ type interlockProxy struct { // 驱动信息进行转发 func (i *interlockProxy) handleDriverInfo(b []byte) { - slog.Info(fmt.Sprintf("收到联锁驱动继电器数据:%x", b)) + slog.Info(fmt.Sprintf("%s收到联锁驱动继电器数据:%x", logTag, b)) handler := i.manager if handler != nil { handler.HandleInterlockDriverInfo(i.runConfig.Code, b) diff --git a/third_party/message/interlock.go b/third_party/message/interlock.go index 2e077a4..64e653a 100644 --- a/third_party/message/interlock.go +++ b/third_party/message/interlock.go @@ -163,7 +163,7 @@ func (t *InterlockReceiveMsgPkg) Decode(buf []byte) error { // 驱动数据 preIndex = lastIndex lastIndex = lastIndex + t.et_out_num - t.parseByte(t.DriveInfo, buf, preIndex, lastIndex) + t.parseByte(buf, preIndex, lastIndex) // 应答器报文 preIndex = lastIndex lastIndex = lastIndex + t.tcc_output_len @@ -173,11 +173,11 @@ func (t *InterlockReceiveMsgPkg) Decode(buf []byte) error { return nil } -func (t *InterlockReceiveMsgPkg) parseByte(r []bool, buf []byte, start, end int) { +func (t *InterlockReceiveMsgPkg) parseByte(buf []byte, start, end int) { for i := start; i < end; i++ { b := buf[i] for bit := 7; bit >= 0; bit-- { - r = append(r, (b&(1<