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()