Skip to content

Commit 37c8b3c

Browse files
committed
After two consecutive pings fail, we flag the issue with the user via LED.
This is a trade off to prevent too long wait times.
1 parent 8b27240 commit 37c8b3c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Braccio++.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void BraccioClass::motorConnectedThreadFunc()
345345
int next_id_to_be_pinged = SmartServoClass::MIN_MOTOR_ID;
346346
int servo_missed_ping_cnt[SmartServoClass::NUM_MOTORS] = {0};
347347

348-
static int const MAX_MISSED_PING_CNT = 3;
348+
static int const MAX_MISSED_PING_CNT = 2;
349349

350350
for (;;)
351351
{
@@ -356,7 +356,7 @@ void BraccioClass::motorConnectedThreadFunc()
356356
if (!is_connected) servo_missed_ping_cnt[SmartServoClass::idToArrayIndex(next_id_to_be_pinged)]++;
357357
else servo_missed_ping_cnt[SmartServoClass::idToArrayIndex(next_id_to_be_pinged)] = 0;
358358

359-
if (servo_missed_ping_cnt[SmartServoClass::idToArrayIndex(next_id_to_be_pinged)] > MAX_MISSED_PING_CNT)
359+
if (servo_missed_ping_cnt[SmartServoClass::idToArrayIndex(next_id_to_be_pinged)] >= MAX_MISSED_PING_CNT)
360360
setMotorConnectionStatus(next_id_to_be_pinged, false);
361361
else
362362
setMotorConnectionStatus(next_id_to_be_pinged, true);

0 commit comments

Comments
 (0)