diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 13d7dac84d..b31bd57da7 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -57,7 +57,7 @@ class MoGoAutopilotProvider : get() = TAG override fun init(context: Context) { - MoGoHandAdasMsgManager.getInstance() + MoGoHandAdasMsgManager.getInstance(context) CallerLogger.i("$M_ADAS_IMPL$TAG", "初始化工控机连接……") mContext = context // 初始化ADAS 域控制器 diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index 784f21cfb5..b27b57f21b 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -1,9 +1,11 @@ package com.mogo.eagle.core.function.autopilot.adapter; +import android.content.Context; import android.text.TextUtils; import android.util.Log; import com.mogo.eagle.core.data.config.FunctionBuildConfig; +import com.mogo.eagle.core.data.constants.MoGoConfig; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener; @@ -13,6 +15,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateLi import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.module.common.drawer.IdentifyDataDrawer; @@ -34,18 +37,20 @@ public class MoGoHandAdasMsgManager implements private final String TAG = "AdasEventManager"; private static volatile MoGoHandAdasMsgManager moGoHandAdasMsgManager; + private Context mContext; - private MoGoHandAdasMsgManager() { + private MoGoHandAdasMsgManager(Context context) { CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this); CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this); CallerAutopilotCarConfigListenerManager.INSTANCE.addListener(TAG, this); + mContext = context; } - public static MoGoHandAdasMsgManager getInstance() { + public static MoGoHandAdasMsgManager getInstance(Context context) { if (moGoHandAdasMsgManager == null) { synchronized (MoGoHandAdasMsgManager.class) { if (moGoHandAdasMsgManager == null) { - moGoHandAdasMsgManager = new MoGoHandAdasMsgManager(); + moGoHandAdasMsgManager = new MoGoHandAdasMsgManager(context); } } } @@ -144,7 +149,7 @@ public class MoGoHandAdasMsgManager implements @Override public void onAutopilotBrakeLightByAcceleration(double acceleration) { //设置刹车信息 - if (acceleration < -2.5) { + if (acceleration < SharedPrefsMgr.getInstance(mContext).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,-2.5F)) { brakeLight = 1; } else { brakeLight = 0; 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 21a25409f3..419160c5aa 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 @@ -257,6 +257,18 @@ class DebugSettingView @JvmOverloads constructor( } } + tbEagleEyeController.setOnCheckedChangeListener { buttonView, isChecked -> + if(isChecked){ + buttonView.setCompoundDrawables(null, null, iconDown, null) + //展示参数配置 + eagleEyeControllerLayout.visibility = View.VISIBLE + }else{ + buttonView.setCompoundDrawables(null, null, iconRight, null) + //隐藏参数配置 + eagleEyeControllerLayout.visibility = View.GONE + } + } + /** * 域控制器 */ @@ -388,6 +400,8 @@ class DebugSettingView @JvmOverloads constructor( } } + //设置鹰眼本地参数配置监听 + setEagleEyeConfigListener() //域控制器中心事件点击监听 setDomainControllerCheckedChangeListener() //Hmi控制中心事件点击监听 @@ -500,6 +514,39 @@ class DebugSettingView @JvmOverloads constructor( } + /** + * 设置鹰眼本地参数配置监听 + */ + private fun setEagleEyeConfigListener(){ + //初始化刹车加速度阈值信息 + val brakeThreshold = SharedPrefsMgr.getInstance(context) + .getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,-2.5F) + etInputBrakeThreshold.setText(brakeThreshold.toString()) + etInputBrakeThreshold.text?.let { etInputBrakeThreshold.setSelection(brakeThreshold.toString().length) } + //设置刹车加速度阈值信息 + btnBrakeThreshold.setOnClickListener { + val thresholdStr = etInputBrakeThreshold.text.toString() + if(thresholdStr.isNullOrEmpty()){ + ToastUtils.showShort("请输入正确的判定刹车加速度阈值") + }else{ + try{ + val thresholdStrFloat = thresholdStr.toFloat() + if(thresholdStrFloat<0){ + SharedPrefsMgr.getInstance(context).putFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,thresholdStrFloat) + ToastUtils.showShort("刹车阈值设置成功") + }else{ + ToastUtils.showShort("刹车阈值加速度值应小于0") + } + }catch (e: Exception){ + ToastUtils.showShort("判定刹车加速度阈值格式设置不正确") + } + + + + } + } + } + /** * 设置域控制器点击监听 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index a0f9958855..b0c4f8f304 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -472,6 +472,75 @@ android:orientation="vertical" android:visibility="gone"> + + + + +