Skip to content

Commit e742f4d

Browse files
committed
negative timeout for .sequential/.parallel means no timeout
1 parent 484a261 commit e742f4d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/main/java/org/usfirst/frc/team69/util/CommandBuilder.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,16 @@ public CommandBuilder sequential(Command command) {
6565
* @param command
6666
* The command to add in sequence
6767
* @param timeout
68-
* The timeout, in seconds
68+
* The timeout, in seconds. if negative, no timeout is used.
6969
* @return This CommandBuilder object
7070
*/
7171
public CommandBuilder sequential(Command command, double timeout) {
72-
m_cmdGroup.addSequential(command, timeout);
72+
if(timeout >= 0) {
73+
m_cmdGroup.addSequential(command, timeout);
74+
} else {
75+
m_cmdGroup.addSequential(command);
76+
}
77+
7378
return this;
7479
}
7580

@@ -100,11 +105,15 @@ public CommandBuilder parallel(Command command) {
100105
* @param command
101106
* The command to add in parallel
102107
* @param timeout
103-
* The timeout, in seconds
108+
* The timeout, in seconds. if negative, no timeout is used.
104109
* @return This CommandBuilder object
105110
*/
106111
public CommandBuilder parallel(Command command, double timeout) {
107-
m_cmdGroup.addParallel(command, timeout);
112+
if(timeout >= 0) {
113+
m_cmdGroup.addParallel(command, timeout);
114+
} else {
115+
m_cmdGroup.addParallel(command);
116+
}
108117
return this;
109118
}
110119

0 commit comments

Comments
 (0)