Servos attach/detach based only on servo config

Assuming #2470 fixed up the main issue.
This commit is contained in:
Scott Lahteine 2015-07-22 12:26:57 -07:00 committed by Richard Wackerbarth
parent b80a6a8d31
commit 96ace72ddc

View file

@ -306,14 +306,14 @@ bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; }
int8_t Servo::move(int pin, int value) {
int8_t ret;
#if SERVO_LEVELING
#if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && (SERVO_DEACTIVATION_DELAY > 0)
ret = this->attach(pin);
#else
ret = this->servoIndex;
#endif
if (ret >= 0) {
this->write(value);
#if SERVO_LEVELING
#if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && (SERVO_DEACTIVATION_DELAY > 0)
delay(SERVO_DEACTIVATION_DELAY);
this->detach();
#endif