From fbfc6cdd0d700e5791431695542de02f4d115a46 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 24 Sep 2021 19:14:57 +0800 Subject: [PATCH] opt --- .../function/obu/mogo/MogoPrivateObuManager.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt index 171a91350a..f168eb99e7 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt @@ -295,7 +295,7 @@ class MogoPrivateObuManager private constructor() { info.threat_info.app_id, info.status, info.ext_info.lights, - info.ext_info.lightIndex + info.ext_info.getLightIndex() ) } } @@ -513,7 +513,7 @@ class MogoPrivateObuManager private constructor() { var alertContent = "" //这里需要根据真实数据确定 indicator 取值方式 if (indicator != -1 && lights.size >= indicator) { - val currentLight = lights[indicator] + val currentLight = lights[0] LogUtils.dTag( MogoObuConst.TAG_MOGO_OBU, "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} --- indicator = $indicator ---appId = $appId" @@ -531,9 +531,13 @@ class MogoPrivateObuManager private constructor() { } isGreenLight = false CallerHmiManager.showWarningTrafficLight(1) - CallerHmiManager.changeCountdownRed(currentLight.count_down.toInt()) + var red = currentLight.count_down.toInt() + 1 + CallerHmiManager.changeCountdownRed(if (red >= 0) red else 0) ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) + CallerHmiManager.changeCountdownGreen(0) + CallerHmiManager.changeCountdownYellow(0) + CallerHmiManager.showWarningV2X( appId, alertContent, @@ -550,7 +554,8 @@ class MogoPrivateObuManager private constructor() { } isRedLight = false CallerHmiManager.showWarningTrafficLight(3) - CallerHmiManager.changeCountdownGreen(currentLight.count_down.toInt() + 1) + var green = currentLight.count_down.toInt() + 1 + CallerHmiManager.changeCountdownGreen(if (green >= 0) green else 0) //防止数据出现问题的容错 CallerHmiManager.changeCountdownRed(0) CallerHmiManager.changeCountdownYellow(0) @@ -592,7 +597,8 @@ class MogoPrivateObuManager private constructor() { 0x3 -> { CallerHmiManager.disableWarningV2X(appId.toString()) CallerHmiManager.showWarningTrafficLight(2) - CallerHmiManager.changeCountdownYellow(currentLight.count_down.toInt() + 1) + var yellow = currentLight.count_down.toInt() + 1 + CallerHmiManager.changeCountdownYellow(if (yellow >= 0) yellow else 0) CallerHmiManager.changeCountdownGreen(0) CallerHmiManager.changeCountdownRed(0) }