Browse Source

Merge pull request #7793 from tcm0116/2.0.x-servo

[2.0.x] Fix Servo class compile errors
Scott Lahteine 7 years ago
parent
commit
6904561fd5

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp View File

@@ -113,7 +113,7 @@
113 113
     servo_info[this->servoIndex].Pin.isActive = false;
114 114
   }
115 115
 
116
-  void Servo::write(const int value) {
116
+  void Servo::write(int value) {
117 117
     if (value < MIN_PULSE_WIDTH) { // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
118 118
       value = map(constrain(value, 0, 180), 0, 180, SERVO_MIN(), SERVO_MAX());
119 119
         // odd - this sets zero degrees to 544 and 180 degrees to 2400 microseconds but the literature says
@@ -122,7 +122,7 @@
122 122
     this->writeMicroseconds(value);
123 123
   }
124 124
 
125
-  void Servo::writeMicroseconds(const int value) {
125
+  void Servo::writeMicroseconds(int value) {
126 126
     // calculate and store the values for the given channel
127 127
     byte channel = this->servoIndex;
128 128
     if (channel < MAX_SERVOS) {  // ensure channel is valid

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.h View File

@@ -42,9 +42,9 @@
42 42
       int8_t attach(const int pin);            // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail)
43 43
       int8_t attach(const int pin, const int min, const int max); // as above but also sets min and max values for writes.
44 44
       void detach();
45
-      void write(const int value);             // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
46
-      void writeMicroseconds(const int value); // write pulse width in microseconds
47
-      void move(const int value);              // attach the servo, then move to value
45
+      void write(int value);             // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
46
+      void writeMicroseconds(int value); // write pulse width in microseconds
47
+      void move(const int value);        // attach the servo, then move to value
48 48
                                          // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
49 49
                                          // if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach
50 50
       int read();                        // returns current pulse width as an angle between 0 and 180 degrees

Loading…
Cancel
Save