Servos attach/detach based only on servo config

Assuming #2470 fixed up the main issue.
2.0.x
Scott Lahteine 9 years ago committed by Richard Wackerbarth
parent b80a6a8d31
commit 96ace72ddc

@ -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

Loading…
Cancel
Save