   }
 }
 
+
   switch(doorState) {
     case doorClosed:
       // wait until a button is pressed or the front switch opens
       if (swFront == HIGH || swTrigger == LOW) {
-        Serial.print(currentMillis);
         if (swFront == HIGH) {
           // maybe someone tried to pull the door open
           // TODO: or the door slams too fast into the end-stop and rebounds. align profile & inertial reality
-          Serial.print(F(" Front switch triggered - opening door\r\n"));
+          debug(currentMillis, F("Front switch triggered - opening door\r\n"));
           initDrive(backward, accelProfileLow);
         } else {
-          Serial.print(F(" Button switch triggered - opening door\r\n"));
+          debug(currentMillis, F("Button switch triggered - opening door\r\n"));
           initDrive(backward, accelProfileHigh);
 // TODO: think again. re-arming swTrigger disables deglitching
 // any short HIGH pulse resets swTrigger to LOW

    case doorBlocked:
      // wait until a button is pressed
      if (swTrigger == LOW) {
        Serial.print(currentMillis);
        // close door only if end-stop is active
        if (swBack == LOW) {
          Serial.print(F(" Button switch triggered - closing door\r\n"));
//          initDrive(forward, accelProfileLow);
          initDrive(forward, accelProfileHigh);
          ledMode = ledForward;
          doorState = doorClosing;
        } else {
          Serial.print(F(" Button switch triggered - opening door\r\n"));
          initDrive(backward, accelProfileLow);
          ledMode = ledBackward;
          doorState = doorOpening;

      // stop if button pressed while in motion
      if (swTrigger == LOW) {
        motorFree(); // TODO: motorBrake() might be better for an emergency stop. doesn't make much different in our case, the belt skips and the door stops in both cases
        debug(currentMillis, F("Button switch triggered - door blocked\r\n"));
        setLeds1(red, ledSolid);
        doorState = doorBlocked;
swTrigger = HIGH;
        break;
      }

      driveTotalMillis += elapsedMillis;
      driveStepMillis += elapsedMillis;
      if (driveStepMillis >= accelProfile[accelProfileIdx].stepMillis) {
        driveMillis += driveStepMillis;
        driveStepMillis = 0;
