Skip to content

Commit aa6655d

Browse files
dorkmoCopilot
andauthored
Update TankAlarm-112025-Client-BluesOpta/TankAlarm-112025-Client-BluesOpta.ino
Co-authored-by: Copilot <[email protected]>
1 parent fbb08d7 commit aa6655d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

TankAlarm-112025-Client-BluesOpta/TankAlarm-112025-Client-BluesOpta.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,8 @@ static float readTankSensor(uint8_t idx) {
12341234
}
12351235

12361236
// Count pulses over the sampling duration
1237-
while (millis() - sampleStart < RPM_SAMPLE_DURATION_MS) {
1237+
// Use unsigned subtraction to handle millis() overflow correctly
1238+
while ((millis() - sampleStart) < (unsigned long)RPM_SAMPLE_DURATION_MS) {
12381239
int currentState = digitalRead(pin);
12391240
// Count falling edges (HIGH to LOW transitions)
12401241
if (lastState == HIGH && currentState == LOW) {

0 commit comments

Comments
 (0)