From 00cdf059fa44980a0ef0cd8833a3d7db5a3d8a18 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 16 Jan 2023 18:30:49 +0800 Subject: [PATCH] =?UTF-8?q?[2.13.2]=20=E6=B7=BB=E5=8A=A0rsi30s=E9=97=B4?= =?UTF-8?q?=E9=9A=94=EF=BC=8C=E7=BA=A2=E7=BB=BF=E7=81=AF=E8=B7=B3=E5=8F=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../obu/mogo/MogoPrivateObuNewManager.kt | 123 +++++++++++------- 1 file changed, 74 insertions(+), 49 deletions(-) diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt index d273114fcb..e56034195f 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -195,11 +195,11 @@ class MogoPrivateObuNewManager private constructor() { appId = data.warningMsg.warningData[0].warningType.toString() status = data.warningMsg.warningData[0].status - //15秒内同一个事件只出现一次 + //30秒内同一个事件只出现一次 if (rvMap.containsKey(appId)) { var oldTime = rvMap[appId] var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 15) { + if (timeDiff < 30) { return } rvMap.remove(appId) @@ -421,11 +421,11 @@ class MogoPrivateObuNewManager private constructor() { } } - //15秒内同一个事件只出现一次 + //30秒内同一个事件只出现一次 if (rsiMap.containsKey(appId)) { var oldTime = rsiMap[appId] var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 15) { + if (timeDiff < 30) { return } rsiMap.remove(appId) @@ -603,11 +603,11 @@ class MogoPrivateObuNewManager private constructor() { when (data.warningMsg.warningData[0].status) { MogoObuConstants.STATUS.ADD -> { // 添加 //更新模型的颜色 - //15秒内同一个事件只出现一次 + //30秒内同一个事件只出现一次 if (rsmMap.containsKey(v2xType)) { var oldTime = rsmMap[v2xType] var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 15) { + if (timeDiff < 30) { return } rsmMap.remove(v2xType) @@ -965,6 +965,7 @@ class MogoPrivateObuNewManager private constructor() { isShowGreenWave = false isShowRunRedLight = false isYellowLight = false + lightCountDownTemp = 0 } } } @@ -975,6 +976,9 @@ class MogoPrivateObuNewManager private constructor() { private var isShowGreenWave = false private var isShowRunRedLight = false + private var lightCountDownTemp : Int = 0 + + /** * 修改红绿灯 */ @@ -1095,64 +1099,85 @@ class MogoPrivateObuNewManager private constructor() { when (currentLight.light) { // 灯光不可用 0 -> { - // CallerHmiManager.showWarningTrafficLight(0, 3) CallerObuTrafficLightListenerManager.invokeObuTrafficLight(0) } // 红灯 2, 3 -> { - if (!isRedLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) - isRedLight = true - } - isGreenLight = false - isYellowLight = false - // CallerHmiManager.showWarningTrafficLight(1, 3) - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1) - val red = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownRed(red) - Log.d("lixp", " ------- red --------- = $red ----isGreenLight = $isGreenLight") - if (red == 1) { - //延迟3秒 红 绿 黄 - UiThreadHandler.postDelayed({ - if (!isGreenLight) { //如果3s后,没有变绿灯,删除红绿灯显示 - CallerHmiManager.disableWarningTrafficLight() - } - }, 3000) + if (!isGreenLight) { //只有不是是绿灯,才能展示跳转到红灯 + if (!isRedLight) { + CallerHmiManager.disableWarningV2X(appId.toString()) + isRedLight = true + } + isGreenLight = false + isYellowLight = false + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1) + val red = currentLight.countDown.toInt() + Log.e("lixp", " ----11--- red --------- = $red ----lightCountDownTemp = $lightCountDownTemp ----isGreenLight = $isGreenLight") + //记录当前红灯的上一帧的值 10,9,10 + if (lightCountDownTemp < red) { + return + } + lightCountDownTemp = red + + CallerHmiManager.changeCountdownRed(red) + if (red == 1) { + //延迟3秒 红 绿 黄 + Log.d("lixp", " ----22--- red --------- = $red ----lightCountDownTemp = $lightCountDownTemp ----isGreenLight = $isGreenLight") + UiThreadHandler.postDelayed({ + if (!isGreenLight) { //如果3s后,没有变绿灯,删除红绿灯显示 + CallerHmiManager.disableWarningTrafficLight() + } + }, 3000) + } } } // 绿灯 4, 5, 6 -> { - if (!isGreenLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) - isGreenLight = true - } - isRedLight = false - isYellowLight = false - // CallerHmiManager.showWarningTrafficLight(3, 3) - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3) - val green = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownGreen(green) - if (green == 1) { - Log.d("lixp", " ------- green --------- = $green ----isYellowLight = $isYellowLight") - UiThreadHandler.postDelayed({ - if (!isYellowLight) { //如果3s后,没有变黄灯,删除红绿灯显示 - CallerHmiManager.disableWarningTrafficLight() - } - }, 3000) + if (!isYellowLight) { //只有不是黄灯的时候,才能跳转到绿灯 + if (!isGreenLight) { + CallerHmiManager.disableWarningV2X(appId.toString()) + isGreenLight = true + } + isRedLight = false + isYellowLight = false + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3) + val green = currentLight.countDown.toInt() + Log.e("lixp", " ----11--- green --------- = $green ---lightCountDownTemp = $lightCountDownTemp ----isYellowLight = $isYellowLight") + if (lightCountDownTemp < green) { + return + } + lightCountDownTemp = green + + CallerHmiManager.changeCountdownGreen(green) + if (green == 1) { + Log.d("lixp", " ----22--- green --------- = $green ---lightCountDownTemp = $lightCountDownTemp ----isYellowLight = $isYellowLight") + UiThreadHandler.postDelayed({ + if (!isYellowLight) { //如果3s后,没有变黄灯,删除红绿灯显示 + CallerHmiManager.disableWarningTrafficLight() + } + }, 3000) + } } } // 黄灯 7, 8 -> { - if (!isYellowLight) { - isYellowLight = true + if (!isRedLight) { + if (!isYellowLight) { + isYellowLight = true + } + CallerHmiManager.disableWarningV2X(appId.toString()) + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2) + val yellow = currentLight.countDown.toInt() + Log.d("lixp", " ------- yellow --------- = $yellow ---lightCountDownTemp = $lightCountDownTemp ----isYellowLight = $isYellowLight") + if (lightCountDownTemp < yellow) { + return + } + lightCountDownTemp = yellow + + CallerHmiManager.changeCountdownYellow(yellow) } - CallerHmiManager.disableWarningV2X(appId.toString()) - // CallerHmiManager.showWarningTrafficLight(2, 3) - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2) - val yellow = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownYellow(yellow) } } }