From 78c55b3b216c9f1cf6ff58f0e9bd15608aad8308 Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Thu, 23 May 2024 16:34:22 +0800 Subject: [PATCH] =?UTF-8?q?[+log]=E5=A2=9E=E5=8A=A0=E8=81=94=E9=94=81?= =?UTF-8?q?=E9=80=9A=E4=BF=A1=E6=94=B6=E5=88=B0=E5=8F=8A=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/interlock/beijing12/interlock.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/third_party/interlock/beijing12/interlock.go b/third_party/interlock/beijing12/interlock.go index e190cb8..0af4c7a 100644 --- a/third_party/interlock/beijing12/interlock.go +++ b/third_party/interlock/beijing12/interlock.go @@ -53,6 +53,7 @@ type interlockProxy struct { // 驱动信息进行转发 func (i *interlockProxy) handleDriverInfo(b []byte) { + slog.Info("收到联锁驱动继电器数据:", fmt.Sprintf("%x", b)) handler := i.manager if handler != nil { handler.HandleInterlockDriverInfo(i.runConfig.Code, b) @@ -101,7 +102,12 @@ func (i *interlockProxy) collectInfoStateTask(ctx context.Context) { if collectInfoState != nil { serialNumber++ collectInfoState.SetSerialNumber(serialNumber) - i.sendCollectUdpClient.SendMsg(collectInfoState) + err := i.sendCollectUdpClient.SendMsg(collectInfoState) + if err != nil { + slog.Error("向联锁发送继电器状态失败:", err) + } else { + slog.Error("向联锁发送继电器数据成功:", fmt.Sprintf("%x", collectInfoState.Encode())) + } } time.Sleep(time.Millisecond * InterlockMessageSendInterval) }