瀏覽代碼

Eliminate the further use of the pin-parameter

AnHardt 10 年之前
父節點
當前提交
a6628f12cc
共有 1 個檔案被更改,包括 3 行新增4 行删除
  1. 3
    4
      Marlin/servo.cpp

+ 3
- 4
Marlin/servo.cpp 查看文件

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(pin == 0)
248
-      pin = servos[this->servoIndex].Pin.nbr;
249
-    pinMode(pin, OUTPUT);                                   // set servo pin to output
250
-    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
251
     // todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
250
     // todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
252
     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
253
     this->max = (MAX_PULSE_WIDTH - max) / 4;
252
     this->max = (MAX_PULSE_WIDTH - max) / 4;

Loading…
取消
儲存