[3.4.0]修复红绿灯偶现不消失Bug
对于偶现未收到关闭红绿灯信号的情况,做兼容处理,添加一个定时器,超过两秒未收到更新数据,则关闭红绿灯
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user