Merge pull request #7504 from thinkyhead/bf1_servo_delays

Individual servo delays
This commit is contained in:
Scott Lahteine 2017-08-16 16:05:22 -05:00 committed by GitHub
commit 385f1bb9e5
38 changed files with 46 additions and 43 deletions

View file

@ -114,6 +114,7 @@ script:
# #
- restore_configs - restore_configs
- opt_enable NUM_SERVOS Z_ENDSTOP_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE - 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 AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT
- opt_enable_adv EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET - opt_enable_adv EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET
- build_marlin - build_marlin

View file

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

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. // 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. // 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it. // If the servo can't reach the requested position, increase it.
#define SERVO_DELAY 300 #define SERVO_DELAY { 300 }
// Servo deactivation // Servo deactivation
// //

View file

@ -2101,7 +2101,7 @@ static void clean_up_after_endstop_or_probe_move() {
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
void bltouch_command(int angle) { void bltouch_command(int angle) {
servo[Z_ENDSTOP_SERVO_NR].move(angle); // Give the BL-Touch the command and wait MOVE_SERVO(Z_ENDSTOP_SERVO_NR, angle); // Give the BL-Touch the command and wait
safe_delay(BLTOUCH_DELAY); safe_delay(BLTOUCH_DELAY);
} }
@ -2192,7 +2192,7 @@ static void clean_up_after_endstop_or_probe_move() {
#elif HAS_Z_SERVO_ENDSTOP && DISABLED(BLTOUCH) #elif HAS_Z_SERVO_ENDSTOP && DISABLED(BLTOUCH)
servo[Z_ENDSTOP_SERVO_NR].move(z_servo_angle[deploy ? 0 : 1]); MOVE_SERVO(Z_ENDSTOP_SERVO_NR, z_servo_angle[deploy ? 0 : 1]);
#elif ENABLED(Z_PROBE_ALLEN_KEY) #elif ENABLED(Z_PROBE_ALLEN_KEY)
@ -6702,7 +6702,7 @@ inline void gcode_M42() {
SERIAL_ERROR_START(); SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Z_ENDSTOP_SERVO_NR not setup"); SERIAL_ERRORLNPGM("Z_ENDSTOP_SERVO_NR not setup");
#else #else // HAS_Z_SERVO_ENDSTOP
const uint8_t probe_index = parser.byteval('P', Z_ENDSTOP_SERVO_NR); const uint8_t probe_index = parser.byteval('P', Z_ENDSTOP_SERVO_NR);
@ -6750,10 +6750,10 @@ inline void gcode_M42() {
SET_INPUT_PULLUP(PROBE_TEST_PIN); SET_INPUT_PULLUP(PROBE_TEST_PIN);
bool deploy_state, stow_state; bool deploy_state, stow_state;
for (uint8_t i = 0; i < 4; i++) { for (uint8_t i = 0; i < 4; i++) {
servo[probe_index].move(z_servo_angle[0]); //deploy MOVE_SERVO(probe_index, z_servo_angle[0]); //deploy
safe_delay(500); safe_delay(500);
deploy_state = READ(PROBE_TEST_PIN); deploy_state = READ(PROBE_TEST_PIN);
servo[probe_index].move(z_servo_angle[1]); //stow MOVE_SERVO(probe_index, z_servo_angle[1]); //stow
safe_delay(500); safe_delay(500);
stow_state = READ(PROBE_TEST_PIN); stow_state = READ(PROBE_TEST_PIN);
} }
@ -6777,7 +6777,7 @@ inline void gcode_M42() {
} }
else { // measure active signal length else { // measure active signal length
servo[probe_index].move(z_servo_angle[0]); // deploy MOVE_SERVO(probe_index, z_servo_angle[0]); // deploy
safe_delay(500); safe_delay(500);
SERIAL_PROTOCOLLNPGM("please trigger probe"); SERIAL_PROTOCOLLNPGM("please trigger probe");
uint16_t probe_counter = 0; uint16_t probe_counter = 0;
@ -6802,7 +6802,7 @@ inline void gcode_M42() {
else else
SERIAL_PROTOCOLLNPGM("noise detected - please re-run test"); // less than 2mS pulse SERIAL_PROTOCOLLNPGM("noise detected - please re-run test"); // less than 2mS pulse
servo[probe_index].move(z_servo_angle[1]); //stow MOVE_SERVO(probe_index, z_servo_angle[1]); //stow
} // pulse detected } // pulse detected

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -308,9 +308,11 @@ int Servo::readMicroseconds() {
bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; } bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; }
void Servo::move(int value) { 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) { if (this->attach(0) >= 0) {
this->write(value); this->write(value);
delay(SERVO_DELAY); delay(servo_delay[this->servoIndex]);
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
this->detach(); this->detach();
#endif #endif