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 faf450483d..396cbaf9ef 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
@@ -43,6 +43,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.map.MogoMap
import kotlinx.android.synthetic.main.view_debug_setting.view.*
+import java.util.*
/**
* @author xiaoyuzhou
@@ -63,11 +64,26 @@ class DebugSettingView @JvmOverloads constructor(
private var logInfoView: LogInfoView? = null
private var logViewAttach = false
+ private var mAutoPilotStatusInfo: AutopilotStatusInfo?=null
+ private var mAutoPilotCarStateInfo: AutopilotCarStateInfo?=null
+
init {
LayoutInflater.from(context).inflate(R.layout.view_debug_setting, this, true)
initView()
}
+ /**
+ * 定时刷新视图数据,防止因为过快更新导致anr异常
+ */
+ private val timerTaskRefresh = object : TimerTask() {
+ override fun run() {
+ UiThreadHandler.post {
+ // 绘制应用基本信息
+ drawAppInfo()
+ }
+ }
+ }
+
override fun onAttachedToWindow() {
super.onAttachedToWindow()
// 添加 OBU状态 监听
@@ -83,6 +99,8 @@ class DebugSettingView @JvmOverloads constructor(
if (logInfoView != null) {
logInfoView!!.onEnterForeground()
}
+ // 开启定时查询速度
+ Timer().schedule(timerTaskRefresh, Date(), 100)
}
override fun onDetachedFromWindow() {
@@ -100,6 +118,11 @@ class DebugSettingView @JvmOverloads constructor(
if (logInfoView != null) {
logInfoView!!.onEnterBackground()
}
+ try {
+ timerTaskRefresh.cancel()
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
}
private fun initView() {
@@ -372,35 +395,33 @@ class DebugSettingView @JvmOverloads constructor(
AppConfigInfo.isConnectSocket = DebugConfig.isDownloadSnapshot()
// 将数据绘制
- tvAppInfo.text =Html.fromHtml( AppConfigInfo.toString())
+ tvAppInfo.text = Html.fromHtml(AppConfigInfo.toString())
+
+ tvAutopilotInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo)
+
+ tvCarInfo.text =
+ "GPS时间:${mAutoPilotCarStateInfo?.values?.satelliteTime}\n" +
+ "自车经纬度:\n${mAutoPilotCarStateInfo?.values?.lon}\n${mAutoPilotCarStateInfo?.values?.lat}\n"
}
/**
* OBU状态回调
*/
override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) {
- UiThreadHandler.post {
- tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
+ tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
- AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion
- AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus
- drawAppInfo()
- }
+ AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion
+ AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus
}
/**
* 自动驾驶状态回调
*/
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
- UiThreadHandler.post {
- tvAutopilotInfo.post {
- tvAutopilotInfo.text = GsonUtils.toJson(autoPilotStatusInfo)
+ mAutoPilotStatusInfo = autoPilotStatusInfo
- AppConfigInfo.adasSdkVersion = autoPilotStatusInfo.version
- AppConfigInfo.isConnectAutopilot = autoPilotStatusInfo.connectStatus
- drawAppInfo()
- }
- }
+ AppConfigInfo.adasSdkVersion = autoPilotStatusInfo.version
+ AppConfigInfo.isConnectAutopilot = autoPilotStatusInfo.connectStatus
}
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {
@@ -409,13 +430,7 @@ class DebugSettingView @JvmOverloads constructor(
override fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
//Logger.d(TAG, "autoPilotCarStateInfo:$autoPilotCarStateInfo")
- UiThreadHandler.post {
- tvAutopilotInfo.post {
- tvCarInfo.text =
- "GPS时间:${autoPilotCarStateInfo?.values?.satelliteTime}\n" +
- "自车经纬度:\n${autoPilotCarStateInfo?.values?.lon}\n${autoPilotCarStateInfo?.values?.lat}\n"
- }
- }
+ mAutoPilotCarStateInfo = autoPilotCarStateInfo
}
override fun onAutopilotSNRequest() {
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt
index 0e05f8996e..a0c12bee4b 100644
--- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt
@@ -44,10 +44,6 @@ object AppConfigInfo {
// 是否OBU
var isConnectObu: Boolean = false
- /*应用配置信息,这里的配置将影响功能,用来替换productFlavors配置的那种编译渠道*/
- // GPS数据提供源: 0-Android系统,1-工控机,2-OBU
- var GPS_PROVIDER = 1
-
override fun toString(): String {
return "-------------------应用信息--------------------
" +