Skip to content

Commit 2d2fc00

Browse files
authored
Merge pull request #87 from sparkfun/release_candidate
v3.1.13 - make millis timeouts wrap-safe
2 parents 939754f + 49a6cdb commit 2d2fc00

File tree

14 files changed

+21
-21
lines changed

14 files changed

+21
-21
lines changed

.github/workflows/compile-sketch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
run: echo running on branch ${GITHUB_REF##*/}
9393

9494
- name: Compile Sketch
95-
uses: arduino/compile-sketches@v1
95+
uses: arduino/compile-sketches@v1.1.0
9696
with:
9797
platforms: ${{ matrix.board.platforms }}
9898
fqbn: ${{ matrix.board.fqbn }}

examples/Basics/Example34_I2C_Serial_Passthrough/Example34_I2C_Serial_Passthrough.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void loop()
8787
// If it is more than i2cReadInterval_ms since the last read, read how
8888
// many bytes are available in the GNSS I2C buffer. This will leave the register
8989
// address pointing at 0xFF.
90-
if ((millis() > (i2cLastRead_ms + i2cReadInterval_ms)) || (i2cLastRead_ms == 0))
90+
if ((((millis() - i2cLastRead_ms) > i2cReadInterval_ms)) || (i2cLastRead_ms == 0))
9191
{
9292
i2cBytesAvailable = gnssI2cAvailable();
9393
i2cLastRead_ms = millis();
@@ -115,7 +115,7 @@ void loop()
115115
}
116116
// Else if uartI2cRingBuffer contains data and it is more than uartI2cSendInterval_ms
117117
// since the last send, send them
118-
else if ((bytesToSend > 0) && (millis() > (uartI2cLastSend_ms + uartI2cSendInterval_ms)))
118+
else if ((bytesToSend > 0) && ((millis() - uartI2cLastSend_ms) > uartI2cSendInterval_ms))
119119
{
120120
sendI2cBytes(bytesToSend);
121121
uartI2cLastSend_ms = millis();
@@ -148,7 +148,7 @@ void loop()
148148
}
149149
// Else if i2cUartRingBuffer contains data and it is more than i2cUartSendInterval_ms
150150
// since the last send, send them
151-
else if ((bytesToSend > 0) && (millis() > (i2cUartLastSend_ms + i2cUartSendInterval_ms)))
151+
else if ((bytesToSend > 0) && ((millis() - i2cUartLastSend_ms) > i2cUartSendInterval_ms))
152152
{
153153
sendUartBytes(bytesToSend);
154154
i2cUartLastSend_ms = millis();

examples/Data_Logging/DataLoggingExample3_RXM_SFRBX_and_RAWX/DataLoggingExample3_RXM_SFRBX_and_RAWX.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void loop()
210210

211211
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
212212

213-
if (millis() > (lastPrint + 1000)) // Print the message count once per second
213+
if ((millis() - lastPrint) > 1000) // Print the message count once per second
214214
{
215215
Serial.print(F("Number of message groups received: SFRBX: ")); // Print how many message groups have been received (see note above)
216216
Serial.print(numSFRBX);

examples/Data_Logging/DataLoggingExample4_RXM_without_Callbacks/DataLoggingExample4_RXM_without_Callbacks.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void loop()
181181

182182
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
183183

184-
if (millis() > (lastPrint + 1000)) // Print bytesWritten once per second
184+
if ((millis() - lastPrint) > 1000) // Print bytesWritten once per second
185185
{
186186
Serial.print(F("The number of bytes written to SD card is ")); // Print how many bytes have been written to SD card
187187
Serial.println(bytesWritten);

examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void loop()
196196

197197
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
198198

199-
if (millis() > (lastPrint + 1000)) // Print bytesWritten once per second
199+
if ((millis() - lastPrint) > 1000) // Print bytesWritten once per second
200200
{
201201
Serial.print(F("The number of bytes written to SD card is: ")); // Print how many bytes have been written to SD card
202202
Serial.println(bytesWritten);

examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void loop()
178178

179179
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
180180

181-
if (millis() > (lastPrint + 1000)) // Print bytesWritten once per second
181+
if ((millis() - lastPrint) > 1000) // Print bytesWritten once per second
182182
{
183183
Serial.print(F("The number of bytes written to SD card is ")); // Print how many bytes have been written to SD card
184184
Serial.println(bytesWritten);

examples/Data_Logging/DataLoggingExample7_OpenLogESP32_SPI_SDIO/DataLoggingExample7_OpenLogESP32_SPI_SDIO.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void loop()
279279

280280
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
281281

282-
if (millis() > (lastPrint + 1000)) // Print the message count once per second
282+
if ((millis() - lastPrint) > 1000) // Print the message count once per second
283283
{
284284
uint16_t maxBufferBytes = myGNSS.getMaxFileBufferAvail(); // Get how full the file buffer has been (not how full it is now)
285285
float bufferHigh = 100.0 * (float)maxBufferBytes / (float)fileBufferSize;

examples/Data_Logging/DataLoggingExample8_RTCM/DataLoggingExample8_RTCM.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void loop()
183183

184184
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
185185

186-
if (millis() > (lastPrint + 1000)) // Print bytesWritten once per second
186+
if ((millis() - lastPrint) > 1000) // Print bytesWritten once per second
187187
{
188188
Serial.print(F("The number of bytes written to SD card is ")); // Print how many bytes have been written to SD card
189189
Serial.println(bytesWritten);

examples/Data_Logging/DataLoggingExample9_enableUBXlogging/DataLoggingExample9_enableUBXlogging.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void loop()
194194

195195
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
196196

197-
if (millis() > (lastPrint + 1000)) // Print bytesWritten once per second
197+
if ((millis() - lastPrint) > 1000) // Print bytesWritten once per second
198198
{
199199
Serial.print(F("The number of bytes written to SD card is ")); // Print how many bytes have been written to SD card
200200
Serial.println(bytesWritten);

examples/NEO-F10N/Example1_NAV_SIG/Example1_NAV_SIG.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void loop()
298298
void printDot() // Print a dot every 200ms - without using delay
299299
{
300300
static unsigned long lastPrint = millis();
301-
if (millis() > (lastPrint + 200))
301+
if ((millis() - lastPrint) > 200)
302302
{
303303
Serial.print(".");
304304
lastPrint = millis();

0 commit comments

Comments
 (0)