[2.13.2] 注释红绿灯跳变容错机制

This commit is contained in:
lixiaopeng
2023-01-16 21:32:28 +08:00
parent 1bc335dcf3
commit 4fadeb98f6

View File

@@ -965,7 +965,9 @@ class MogoPrivateObuNewManager private constructor() {
isShowGreenWave = false
isShowRunRedLight = false
isYellowLight = false
lightCountDownTemp = 0
// lightCountDownRed = 1
// lightCountDownGreen = 1
// lightCountDownYellow = 1
}
}
}
@@ -976,7 +978,9 @@ class MogoPrivateObuNewManager private constructor() {
private var isShowGreenWave = false
private var isShowRunRedLight = false
private var lightCountDownTemp : Int = 0
// private var lightCountDownRed : Int = 1
// private var lightCountDownGreen : Int = 1
// private var lightCountDownYellow : Int = 1
/**
@@ -1103,81 +1107,87 @@ class MogoPrivateObuNewManager private constructor() {
}
// 红灯
2, 3 -> {
if (!isGreenLight) { //只有不是是绿灯,才能展示跳转到红灯
// 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 ----lightCountDownTemp = $lightCountDownTemp ----isGreenLight = $isGreenLight")
//记录当前红灯的上一帧的值 10,9,10
// if (lightCountDownTemp < red) {
// 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
// }
// lightCountDownTemp = red
// lightCountDownRed = red
// Log.e("lixp", " ----22--- red --------- = $red ----lightCountDownRed = $lightCountDownRed ----isGreenLight = $isGreenLight")
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 (!isYellowLight) { //只有不是黄灯的时候,才能跳转到绿灯
// 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 ---lightCountDownTemp = $lightCountDownTemp ----isYellowLight = $isYellowLight")
// if (lightCountDownTemp < green) {
// Log.e("lixp", " ----11--- green --------- = $green ---lightCountDownGreen = $lightCountDownGreen ----isYellowLight = $isYellowLight")
// if (lightCountDownGreen == 1) {
// lightCountDownGreen = green
// }
//
// if (lightCountDownGreen < green) {
// return
// }
// lightCountDownTemp = green
// lightCountDownGreen = green
// Log.d("lixp", " ----22--- green --------- = $green ---lightCountDownGreen = $lightCountDownGreen ----isYellowLight = $isYellowLight")
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 (!isRedLight) {
// 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.d("lixp", " ------- yellow --------- = $yellow ---lightCountDownTemp = $lightCountDownTemp ----isYellowLight = $isYellowLight")
// if (lightCountDownTemp < yellow) {
// Log.e("lixp", " -----11-- yellow --------- = $yellow ---lightCountDownYellow = $lightCountDownYellow ----isYellowLight = $isYellowLight")
// if (lightCountDownYellow == 1) {
// lightCountDownYellow = yellow
// }
//
// if (lightCountDownYellow < yellow) {
// return
// }
// lightCountDownTemp = yellow
// lightCountDownYellow = yellow
// Log.d("lixp", " -----22-- yellow --------- = $yellow ---lightCountDownYellow = $lightCountDownYellow ----isYellowLight = $isYellowLight")
CallerHmiManager.changeCountdownYellow(yellow)
}
}
}
// }
}