Browse Source

Merge pull request #1910 from thinkyhead/some_fixes

Rename servos[] array in Marlin to servo[]
Scott Lahteine 9 years ago
parent
commit
639ffc341e
2 changed files with 21 additions and 21 deletions
  1. 20
    20
      Marlin/Marlin_main.cpp
  2. 1
    1
      Marlin/planner.cpp

+ 20
- 20
Marlin/Marlin_main.cpp View File

@@ -379,7 +379,7 @@ bool target_direction;
379 379
 #endif
380 380
 
381 381
 #if NUM_SERVOS > 0
382
-  Servo servos[NUM_SERVOS];
382
+  Servo servo[NUM_SERVOS];
383 383
 #endif
384 384
 
385 385
 #ifdef CHDK
@@ -534,28 +534,28 @@ void suicide() {
534 534
 
535 535
 void servo_init() {
536 536
   #if NUM_SERVOS >= 1 && HAS_SERVO_0
537
-    servos[0].attach(SERVO0_PIN);
537
+    servo[0].attach(SERVO0_PIN);
538 538
   #endif
539 539
   #if NUM_SERVOS >= 2 && HAS_SERVO_1
540
-    servos[1].attach(SERVO1_PIN);
540
+    servo[1].attach(SERVO1_PIN);
541 541
   #endif
542 542
   #if NUM_SERVOS >= 3 && HAS_SERVO_2
543
-    servos[2].attach(SERVO2_PIN);
543
+    servo[2].attach(SERVO2_PIN);
544 544
   #endif
545 545
   #if NUM_SERVOS >= 4 && HAS_SERVO_3
546
-    servos[3].attach(SERVO3_PIN);
546
+    servo[3].attach(SERVO3_PIN);
547 547
   #endif
548 548
 
549 549
   // Set position of Servo Endstops that are defined
550 550
   #ifdef SERVO_ENDSTOPS
551 551
   for (int i = 0; i < 3; i++)
552 552
     if (servo_endstops[i] >= 0)
553
-      servos[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]);
553
+      servo[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]);
554 554
   #endif
555 555
 
556 556
   #if SERVO_LEVELING
557 557
     delay(PROBE_SERVO_DEACTIVATION_DELAY);
558
-    servos[servo_endstops[Z_AXIS]].detach();
558
+    servo[servo_endstops[Z_AXIS]].detach();
559 559
   #endif
560 560
 }
561 561
 
@@ -889,7 +889,7 @@ void get_command() {
889 889
 }
890 890
 
891 891
 bool code_has_value() {
892
-  char c = *(strchr_pointer + 1);
892
+  char c = strchr_pointer[1];
893 893
   return (c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.';
894 894
 }
895 895
 
@@ -1255,12 +1255,12 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1255 1255
       // Engage Z Servo endstop if enabled
1256 1256
       if (servo_endstops[Z_AXIS] >= 0) {
1257 1257
         #if SERVO_LEVELING
1258
-          servos[servo_endstops[Z_AXIS]].attach(0);
1258
+          servo[servo_endstops[Z_AXIS]].attach(0);
1259 1259
         #endif
1260
-        servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
1260
+        servo[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
1261 1261
         #if SERVO_LEVELING
1262 1262
           delay(PROBE_SERVO_DEACTIVATION_DELAY);
1263
-          servos[servo_endstops[Z_AXIS]].detach();
1263
+          servo[servo_endstops[Z_AXIS]].detach();
1264 1264
         #endif
1265 1265
       }
1266 1266
 
@@ -1319,14 +1319,14 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1319 1319
         #endif
1320 1320
 
1321 1321
         #if SERVO_LEVELING
1322
-          servos[servo_endstops[Z_AXIS]].attach(0);
1322
+          servo[servo_endstops[Z_AXIS]].attach(0);
1323 1323
         #endif
1324 1324
 
1325
-        servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
1325
+        servo[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
1326 1326
 
1327 1327
         #if SERVO_LEVELING
1328 1328
           delay(PROBE_SERVO_DEACTIVATION_DELAY);
1329
-          servos[servo_endstops[Z_AXIS]].detach();
1329
+          servo[servo_endstops[Z_AXIS]].detach();
1330 1330
         #endif
1331 1331
       }
1332 1332
 
@@ -1520,7 +1520,7 @@ static void homeaxis(AxisEnum axis) {
1520 1520
       #endif
1521 1521
         {
1522 1522
           if (servo_endstops[axis] > -1)
1523
-            servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
1523
+            servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
1524 1524
         }
1525 1525
 
1526 1526
     #endif // SERVO_ENDSTOPS && !Z_PROBE_SLED
@@ -1598,7 +1598,7 @@ static void homeaxis(AxisEnum axis) {
1598 1598
     // Retract Servo endstop if enabled
1599 1599
     #ifdef SERVO_ENDSTOPS
1600 1600
       if (servo_endstops[axis] > -1)
1601
-        servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
1601
+        servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
1602 1602
     #endif
1603 1603
 
1604 1604
     #if SERVO_LEVELING && !defined(Z_PROBE_SLED)
@@ -3990,12 +3990,12 @@ inline void gcode_M226() {
3990 3990
       servo_position = code_value();
3991 3991
       if ((servo_index >= 0) && (servo_index < NUM_SERVOS)) {
3992 3992
         #if SERVO_LEVELING
3993
-          servos[servo_index].attach(0);
3993
+          servo[servo_index].attach(0);
3994 3994
         #endif
3995
-        servos[servo_index].write(servo_position);
3995
+        servo[servo_index].write(servo_position);
3996 3996
         #if SERVO_LEVELING
3997 3997
           delay(PROBE_SERVO_DEACTIVATION_DELAY);
3998
-          servos[servo_index].detach();
3998
+          servo[servo_index].detach();
3999 3999
         #endif
4000 4000
       }
4001 4001
       else {
@@ -4010,7 +4010,7 @@ inline void gcode_M226() {
4010 4010
       SERIAL_PROTOCOL(" Servo ");
4011 4011
       SERIAL_PROTOCOL(servo_index);
4012 4012
       SERIAL_PROTOCOL(": ");
4013
-      SERIAL_PROTOCOL(servos[servo_index].read());
4013
+      SERIAL_PROTOCOL(servo[servo_index].read());
4014 4014
       SERIAL_EOL;
4015 4015
     }
4016 4016
   }

+ 1
- 1
Marlin/planner.cpp View File

@@ -393,7 +393,7 @@ void plan_init() {
393 393
 #endif
394 394
 
395 395
 void check_axes_activity() {
396
-  unsigned char axis_active[NUM_AXIS],
396
+  unsigned char axis_active[NUM_AXIS] = { 0 },
397 397
                 tail_fan_speed = fanSpeed;
398 398
   #ifdef BARICUDA
399 399
     unsigned char tail_valve_pressure = ValvePressure,

Loading…
Cancel
Save