mirror of
https://github.com/thunderbug1/Spherebot-Host-GUI.git
synced 2026-02-20 03:11:20 +01:00
Reduce pen down speed
This commit is contained in:
@@ -494,21 +494,27 @@ void process_commands(char command[], int command_length) // deals with standard
|
|||||||
|
|
||||||
void moveServo(double value)
|
void moveServo(double value)
|
||||||
{
|
{
|
||||||
|
const int incrementDelay = SERVO_DELAY;
|
||||||
|
const int currentAngle = servo.read();
|
||||||
|
|
||||||
servoEnabled = true;
|
servoEnabled = true;
|
||||||
if (value < 0.)
|
if (value < 0.) value = 0.;
|
||||||
value = 0.;
|
if (value > 180.) value = 180.;
|
||||||
else if (value > 180.)
|
|
||||||
|
if (value > currentAngle) // down
|
||||||
{
|
{
|
||||||
value = DEFAULT_PEN_UP_POSITION;
|
for (int angle=currentAngle; angle<value; angle++) // single "degree" increments
|
||||||
servo.write((int)value);
|
|
||||||
for(int i=0; i<100; i++)
|
|
||||||
{
|
{
|
||||||
SoftwareServo::refresh();
|
servo.write(angle);
|
||||||
delay(2);
|
delay (incrementDelay);
|
||||||
|
SoftwareServo::refresh();
|
||||||
}
|
}
|
||||||
servoEnabled = false;
|
|
||||||
}
|
}
|
||||||
servo.write((int)value);
|
else if (value < currentAngle) // up, no delay
|
||||||
|
{
|
||||||
|
servo.write((int)value);
|
||||||
|
}
|
||||||
|
// nothing to be done if value == currentAngle
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This code was ported from the Makerbot/ReplicatorG java sources */
|
/* This code was ported from the Makerbot/ReplicatorG java sources */
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#define XAXIS_MICROSTEPPING 16
|
#define XAXIS_MICROSTEPPING 16
|
||||||
|
|
||||||
#define SERVO_PIN_1 10
|
#define SERVO_PIN_1 10
|
||||||
|
#define SERVO_DELAY 75 // (ms) delay between position changes
|
||||||
|
|
||||||
// Optional output
|
// Optional output
|
||||||
#define ALT_PIN 2
|
#define ALT_PIN 2
|
||||||
|
|||||||
Reference in New Issue
Block a user