コード例 #1
0
  @Override
  public void onSensorChanged(SensorEvent event) {

    if (firstRun) {
      startTime = event.timestamp;
      firstRun = false;
    }

    if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED) {
      magneticFieldBias.calcBias(event.values);

      // storing data to file
      ArrayList<Float> dataValues = ExtraFunctions.arrayToList(event.values);
      dataValues.add(0, (float) (event.timestamp - startTime));
      dataFileWriter.writeToFile("Magnetic_Field_Uncalibrated", dataValues);
    }
  }
コード例 #2
0
 public float[] getMagBias() {
   return magneticFieldBias.getBias();
 }