fix bug of global route next does not show and acc refresh

This commit is contained in:
zhongchao
2022-08-03 15:09:01 +08:00
parent 9e75876530
commit 95d557ea00
2 changed files with 25 additions and 13 deletions

View File

@@ -1,8 +1,10 @@
package com.mogo.eagle.core.function.hmi.ui.widget; package com.mogo.eagle.core.function.hmi.ui.widget;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@@ -11,20 +13,16 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.hmi.R; 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.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import chassis.Chassis; import chassis.Chassis;
import mogo.telematics.pad.MessagePad;
/** /**
* @author Jing * @author Jing
@@ -42,6 +40,22 @@ public class TrafficDataView extends ConstraintLayout {
//圆弧颜色 //圆弧颜色
private int mArcColor; private int mArcColor;
private static final int MSG_SEND_UPDATE = 1;
private volatile double acceleration;
@SuppressLint("HandlerLeak")
private final Handler handler = new Handler() {
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if (msg.what == MSG_SEND_UPDATE) {
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.00");
String accStr = mFormat.format(acceleration);
accTextView.setText("a: " + accStr);
}
}
};
public TrafficDataView(@NonNull Context context) { public TrafficDataView(@NonNull Context context) {
super(context); super(context);
} }
@@ -64,12 +78,10 @@ public class TrafficDataView extends ConstraintLayout {
super.onAttachedToWindow(); super.onAttachedToWindow();
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener); CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, gnssInfo -> { CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, gnssInfo -> {
CallerLogger.INSTANCE.d(TAG, "司机屏加速度:" + gnssInfo.getAcceleration()); if (gnssInfo != null) {
ThreadUtils.runOnUiThread(() -> { acceleration = gnssInfo.getAcceleration();
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.00"); }
String accStr = mFormat.format(gnssInfo.getAcceleration()); handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
accTextView.setText("a: " + accStr);
});
}); });
} }
@@ -96,7 +108,7 @@ public class TrafficDataView extends ConstraintLayout {
*/ */
@Override @Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) { public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
if(lightSwitch != null){ if (lightSwitch != null) {
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString()); CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
} }
} }

View File

@@ -308,7 +308,7 @@ public class AMapCustomView
Log.d(TAG, "onAutopilotRotting"); Log.d(TAG, "onAutopilotRotting");
List list = globalPathResp.getWayPointsList(); List list = globalPathResp.getWayPointsList();
int minCount = 2; int minCount = 2;
if (list.size() >= minCount && sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) { if (list.size() >= minCount) {
calculate = true; calculate = true;
MessagePad.Location sLocation = (MessagePad.Location) list.get(0); MessagePad.Location sLocation = (MessagePad.Location) list.get(0);
MessagePad.Location eLocation = (MessagePad.Location) list.get(list.size() - 1); MessagePad.Location eLocation = (MessagePad.Location) list.get(list.size() - 1);