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..e22a0d3f7e 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,9 @@ class MogoPrivateObuNewManager private constructor() { isShowGreenWave = false isShowRunRedLight = false isYellowLight = false +// lightCountDownRed = 1 +// lightCountDownGreen = 1 +// lightCountDownYellow = 1 } } } @@ -975,6 +978,11 @@ class MogoPrivateObuNewManager private constructor() { private var isShowGreenWave = false private var isShowRunRedLight = false +// private var lightCountDownRed : Int = 1 +// private var lightCountDownGreen : Int = 1 +// private var lightCountDownYellow : Int = 1 + + /** * 修改红绿灯 */ @@ -1095,64 +1103,91 @@ 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 +// lightCountDownYellow = 1 +// lightCountDownGreen = 1 + + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1) + val red = currentLight.countDown.toInt() +// Log.e("lixp", " ----11--- red --------- = $red ----lightCountDownRed = $lightCountDownRed ----isGreenLight = $isGreenLight") +// //记录当前红灯的上一帧的值 10,9,10 +// if (lightCountDownRed == 1) { //最后一个灯态是1 +// lightCountDownRed = red +// } +// +// if (lightCountDownRed < red) { //10 9 +// return +// } +// lightCountDownRed = red +// Log.e("lixp", " ----22--- red --------- = $red ----lightCountDownRed = $lightCountDownRed ----isGreenLight = $isGreenLight") + CallerHmiManager.changeCountdownRed(red) +// } } // 绿灯 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 +// lightCountDownRed = 1 +// lightCountDownYellow = 1 + + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3) + val green = currentLight.countDown.toInt() +// Log.e("lixp", " ----11--- green --------- = $green ---lightCountDownGreen = $lightCountDownGreen ----isYellowLight = $isYellowLight") +// if (lightCountDownGreen == 1) { +// lightCountDownGreen = green +// } +// +// if (lightCountDownGreen < green) { +// return +// } +// lightCountDownGreen = green +// Log.d("lixp", " ----22--- green --------- = $green ---lightCountDownGreen = $lightCountDownGreen ----isYellowLight = $isYellowLight") + CallerHmiManager.changeCountdownGreen(green) +// } } // 黄灯 7, 8 -> { - if (!isYellowLight) { - isYellowLight = true +// if (!isRedLight) { //黄灯只能跳转绿灯 + if (!isYellowLight) { + isYellowLight = true + } + isRedLight = false + isGreenLight = false +// lightCountDownRed = 1 +// lightCountDownGreen = 1 + + CallerHmiManager.disableWarningV2X(appId.toString()) + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2) + val yellow = currentLight.countDown.toInt() +// Log.e("lixp", " -----11-- yellow --------- = $yellow ---lightCountDownYellow = $lightCountDownYellow ----isYellowLight = $isYellowLight") +// if (lightCountDownYellow == 1) { +// lightCountDownYellow = yellow +// } +// +// if (lightCountDownYellow < yellow) { +// return +// } +// lightCountDownYellow = yellow +// Log.d("lixp", " -----22-- yellow --------- = $yellow ---lightCountDownYellow = $lightCountDownYellow ----isYellowLight = $isYellowLight") + CallerHmiManager.changeCountdownYellow(yellow) } - CallerHmiManager.disableWarningV2X(appId.toString()) - // CallerHmiManager.showWarningTrafficLight(2, 3) - CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2) - val yellow = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownYellow(yellow) } - } +// } }