 
 enum period_t sleepPeriod; // how long the processor should sleep for
 double basePressure, previousPressure, previousAltitude; // pressure (mb): 0 AGL
-
+boolean inPlaneTriggered;
 //3.33 fpm elevator
 
 void BMPSetup() {

  digitalWrite(LED_PIN, HIGH);

  currentPressure = getPressure();
  currentAltitude = pressure.altitude(currentPressure, basePressure);

  if (currentAltitude < 2 && currentAltitude > -2) {
    sleepPeriod = SLEEP_8S;
    // consider this noise, set as base
    basePressure = currentPressure;
  } else {
    // we're in the air
    sleepPeriod = SLEEP_1S;

    // human falls at 53 m/s
    // open canopy, full flight 5 m/s
    // refresh rate is 1 s on arduino
    while (previousAltitude - currentAltitude > 35 && // m/s
           currentAltitude < 1370) { // 4500 ft
      // beep and wait for slowing down
      tone(2, 2048);
      LowPower.powerSave(SLEEP_1S, ADC_OFF, BOD_ON, TIMER2_ON);
      noTone(2);
    }
  }
  

  delay(100); //Allow for serial print to complete.

  BMPSetup();
  inPlaneTriggered = false;

  sleepPeriod = SLEEP_8S;

  Serial.println("Initialisation complete.");
  delay(100); //Allow for serial print to complete.
}

/***************************************************
 *  Name:        loop
