From 04875a220ae94ca7fcee1f44a6f692334b4868e2 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 13 Nov 2023 19:36:33 +0800 Subject: [PATCH] [6.2.0] fix bug of break map icon --- .../hmi/ui/setting/DebugSettingView.kt | 3 ++- .../business/ai/AiCloudIdentifyDataManager.kt | 12 ++++++++-- .../eagle/core/function/view/MapBizView.kt | 24 +++++++++++++++---- .../core/data/config/FunctionBuildConfig.kt | 8 +++++++ .../call/map/CallerMapRomaListener.kt | 1 + 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 798e21331a..f913e1a320 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -1040,7 +1040,7 @@ internal class DebugSettingView @JvmOverloads constructor( private fun setEagleEyeConfigListener() { //初始化刹车加速度阈值信息 val brakeThreshold = SharedPrefsMgr.getInstance(context) - .getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5F) + .getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, FunctionBuildConfig.accThreshold) etInputBrakeThreshold.setText(brakeThreshold.toString()) etInputBrakeThreshold.text?.let { etInputBrakeThreshold.setSelection(brakeThreshold.toString().length) } //设置刹车加速度阈值信息 @@ -1054,6 +1054,7 @@ internal class DebugSettingView @JvmOverloads constructor( if (thresholdStrFloat < 0) { SharedPrefsMgr.getInstance(context) .putFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, thresholdStrFloat) + FunctionBuildConfig.accThreshold = thresholdStrFloat ToastUtils.showShort("刹车阈值设置成功") } else { ToastUtils.showShort("刹车阈值加速度值应小于0") diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt index 170fbbe8b1..a7240e8a52 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt @@ -187,8 +187,15 @@ class AiCloudIdentifyDataManager : IMoGoPlanningRottingListener, } override fun mapRomaInRange(range: Boolean) { - MapRomaTrace.log("", CHAIN_CODE_ROMA_RANGE, TAG, mutableMapOf("range" to range)) - if(FunctionBuildConfig.romaModeStyle == 1){ + val gnss = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().gnssInfo + MapRomaTrace.log( + "", CHAIN_CODE_ROMA_RANGE, TAG, mutableMapOf( + "range" to range, + "lon" to gnss.longitude, + "lat" to gnss.latitude + ), true + ) + if (FunctionBuildConfig.romaModeStyle == 1) { return } invokeRomaViewStatus(range) @@ -361,6 +368,7 @@ class AiCloudIdentifyDataManager : IMoGoPlanningRottingListener, FunctionBuildConfig.romaModeStyle = 0 } else { FunctionBuildConfig.romaModeStyle = 1 + invokeRomaViewStatus(true) } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt index 7e26acc9ee..157bd466c8 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt @@ -5,6 +5,7 @@ import android.os.Bundle import android.util.AttributeSet import androidx.lifecycle.LifecycleObserver import chassis.Chassis +import com.mogo.eagle.core.data.config.FunctionBuildConfig.accThreshold import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener @@ -12,12 +13,15 @@ import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP import com.mogo.map.MogoMapView import com.mogo.map.overlay.line.Polyline import com.mogo.map.overlay.point.Point import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay import com.mogo.map.overlay.proxy.point.IMapPointOverlay import com.mogo.map.uicontroller.IMogoMapUIController +import kotlin.properties.Delegates class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs), @@ -95,9 +99,23 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, } } + /** + * 设置车辆灯光状态 true 刹车, false 正常 + */ + private var accLimit : Boolean by Delegates.observable(false){ _, oldV, newV -> + if(oldV != newV){ + if(newV){ + turn(4) + }else{ + turn(0) + } + } + } + override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { // 跟新地图控件 setExtraGPSData(gnssInfo) + accLimit = gnssInfo.acceleration < accThreshold } private var currentLevel:Int = 0 @@ -121,11 +139,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, private fun turn(lightNum: Int) { if (currentLevel != lightNum) { - when (lightNum) { - 0 -> getUI()?.setCarLightsType(0, 500) - 1 -> getUI()?.setCarLightsType(1, 500) - 2 -> getUI()?.setCarLightsType(2, 500) - } + getUI()?.setCarLightsType(lightNum, 500) currentLevel = lightNum } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt index 2563e3d9a9..7b8dda948d 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt @@ -127,6 +127,14 @@ object FunctionBuildConfig { @JvmField var adasConnectIP = "192.168.1.102" + /** + * acc 加速度值阈值 + * 默认 -2.5 + */ + @Volatile + @JvmField + var accThreshold = -2.5f + /** * 自车位置使用哪种外部数据源 * 0 = Android系统/GD diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRomaListener.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRomaListener.kt index 9fb7217051..5e47bdd683 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRomaListener.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRomaListener.kt @@ -13,6 +13,7 @@ object CallerMapRomaListener : CallerBase() { override fun doSomeAfterAddListener(tag: String, listener: IMoGoRomaListener) { listener.romaStatus(roma) + listener.mapRomaInRange(romaRange) } fun invokeMapRomaRange(romaRange: Boolean) {