Skip to content

Commit f904f95

Browse files
committed
Replace if state selection with switch/case.
1 parent 770378b commit f904f95

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

examples/Braccio_Learn_and_Repeat/Braccio_Learn_and_Repeat.ino

+4-13
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,11 @@ void loop()
175175
if ((now - prev) >= 100)
176176
{
177177
prev = now;
178-
179-
if (state == State::RECORD)
180-
{
181-
state = handle_RECORD();
182-
}
183-
184-
if (state == State::REPLAY)
185-
{
186-
state = handle_REPLAY();
187-
}
188-
189-
if (state == State::ZERO_POSITION)
178+
switch (state)
190179
{
191-
state = handle_ZERO_POSITION();
180+
case State::RECORD: state = handle_RECORD(); break;
181+
case State::REPLAY: state = handle_REPLAY(); break;
182+
case State::ZERO_POSITION: state = handle_ZERO_POSITION(); break;
192183
}
193184
}
194185
}

0 commit comments

Comments
 (0)