   BLECentral central = blePeripheral.central();
   // if a central is connected to peripheral:
   if (central) {
-    if (debug) {
-      Serial.print("Connected to central: ");
-    }
+    printIfDebug("Connected to central: ");
     // print the central's MAC address:
-    printIfDebug(central.address());
+    printlnIfDebug(central.address());
     // turn on the LED to indicate the connection:
     digitalWrite(13, HIGH);
     // as long as the central is still connected:

  blePeripheral.addAttribute(turnstyleBleService);
  blePeripheral.addAttribute(turnstyleBleIntCharacteristic);
  blePeripheral.begin();
  printIfDebug("Bluetooth device active, waiting for connections...");

  // configure LCD
  lcd.begin(16, 2);

        baselineYaw = currentYaw;
        switchClosedLastIteration = false;
      }
      float doorAngle = abs(currentYaw - baselineYaw);
      // if the doorAngle is > 180, it must be due to the discontinuity, assuming doors open to an angle of max 180 degrees.
      if (doorAngle > 180) {
        doorAngle = 360 - doorAngle;
      }
    } else {
      switchClosedLastIteration = true;
    }
