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 Servo::move(int pin, int value) {
int8_t ret; int8_t ret;
#if SERVO_LEVELING #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && (SERVO_DEACTIVATION_DELAY > 0)
ret = this->attach(pin); ret = this->attach(pin);
#else #else
ret = this->servoIndex; ret = this->servoIndex;
#endif #endif
if (ret >= 0) { if (ret >= 0) {
this->write(value); this->write(value);
#if SERVO_LEVELING #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && (SERVO_DEACTIVATION_DELAY > 0)
delay(SERVO_DEACTIVATION_DELAY); delay(SERVO_DEACTIVATION_DELAY);
this->detach(); this->detach();
#endif #endif