[m1-p-1.1.0] fix bug of mapview model light

This commit is contained in:
zhongchao
2023-03-10 12:13:54 +08:00
parent 73ef6d9818
commit ca1fcb150b
2 changed files with 8 additions and 17 deletions

View File

@@ -87,8 +87,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
setExtraGPSData(gnssInfo)
}
@Volatile
private var isVisualAngleChanged = false
private var currentLevel:Int = 0
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
super.onAutopilotLightSwitchData(lightSwitch)
@@ -96,35 +95,28 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
when (it.number) {
Chassis.LightSwitch.LIGHT_LEFT_VALUE -> { //左转灯
CallerVisualAngleManager.showTurning(true)
showTurn(1)
turn(1)
}
Chassis.LightSwitch.LIGHT_RIGHT_VALUE -> { //右转灯
CallerVisualAngleManager.showTurning(true)
showTurn(2)
turn(2)
}
Chassis.LightSwitch.LIGHT_NONE_VALUE -> {
CallerVisualAngleManager.showTurning(false)
hideTurn()
turn(0)
}
}
}
}
private fun showTurn(lightNum: Int) {
if (!isVisualAngleChanged) {
isVisualAngleChanged = true
private fun turn(lightNum: Int) {
if (currentLevel != lightNum) {
when (lightNum) {
0 -> CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
1 -> CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
2 -> CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
}
}
}
private fun hideTurn() {
if (isVisualAngleChanged) {
isVisualAngleChanged = false
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
currentLevel = lightNum
}
}

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.call.autopilot
import android.util.Log
import chassis.Chassis
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.call.base.CallerBase