davinci: parts: Quickly takeback the motor in free fall

Change-Id: Ib31f4cf5b1de4cd9366b3d15945749a53d260690
This commit is contained in:
Arian 2020-10-14 22:06:57 +02:00
parent 4f2af261f3
commit 236c8747e3
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9

View File

@ -102,7 +102,12 @@ public class PopupCameraService extends Service implements Handler.Callback {
@Override @Override
public void onSensorChanged(SensorEvent event) { public void onSensorChanged(SensorEvent event) {
if (event.values[0] == 2.0f) { if (event.values[0] == 2.0f) {
updateMotor(Constants.CLOSE_CAMERA_STATE); try {
mMotor.takebackMotorShortly();
mSensorManager.unregisterListener(mFreeFallListener, mFreeFallSensor);
} catch (RemoteException e) {
// Do nothing
}
goBackHome(); goBackHome();
} }
} }