   }
 
   doorWatchdog = 0;
+  doorWatchdogMax = DOOR_MOTOR_WATCHDOG_CLOSE_MAX;
+  doorWatchdogLowSpeedCutover = DOOR_MOTOR_WATCHDOG_CLOSE_LOW_SPEED;
+  doorLowSpeed = DOOR_LOW_SPEED_CLOSE;
   doorState = DOOR_STATE_CLOSING;
 }
 
 
 /**
- * Updates the speed of the motor.  The PWM field will be incremented by RAMP_UP_VALUE
+ * Updates the speed of the motor.  The PWM field will be incremented by DOOR_SPEED_RAMP
  * each time this method is called until the MAX_PWM is reached.  If the door is no longer opening
  * or closing, no speed change will occur. If the speed is negative, no speed change will occur.
  * 
  * In order to not bang into the limit switches, after a pre-determined amount of time, the motor
- * speed will be lowered to 
+ * speed will be ramped down to a low speed value appropriate for the door direction.
  * 
  * Finally, this method increments and checks a watchdog counter in case the limit switches
  * are never tripped.  If the motor runs for too long, it is stopped and the door state becomes

// and atomicity
volatile byte doorCommand = DOOR_COMMAND_NONE;

// Door PWM setting.  A negative values indicates no motor output and are used for a motor start delay.
int doorSpeed = 0;

// Door watchdog counter.
unsigned int doorWatchdog = 0;


/**

    doorState = DOOR_STATE_UNKNOWN;
    interrupts();
    return;
  }
  
  if (doorWatchdog >= doorWatchdogLowSpeedCutover) {
    if (doorSpeed > doorLowSpeed) {
      doorSpeed -= DOOR_SPEED_RAMP;
      if (doorSpeed < doorLowSpeed) {
        doorSpeed = doorLowSpeed;
      }
      pwm = (doorSpeed >> 6) & 0xFF;
      analogWrite(PWM_PIN, pwm);
    }
    interrupts();
    return;
  }

  if (doorSpeed >= MAX_DOOR_SPEED) {
    interrupts();
    return;
  }

  doorSpeed += DOOR_SPEED_RAMP;
  if (doorSpeed >= MAX_DOOR_SPEED) {
    doorSpeed = MAX_DOOR_SPEED;
  }

  pwm = (doorSpeed >> 6) & 0xFF;
  
  if (doorSpeed > 0) {
    analogWrite(PWM_PIN, pwm);
