From affab4e4ac43c0e2eab84fbf13af5d82f232af0b Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Tue, 1 Aug 2023 20:28:31 +0800 Subject: [PATCH] =?UTF-8?q?[3.4.0]=E4=BF=AE=E5=A4=8D=E7=BA=A2=E7=BB=BF?= =?UTF-8?q?=E7=81=AF=E5=81=B6=E7=8E=B0=E4=B8=8D=E6=B6=88=E5=A4=B1Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对于偶现未收到关闭红绿灯信号的情况,做兼容处理,添加一个定时器,超过两秒未收到更新数据,则关闭红绿灯 --- .../datacenter/v2x/TrafficLightDispatcher.kt | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt index bca8361b3e..71ca596c58 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt @@ -88,28 +88,6 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight ) if (!hasObuLightStatus) { if (!hasAiLightStatus) { - - lastLightTime = System.currentTimeMillis() - if (lightCountDownTimer == null) { - lightCountDownTimer = object : CountDownTimer(300000, 1000) { - override fun onTick(millisUntilFinished: Long) { - if ((System.currentTimeMillis() - lastLightTime) > 1000) { - //隐藏红绿灯显示 - hide("感知倒计时结束隐藏", DataSourceType.TELEMATIC) - lightCountDownTimer?.cancel() - lightCountDownTimer = null - } - } - - override fun onFinish() { - lightCountDownTimer?.cancel() - lightCountDownTimer = null - } - - } - lightCountDownTimer?.start() - } - trafficLights?.let { it -> var light: TrafficLight? = null if (it.hasStraight()) { @@ -232,7 +210,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight } /** - * 红绿灯数据 + * OBU红绿灯数据 */ @ChainLog( linkChainLog = ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT, @@ -253,6 +231,31 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight "${SceneConstant.M_D_C}${TAG}", "onTrafficLightPlusSource ----- light = $light ---remain = $remain ---lightSource = $lightSource ---hasObuLightStatus = $hasObuLightStatus ---hasAiLightStatus = $hasAiLightStatus" ) + + //倒计时,超时还未更新数据则隐藏红绿灯 + lastLightTime = System.currentTimeMillis() + if (lightCountDownTimer == null) { + lightCountDownTimer = object : CountDownTimer(300000, 1000) { + override fun onTick(millisUntilFinished: Long) { + if ((System.currentTimeMillis() - lastLightTime) > 1500) { + //隐藏红绿灯显示 + hide("倒计时结束隐藏", DataSourceType.TELEMATIC) + lightCountDownTimer?.cancel() + lightCountDownTimer = null + } + } + + override fun onFinish() { + //隐藏红绿灯显示 + hide("倒计时结束隐藏", DataSourceType.TELEMATIC) + lightCountDownTimer?.cancel() + lightCountDownTimer = null + } + + } + lightCountDownTimer?.start() + } + CallerTrafficLightListenerManager.showTrafficLight(light, lightSource) if (remain == -1) { CallerTrafficLightListenerManager.disableTrafficLightCountDown()