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

@ -114,6 +114,7 @@ script:
#
- restore_configs
- opt_enable NUM_SERVOS Z_ENDSTOP_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE
- opt_set NUM_SERVOS 1
- opt_enable AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT
- opt_enable_adv EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET
- build_marlin

View File

@ -377,7 +377,7 @@
#endif
#undef DEACTIVATE_SERVOS_AFTER_MOVE
#undef SERVO_DELAY
#define SERVO_DELAY 50
#define SERVO_DELAY { 50 }
#ifndef BLTOUCH_DELAY
#define BLTOUCH_DELAY 375
#endif

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1615,7 +1615,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1754,7 +1754,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1603,7 +1603,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1586,7 +1586,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1596,7 +1596,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1586,7 +1586,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1594,7 +1594,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1607,7 +1607,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1577,7 +1577,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1577,7 +1577,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1610,7 +1610,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1599,7 +1599,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1623,7 +1623,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1607,7 +1607,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1651,7 +1651,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1629,7 +1629,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1595,7 +1595,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1723,7 +1723,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1716,7 +1716,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1711,7 +1711,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1714,7 +1714,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1714,7 +1714,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1723,7 +1723,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1609,7 +1609,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1598,7 +1598,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1590,7 +1590,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

View File

@ -1600,7 +1600,7 @@
// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
// 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300
#define SERVO_DELAY { 300 }
// Servo deactivation
//

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