Implement SERVO_DELAY as array

This modify give SERVO_DELAY x servo basis
This commit is contained in:
GMagician
2017-08-11 23:21:39 +02:00
committed by Scott Lahteine
parent 96ae53cf41
commit e9c72978c7
37 changed files with 39 additions and 36 deletions

View File

@@ -308,9 +308,11 @@ int Servo::readMicroseconds() {
bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; }
void Servo::move(int value) {
constexpr uint16_t servo_delay[] = SERVO_DELAY;
static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
if (this->attach(0) >= 0) {
this->write(value);
delay(SERVO_DELAY);
delay(servo_delay[this->servoIndex]);
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
this->detach();
#endif