From 51d8716d4f69b8a21bb390a7021c8c8f80bebe56 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Thu, 25 Jan 2024 09:57:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=B7=E8=BE=BE=E5=8F=91=E9=80=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/radar/radar_vobc.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/third_party/radar/radar_vobc.go b/third_party/radar/radar_vobc.go index 5c24d6d..8a288e7 100644 --- a/third_party/radar/radar_vobc.go +++ b/third_party/radar/radar_vobc.go @@ -16,7 +16,6 @@ import ( type RadarVobc interface { Start(radar RadarVobcManager) Stop() - SendRadarInfo(ctx context.Context) } type RadarVobcManager interface { @@ -60,10 +59,11 @@ func (rv *radarVobc) Start(radar RadarVobcManager) { ctx, cancleFunc := context.WithCancel(context.Background()) rv.radarVobcTaskContext = cancleFunc rv.radarVobcManager = radar - go rv.SendRadarInfo(ctx) + go rv.sendRadarInfo(ctx) } -func (rv *radarVobc) SendRadarInfo(ctx context.Context) { +// sendRadarInfo 发送速度,位移计数 给vobc +func (rv *radarVobc) sendRadarInfo(ctx context.Context) { /*defer func() { slog.Error("") }()*/ @@ -72,7 +72,6 @@ func (rv *radarVobc) SendRadarInfo(ctx context.Context) { case <-ctx.Done(): return default: - } trainStatus := rv.radarVobcManager.FindRadarTrain() if trainStatus != nil { @@ -85,13 +84,13 @@ func (rv *radarVobc) SendRadarInfo(ctx context.Context) { } func (rv *radarVobc) Stop() { - if rv.vobcClient != nil { - rv.vobcClient.Close() - rv.vobcClient = nil - } + if rv.radarVobcTaskContext != nil { rv.radarVobcTaskContext() rv.radarVobcTaskContext = nil } - + if rv.vobcClient != nil { + rv.vobcClient.Close() + rv.vobcClient = nil + } }