3

I am writing an app for logging some data for skydiving. I have currently 3 Modes: -Ground (recalibrating airpressure on groundlevel) -Flight (quick reducing airpressure) -Jump (quick increasing airpressure) I am receiving the sensor values through my registered SensorEventListener

 @Override
public void onSensorChanged(SensorEvent event) {
    Log.d("currentStatus", currentStatus.toString());
    long currentTime = System.currentTimeMillis();
    switch (currentStatus) {
    case GROUND:

        if (lastCheck == null || lastCheck.getTimestamp() < currentTime - 30000) {

            if (lastCheck != null && Calc.getAltitudeByPressure(lastCheck.getPressure(), event.values[0]) >= 30){
                currentStatus = Status.FLIGHT;
                groundlevel = lastCheck;
                pw.println(currentTime+": Status wechselt: Flight");
            }
            else{
                Log.d("Kalibirierung", event.values[0] + "");
                pw.println(currentTime+": Kalibrierung: "+event.values[0]);
            }

            lastCheck = new EnvValues(currentTime, event.values[0], 0);
        }
        break;
    case FLIGHT:
        lastCheck = new EnvValues(currentTime, event.values[0], 0);
        pw.println(currentTime+": Aktuelle Höhe: "+Calc.getAltitudeByPressure(groundlevel.getPressure(), lastCheck.getPressure()));
        break;

    case JUMP:
        break;

    }

}

It works on ground and on climb perfectly, some logdata ("aktuelle Höhe" means current altitude in meters):

1438424661607: Kalibrierung: 1006.6233
1438424756674: Status wechselt: Flight
1438424756674: Aktuelle Höhe: 81
1438424756674: Aktuelle Höhe: 348
1438424756674: Aktuelle Höhe: 349
1438424756674: Aktuelle Höhe: 348
1438424756792: Aktuelle Höhe: 349
1438424756991: Aktuelle Höhe: 349
1438424757191: Aktuelle Höhe: 354
1438424757391: Aktuelle Höhe: 354

But on dropping altitude and during freefall it logs :

1438425939005: Aktuelle Höhe: 3953
1438426040917: Aktuelle Höhe: 3952
1438426040917: Aktuelle Höhe: 3953
1438426040917: Aktuelle Höhe: 749
1438426040917: Aktuelle Höhe: 747
1438426040917: Aktuelle Höhe: 747
1438426040917: Aktuelle Höhe: 747
1438426041052: Aktuelle Höhe: 746
1438426041195: Aktuelle Höhe: 745

there is no freefall logged and the timestamp is the same before exit and after opening the canopy.

Here is a link to the logfile (its very big): Link to logfile

In the logfile you can see the raising altitude until dropping-altitude (the plane was a long time on dropping-altitude of 3950m), the next value is 749m. The data for 1 minute freefall is completely missing. does anybody knows what happens here?

Ef Ge
  • 788
  • 1
  • 9
  • 26
  • Sensor events usually do not come in the real time as they happen(to save battery and cpu time). Instead they come in batches and have `timestamp` field. You should use `event.timestamp` as your `currentTime` instead of `System.currentTimeMillis()`. – Ilya Polenov Aug 03 '15 at 11:01
  • ok, this explains the timestamps, but not the missing data from 3953m to 749m – Ef Ge Aug 03 '15 at 12:17
  • Do you use a wakelock for the cpu? When you register your listener, the system will stop giving you sensor events short time after the device goes to sleep. – Ilya Polenov Aug 03 '15 at 12:26
  • The question still remains - do you use a wakelock to keep cpu awake? It is critical to use one. See http://developer.android.com/reference/android/hardware/Sensor.html#isWakeUpSensor() – Ilya Polenov Aug 03 '15 at 12:41
  • Oh sorry... No, I don't use a wakelock. But the data appears continuous in climb and under canopy, so I thought it doesn't matter. – Ef Ge Aug 03 '15 at 12:46
  • Strange. Is this screen on or off? What's the device? some are not so good at keeping the sensor going screen off even with the WakeLock. If you want to run something else with pressure sensor based data logging my biking app IpBike should log the altitude although the filtering is not setup for your scenario. Of course running another app like this may well change the way your stuff behaves at the same time. – Ifor Aug 06 '15 at 22:47
  • Device is a GalaxyS5. Screen is off. I implemented a wakelock and will test it tomorrow! – Ef Ge Aug 07 '15 at 12:44

0 Answers0