Commit Graph

15 Commits

Author SHA1 Message Date
Scott Lahteine
ba1c2a9819 Update servo.* for parity with 2.0.x 2018-03-08 19:32:32 -06:00
Scott Lahteine
e02a5a6371 Add macros for delays by machine cycle 2017-04-11 09:18:32 -05:00
Scott Lahteine
03c70c1990 SERVO_DEACTIVATION_DELAY => SERVO_DELAY 2016-06-23 14:33:29 -07:00
Scott Lahteine
5d8036e554 Code cleanup around MOTOR_CURRENT_PWM options 2016-03-25 04:23:46 -07:00
Scott Lahteine
0da744b7b0 Further cleanup of comments, partial Doxygen-style
Following up on #3231
2016-03-25 00:45:56 -07:00
jbrazio
5e5d250832 Added gplv3 header to all Marlin files 2016-03-24 18:01:20 +00:00
PheiPheiPhei
adb5375a09 Enabling servo usage on boards with PWM current control
Enabling servo usage on boards with PWM current control
timer5 is used by some boards like the Mini Rambo for controlling motor current via PWM, see stepper.cpp.
```cpp
  #ifdef MOTOR_CURRENT_PWM_XY_PIN
    pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT);
    pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT);
    pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT);
    digipot_current(0, motor_current_setting[0]);
    digipot_current(1, motor_current_setting[1]);
    digipot_current(2, motor_current_setting[2]);
    //Set timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise)
    TCCR5B = (TCCR5B & ~(_BV(CS50) | _BV(CS51) | _BV(CS52))) | _BV(CS50);
  #endif
}
```
Using the same timer for controlling servos results in loss of motor control. So use timer4/3 for those boards instead.
[See discussion here.](http://shop.prusa3d.com/forum/software-f13/enabling-auto-leveling-in-firmware-t416-s40.html)
2016-03-22 00:56:31 +01:00
Scott Lahteine
0c7f7ebcfb Styling adjustments (PR#2668 & PR#2670)
Keep "astyled" reformatting
2015-10-03 22:02:45 -05:00
AnHardt
8b876241bd Some more servo code tweaks
Just set up the pin. Don't move to a random position.

Simplify servo::move()
* servo::move() does not need the pin parameter - The pin is set during servo_init() with attach().
* servo::move() does not need a return value.

SERVO_LEVELING is the wrong condition to deactivate the servos.

Remove some temporary (Servo *) variables.
SanityCheck for the servo indexes.
2015-07-24 22:04:49 -05:00
Scott Lahteine
eacfe132aa Change the name of servos[] and servo_t 2015-07-19 11:35:48 -07:00
Scott Lahteine
3b23ccd366 Patch servos code for move
- Have `Servo::attach` explicitly return -1 if it fails
- Check for -1 in `Servo::move` because `servoIndex` might be 0
- Make `attach` / `detach` calls conditional on `SERVO_LEVELING`
- Move `SERVO_LEVELING` define to `Conditionals.h`
2015-07-19 11:24:23 -07:00
AnHardt
8504992e9f Remove the additional pin variable in Servo.cpp
as sugested by @c-born
inhttps://github.com/MarlinFirmware/Marlin/issues/1885#issuecomment-92618240
2015-07-15 20:50:58 -05:00
Scott Lahteine
391386dd94 Update configs for new servo deactivation 2015-07-15 19:13:40 -05:00
AnHardt
2ddb2a2be9 Add Servo::move() to servo.cpp
move(pin, angel) - Sequence of attach(pin), write(angel),
                   if DEACTIVATE_SERVOS_AFTER_MOVE is defined waits SERVO_DEACTIVATION_DELAY, than detaches.

As we have jitter on the servos during moves of the steppers, and detaching them improves this behaviour,
the usual sequence to handle a servo movement is:
attach(pin)
write(angel)
delay(until the servo finished the move)
detache()

Here a function to handle the complete sequence.
2015-07-15 17:39:43 -05:00
Ivan Galvez Junquera
59529b755d Fixed lowercase change missing on commit a22a228b.
Servo.cpp and Servo.h were changed to lowercase in Makefile but not their actual filenames.
2015-05-04 09:44:34 +02:00