fix bug of ui causing anr
This commit is contained in:
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_C
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_PLANNING_OBJECTS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_STATUS_QUERY_RESP
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT
|
||||
@@ -374,14 +375,19 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
}
|
||||
}
|
||||
|
||||
//状态查询应答
|
||||
// @ChainLog(
|
||||
// linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT,
|
||||
// linkCode = CHAIN_LINK_ADAS,
|
||||
// endpoint = PAD,
|
||||
// nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_STATUS_QUERY_RESP,
|
||||
// paramIndexes = [0, 1],
|
||||
// clientPkFileName = "sn"
|
||||
// )
|
||||
override fun onStatusQueryResp(
|
||||
header: MessagePad.Header?,
|
||||
statusInfo: SystemStatusInfo.StatusInfo?
|
||||
) {
|
||||
//状态查询应答
|
||||
statusInfo?.let {
|
||||
Log.d(TAG, GsonUtil.jsonFromObject(it))
|
||||
}
|
||||
invokeAutopilotStatusRespByQuery(statusInfo)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public class TapPositionView extends ConstraintLayout {
|
||||
|
||||
public TapPositionView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
Log.d(TAG, "2");
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_tap_position, this);
|
||||
tabP = findViewById(R.id.tap_p);
|
||||
tabR = findViewById(R.id.tap_r);
|
||||
@@ -48,7 +47,6 @@ public class TapPositionView extends ConstraintLayout {
|
||||
if (tabP != null && tabR != null && tabN != null && tabD != null) {
|
||||
int defaultColor = typedArray.getColor(R.styleable.TapPositionView_defaultColor, -1);
|
||||
int selectColor = typedArray.getColor(R.styleable.TapPositionView_selectColor, -1);
|
||||
Log.d(TAG, "gear:" + gear);
|
||||
switch (gear) {
|
||||
case GEAR_NONE:
|
||||
tabP.setTextColor(defaultColor);
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateList
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -76,7 +77,9 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
|
||||
Log.d(TAG, "车辆转向灯:" + lightSwitch.toString());
|
||||
if(lightSwitch != null){
|
||||
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +88,7 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotBrakeLightData(boolean brakeLight) {
|
||||
Log.d(TAG, "刹车灯:" + String.valueOf(brakeLight));
|
||||
CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,18 +97,11 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
Log.d(TAG, "steering原始值====" + String.valueOf(steering));
|
||||
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
|
||||
if (Math.abs(steering) < 1) {
|
||||
steering = 0;
|
||||
}
|
||||
float steeringValue = steering;
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d(TAG, "steering忽略小数点后====" + String.valueOf((int) steeringValue));
|
||||
}
|
||||
});
|
||||
|
||||
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,16 +110,12 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d(TAG, "司机屏档位" + gear.toString());
|
||||
if (tapPositionView != null) {
|
||||
tapPositionView.updateWithGear(gear);
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (tapPositionView != null) {
|
||||
tapPositionView.updateWithGear(gear);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,30 +125,36 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
Log.d(TAG, "司机屏加速度:" + carAcc);
|
||||
java.text.DecimalFormat myformat = new java.text.DecimalFormat("0.00");
|
||||
String accStr = myformat.format(carAcc);
|
||||
accTextView.setText("a: " + String.valueOf(accStr));
|
||||
CallerLogger.INSTANCE.d(TAG, "司机屏加速度:" + carAcc);
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.00");
|
||||
String accStr = mFormat.format(carAcc);
|
||||
accTextView.setText("a: " + accStr);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
Log.d(TAG, "刹车:" + String.valueOf(brake));
|
||||
if (brake > 0){
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_brake);
|
||||
}else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (brake > 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_brake);
|
||||
} else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
Log.d(TAG, "油门:" + String.valueOf(throttle));
|
||||
if (throttle > 0){
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_accelerator);
|
||||
}else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (throttle > 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_accelerator);
|
||||
} else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user