Skip to content

Commit

Permalink
Fix SPort telemetry loss issue (#196)
Browse files Browse the repository at this point in the history
`cmpTimeUs(micros(), nextSendTime)` can overflow after 35 min if no MSP activity.
  • Loading branch information
gongtao0607 authored Dec 5, 2024
1 parent 6e8111c commit 6cbbcba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/telemetry/smartport.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,15 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
return;
}

// We have a small chance that `nextSendTime` is indeed 0.
// This is a benign defect and just slows down MSP reply.
if (nextSendTime != 0 && (cmpTimeUs(micros(), nextSendTime) <= 0)) {
// Don't send sensor data now. This will improve the reception of the MSP message.
return;
}

// Blackout window passed. Reset `nextSendTime`.
nextSendTime = 0;
#endif

// we can send back any data we want, our tables keep track of the order and frequency of each data type we send
Expand Down

0 comments on commit 6cbbcba

Please sign in to comment.