Fix small logic error in ParallelDeadlineGroup (#2095)

This commit is contained in:
Oblarg
2019-11-18 18:33:45 -05:00
committed by Peter Johnson
parent 6f6c6da9f5
commit 0e83c65d27
3 changed files with 14 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ void ParallelDeadlineGroup::Initialize() {
commandRunning.first->Initialize();
commandRunning.second = true;
}
isRunning = true;
m_finished = false;
}
void ParallelDeadlineGroup::Execute() {
@@ -31,6 +31,9 @@ void ParallelDeadlineGroup::Execute() {
if (commandRunning.first->IsFinished()) {
commandRunning.first->End(false);
commandRunning.second = false;
if (commandRunning.first.get() == m_deadline) {
m_finished = true;
}
}
}
}
@@ -41,10 +44,9 @@ void ParallelDeadlineGroup::End(bool interrupted) {
commandRunning.first->End(true);
}
}
isRunning = false;
}
bool ParallelDeadlineGroup::IsFinished() { return m_deadline->IsFinished(); }
bool ParallelDeadlineGroup::IsFinished() { return m_finished; }
bool ParallelDeadlineGroup::RunsWhenDisabled() const {
return m_runWhenDisabled;
@@ -56,7 +58,7 @@ void ParallelDeadlineGroup::AddCommands(
return;
}
if (isRunning) {
if (!m_finished) {
wpi_setWPIErrorWithContext(CommandIllegalUse,
"Commands cannot be added to a CommandGroup "
"while the group is running");