[dev_minibus-d_230425_3.2.0] 修改红绿灯闪烁问题,优化红绿灯读秒三位数显示不全问题

This commit is contained in:
lixiaopeng
2023-05-16 18:36:37 +08:00
parent f79321b852
commit 982139a078
5 changed files with 34 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT
@@ -100,7 +101,6 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
}
CallerTrafficLightListenerManager.resetTrafficLightStatus()
CallerTrafficLightListenerManager.invokeTrafficRequestError()
})
}
}, {

View File

@@ -51,7 +51,6 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
TrafficLightDispatcher()
}
}
private var mContext: Context? = null
@@ -156,7 +155,20 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
hide()
}
/**
* 是否重置红绿灯数据,需要确保在obu的红绿灯显示的时候不执行。否则会闪屏
*/
override fun resetTrafficLight(isReset: Boolean) {
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "resetTrafficLight ------> isReset = $isReset ")
if (!hasObuLightStatus) {
if(isReset){
hide()
}
}
}
private fun hide(){
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "hide() -------> ")
CallerTrafficLightListenerManager.disableTrafficLight()
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.HIDE_TRAFFIC_LIGHT, "0".toByteArray())
@@ -172,7 +184,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
lightSource: DataSourceType
) {
super.onTrafficLightPlusSource(light, remain, lightSource)
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onTrafficLightPlusSource ----- light = $light ---remain = $remain ---lightSource = $lightSource")
// CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onTrafficLightPlusSource ----- light = $light ---remain = $remain ---lightSource = $lightSource")
if (lightSource == DataSourceType.OBU) {
hasObuLightStatus = true
}
@@ -213,9 +225,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}
onTrafficLightPlusSource(it.convert(), remain, DataSourceType.AICLOUD)
}
}
fun destroy() {
//取消注册监听AI云.OBU,路侧获取红绿灯状态
CallerTrafficLightListenerManager.removeListener(TAG)

View File

@@ -64,7 +64,7 @@
<dimen name="hmi_traffic_light_bg_margin_left">15dp</dimen>
<dimen name="hmi_traffic_light_bg_margin_top">17dp</dimen>
<dimen name="hmi_traffic_light_icon_size">154dp</dimen>
<dimen name="hmi_traffic_light_time_view_width">71dp</dimen>
<dimen name="hmi_traffic_light_time_view_width">110dp</dimen>
<dimen name="hmi_traffic_light_time_size">60dp</dimen>
<dimen name="hmi_traffic_light_source_size">32dp</dimen>

View File

@@ -18,6 +18,11 @@ interface IMoGoTrafficLightListener {
}
/**
* 是否重置
*/
fun resetTrafficLight(isReset: Boolean) {}
/**
* 云端红绿灯接口请求失败
*/

View File

@@ -5,6 +5,8 @@ import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener>() {
@@ -57,10 +59,17 @@ object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener>
*/
fun resetTrafficLightStatus(hideTrafficLight:Boolean = true) {
trafficLightResult = null
// 隐藏traffic light
if(hideTrafficLight){
disableTrafficLight()
// // 隐藏traffic light
// if(hideTrafficLight){
// CallerLogger.d("${SceneConstant.M_OBU}${"TrafficLightDispatcher"}", "resetTrafficLightStatus ------> hideTrafficLight = $hideTrafficLight ")
// disableTrafficLight()
// }
M_LISTENERS.forEach {
val listener = it.value
listener.resetTrafficLight(hideTrafficLight)
}
}
fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {