diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 38e0e7eb8d..d0c3c04879 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -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];