Skip to content

Commit 1284398

Browse files
committed
v2.2.1 Gcode
1 parent db449eb commit 1284398

25 files changed

Lines changed: 3046 additions & 680 deletions

examples/Metal/Metal.ino

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
// test by John Feng
2-
3-
//#define LATEST_HARDWARE
41
#include "uArm.h"
52

63
void setup() {
7-
Serial.begin(115200);
8-
4+
Serial.begin(115200); // start serial port at 115200 bps
95
uArm.setup();
10-
Serial.println("[READY]");
11-
uArm.moveTo(0, 150, 150, 10);
126

137

148
}
159

1610
void loop() {
1711
uArm.run();
18-
19-
}
12+
}

protocol.pdf

290 KB
Binary file not shown.

src/UFServo.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,18 @@ uint8_t Servo::attach(int pin)
259259
return this->attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
260260
}
261261

262+
void Servo::setPulseWidthRange(int min, int max)
263+
{
264+
this->min = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 uS
265+
this->max = (MAX_PULSE_WIDTH - max)/4;
266+
}
267+
262268
uint8_t Servo::attach(int pin, int min, int max)
263269
{
264270
if(this->servoIndex < MAX_SERVOS ) {
265271
pinMode( pin, OUTPUT) ; // set servo pin to output
266272
servos[this->servoIndex].Pin.nbr = pin;
267-
// todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
268-
this->min = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 uS
269-
this->max = (MAX_PULSE_WIDTH - max)/4;
273+
270274
// initialize the timer if it has not already been initialized
271275
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
272276
if(isTimerActive(timer) == false)

src/UFServo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class Servo
106106
int read(); // returns current pulse width as an angle between 0 and 180 degrees
107107
int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
108108
bool attached(); // return true if this servo is attached, otherwise false
109+
void setPulseWidthRange(int min, int max);
109110
private:
110111
uint8_t servoIndex; // index into the channel data for this servo
111112
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH

0 commit comments

Comments
 (0)