예제 #1
0
 @Override
 public void onSensorChanged(SensorEvent event) {
   if (event.sensor.getType() != Sensor.TYPE_ORIENTATION) {
     return;
   }
   float roll = event.values[2];
   rollFilter.pushValue(roll);
   if (startAngle.getCount() == 0 && rollFilter.getCount() == SETTLE_COUNT) {
     startAngle.pushValue(rollFilter.getValue());
   }
 }
예제 #2
0
 public float deltaAngle() {
   if (startAngle.getCount() == 0) {
     return 0;
   }
   return rollFilter.getValue() - startAngle.getValue();
 }