Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit 8df4013

Browse files
author
astronomer80
committed
Some fix to the soft start and to the comments
1 parent 0e4d6e9 commit 8df4013

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

src/Braccio.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Default implementation
8888
*/
8989
unsigned int _Braccio::begin() {
9090
//SOFT_START_SLOW is the default value
91-
return begin(SOFT_START_SLOW);
91+
return begin(0);
9292
}
9393

9494
/*
@@ -111,27 +111,11 @@ The SOFT_START_CONTROL_PIN is used as a software PWM
111111
*/
112112
void _Braccio::_softStart(int soft_start_level){
113113
long int tmp=millis();
114-
if (soft_start_level==SOFT_START_FAST){
115-
while(millis()-tmp < LOW_LIMIT_TIMEOUT)
116-
_softwarePWM(125, 50);
114+
while(millis()-tmp < LOW_LIMIT_TIMEOUT)
115+
_softwarePWM(30+soft_start_level, 500 - soft_start_level);
117116

118-
while(millis()-tmp < HIGH_LIMIT_TIMEOUT)
119-
_softwarePWM(125, 105);
120-
121-
}else if (soft_start_level==SOFT_START_MEDIUM){
122-
while(millis()-tmp < LOW_LIMIT_TIMEOUT)
123-
_softwarePWM(15, 125);
124-
125-
while(millis()-tmp < HIGH_LIMIT_TIMEOUT)
126-
_softwarePWM(15, 145);
127-
128-
}else if (soft_start_level==SOFT_START_SLOW){
129-
while(millis()-tmp < LOW_LIMIT_TIMEOUT)
130-
_softwarePWM(15, 155);
131-
132-
while(millis()-tmp < HIGH_LIMIT_TIMEOUT)
133-
_softwarePWM(5, 165);
134-
}
117+
while(millis()-tmp < HIGH_LIMIT_TIMEOUT)
118+
_softwarePWM(25 + soft_start_level, 480 - soft_start_level);
135119

136120
digitalWrite(SOFT_START_CONTROL_PIN,HIGH);
137121
}

src/Braccio.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424
#include <Servo.h>
2525

2626
// You should set begin(SOFT_START_DISABLED) if you are using the Arm Robot shield V1.6
27-
#define SOFT_START_DISABLED 0
28-
//You can set different values for the softstart. SOFT_START_SLOW is the default value
29-
#define SOFT_START_FAST 2
30-
#define SOFT_START_MEDIUM 3
31-
#define SOFT_START_SLOW 4
27+
#define SOFT_START_DISABLED -999
3228

3329
//The software PWM is connected to PIN 12. You cannot use the pin 12 if you are using
3430
//a Braccio shield V4 or newer

0 commit comments

Comments
 (0)