Skip to content

Commit 43dd0fd

Browse files
authored
Fix: Capture a new start value - otherwise the loop will terminate prematurely due to a wrong timeout value. (#60)
1 parent 6f9992f commit 43dd0fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/Tools/Factory_Set_Initial_Servo_Position/Factory_Set_Initial_Servo_Position.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ bool set_initial_servo_position(int const id, float const target_angle)
5252
auto isTimeout = [](unsigned long const start) -> bool { return ((millis() - start) > 2000); };
5353

5454
auto start = millis();
55-
5655
Serial.print("Connecting .... ");
5756
for (; !Braccio.get(id).connected() && !isTimeout(start); delay(10)) { }
5857
if (!isTimeout(start))
@@ -82,6 +81,7 @@ bool set_initial_servo_position(int const id, float const target_angle)
8281

8382
static float constexpr EPSILON = 2.0f;
8483

84+
start = millis();
8585
for ( float current_angle = Braccio.get(id).position();
8686
!isTargetAngleReached(EPSILON) && !isTimeout(start);)
8787
{

0 commit comments

Comments
 (0)