Skip to content

Commit e9d0f9f

Browse files
author
gabrielsan
authored
timeout logic fix
The 'millis' patch had timeout logic reversed. 'poll' calls would always fail.
1 parent e99ae40 commit e9d0f9f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ModbusRtu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ int8_t Modbus::poll()
696696
u32time = millis();
697697
return 0;
698698
}
699-
if ((unsigned long)(millis() -u32time) > (unsigned long)T35) return 0;
699+
if ((unsigned long)(millis() -u32time) < (unsigned long)T35) return 0;
700700

701701
// transfer Serial buffer frame to auBuffer
702702
u8lastRec = 0;
@@ -778,7 +778,7 @@ int8_t Modbus::poll( uint16_t *regs, uint8_t u8size )
778778
u32time = millis();
779779
return 0;
780780
}
781-
if ((unsigned long)(millis() -u32time) > (unsigned long)T35) return 0;
781+
if ((unsigned long)(millis() -u32time) < (unsigned long)T35) return 0;
782782

783783
u8lastRec = 0;
784784
int8_t i8state = getRxBuffer();

0 commit comments

Comments
 (0)