Skip to content

Commit

Permalink
Move shouldForward
Browse files Browse the repository at this point in the history
  • Loading branch information
MUSTARDTIGERFPV committed Jul 29, 2024
1 parent b309fe5 commit 3468cf5
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions lib/WIFI/devWIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,29 +796,29 @@ static void HandleWebUpdate()
}
break;
}
if (shouldForward)
}
if (shouldForward)
{
// Track gaps in the sequence number, add to a dropped counter
uint8_t seq = msg.seq;
if (expectedSeqSet && seq != expectedSeq)
{
// Track gaps in the sequence number, add to a dropped counter
uint8_t seq = msg.seq;
if (expectedSeqSet && seq != expectedSeq)
// account for rollovers
if (seq < expectedSeq)
{
// account for rollovers
if (seq < expectedSeq)
{
mavlink_stats.drops_downlink += (UINT8_MAX - expectedSeq) + seq;
}
else
{
mavlink_stats.drops_downlink += seq - expectedSeq;
}
mavlink_stats.drops_downlink += (UINT8_MAX - expectedSeq) + seq;
}
else
{
mavlink_stats.drops_downlink += seq - expectedSeq;
}
expectedSeq = seq + 1;
expectedSeqSet = true;
// Forward the message to the GCS
mavlink_to_gcs_buf[mavlink_to_gcs_buf_count] = msg;
mavlink_to_gcs_buf_count++;
mavlink_stats.packets_downlink++;
}
expectedSeq = seq + 1;
expectedSeqSet = true;
// Forward the message to the GCS
mavlink_to_gcs_buf[mavlink_to_gcs_buf_count] = msg;
mavlink_to_gcs_buf_count++;
mavlink_stats.packets_downlink++;
}
}
#else
Expand Down

0 comments on commit 3468cf5

Please sign in to comment.