Skip to content

Commit 6840c95

Browse files
committed
add vTaskDelay calls on select fnc
1 parent cdae56d commit 6840c95

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Diff for: src/libmodbus/modbus-rtu.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,9 @@ static int _modbus_rtu_select(modbus_t *ctx, fd_set *rset,
12681268
if (s_rc >= length_to_read) {
12691269
break;
12701270
}
1271+
#ifdef INCLUDE_vTaskDelay
1272+
vTaskDelay(1);
1273+
#endif
12711274
} while ((millis() - start) < wait_time_millis);
12721275

12731276
if (s_rc == 0) {

Diff for: src/libmodbus/modbus-tcp.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,9 @@ static int _modbus_tcp_select(modbus_t *ctx, fd_set *rset, struct timeval *tv, i
844844
if (s_rc >= length_to_read) {
845845
break;
846846
}
847+
#ifdef INCLUDE_vTaskDelay
848+
vTaskDelay(1);
849+
#endif
847850
} while ((millis() - start) < wait_time_millis && ctx_tcp->client->connected());
848851
#else
849852
while ((s_rc = select(ctx->s+1, rset, NULL, NULL, tv)) == -1) {

0 commit comments

Comments
 (0)