Browse Source

Merge Servo pin (PR#2425)

Richard Wackerbarth 9 years ago
parent
commit
ee71845d60
2 changed files with 4 additions and 8 deletions
  1. 3
    5
      Marlin/servo.cpp
  2. 1
    3
      Marlin/servo.h

+ 3
- 5
Marlin/servo.cpp View File

244
 
244
 
245
 uint8_t Servo::attach(int pin, int min, int max) {
245
 uint8_t Servo::attach(int pin, int min, int max) {
246
   if (this->servoIndex < MAX_SERVOS ) {
246
   if (this->servoIndex < MAX_SERVOS ) {
247
-  #if defined(ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
248
-    if (pin > 0) this->pin = pin; else pin = this->pin;
249
-  #endif
250
-    pinMode(pin, OUTPUT);                                   // set servo pin to output
251
-    servos[this->servoIndex].Pin.nbr = pin;
247
+    if(pin > 0)
248
+      servos[this->servoIndex].Pin.nbr = pin;
249
+    pinMode(servos[this->servoIndex].Pin.nbr, OUTPUT); // set servo pin to output
252
     // todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
250
     // todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
253
     this->min = (MIN_PULSE_WIDTH - min) / 4; //resolution of min/max is 4 uS
251
     this->min = (MIN_PULSE_WIDTH - min) / 4; //resolution of min/max is 4 uS
254
     this->max = (MAX_PULSE_WIDTH - max) / 4;
252
     this->max = (MAX_PULSE_WIDTH - max) / 4;

+ 1
- 3
Marlin/servo.h View File

128
     int read();                        // returns current pulse width as an angle between 0 and 180 degrees
128
     int read();                        // returns current pulse width as an angle between 0 and 180 degrees
129
     int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
129
     int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
130
     bool attached();                   // return true if this servo is attached, otherwise false
130
     bool attached();                   // return true if this servo is attached, otherwise false
131
-    #if defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0
132
-      int pin;                           // store the hardware pin of the servo
133
-    #endif
131
+
134
   private:
132
   private:
135
     uint8_t servoIndex;               // index into the channel data for this servo
133
     uint8_t servoIndex;               // index into the channel data for this servo
136
     int8_t min;                       // minimum is this value times 4 added to MIN_PULSE_WIDTH
134
     int8_t min;                       // minimum is this value times 4 added to MIN_PULSE_WIDTH

Loading…
Cancel
Save