Skip to content

Commit 1aa3465

Browse files
committed
Add comment
1 parent ba34680 commit 1aa3465

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,8 @@ typedef struct {
895895
updateSemaphore = xSemaphoreCreateMutex();
896896
if (xSemaphoreTake(updateSemaphore, 10 / portTICK_PERIOD_MS) == pdPASS)
897897
{
898+
// The semaphore prevents the race condition where timer is updated after
899+
// millis() is read but before the subtraction. It prevents retVal from underflowing
898900
retVal = millis() - timer;
899901
xSemaphoreGive(updateSemaphore);
900902
}

0 commit comments

Comments
 (0)