mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 16:26:14 +08:00
ui: only check sensorEvents when offroad (#22893)
This commit is contained in:
+3
-3
@@ -152,14 +152,14 @@ static void update_state(UIState *s) {
|
||||
if (sm.updated("carParams")) {
|
||||
scene.longitudinal_control = sm["carParams"].getCarParams().getOpenpilotLongitudinalControl();
|
||||
}
|
||||
if (sm.updated("sensorEvents")) {
|
||||
if (!scene.started && sm.updated("sensorEvents")) {
|
||||
for (auto sensor : sm["sensorEvents"].getSensorEvents()) {
|
||||
if (!scene.started && sensor.which() == cereal::SensorEventData::ACCELERATION) {
|
||||
if (sensor.which() == cereal::SensorEventData::ACCELERATION) {
|
||||
auto accel = sensor.getAcceleration().getV();
|
||||
if (accel.totalSize().wordCount) { // TODO: sometimes empty lists are received. Figure out why
|
||||
scene.accel_sensor = accel[2];
|
||||
}
|
||||
} else if (!scene.started && sensor.which() == cereal::SensorEventData::GYRO_UNCALIBRATED) {
|
||||
} else if (sensor.which() == cereal::SensorEventData::GYRO_UNCALIBRATED) {
|
||||
auto gyro = sensor.getGyroUncalibrated().getV();
|
||||
if (gyro.totalSize().wordCount) {
|
||||
scene.gyro_sensor = gyro[1];
|
||||
|
||||
Reference in New Issue
Block a user