Merge pull request #1412 from openmv/rp2_wifi_fixes2

RP2: Nina WiFi timeout fixes.
This commit is contained in:
Ibrahim Abd Elkader 2021-07-28 23:00:44 +02:00 committed by GitHub
commit 5960bf597a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -702,7 +702,7 @@ int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_
return -1; return -1;
} }
for (mp_uint_t start = mp_hal_ticks_ms(); sock == 0 || sock == NO_SOCKET_AVAIL; mp_hal_delay_ms(100)) { for (mp_uint_t start = mp_hal_ticks_ms(); sock == 0 || sock == NO_SOCKET_AVAIL; mp_hal_delay_ms(10)) {
if (nina_send_command_read_vals(AVAIL_DATA_TCP_CMD, if (nina_send_command_read_vals(AVAIL_DATA_TCP_CMD,
1, ARG_8BITS, NINA_ARGS(ARG_BYTE(fd)), 1, ARG_8BITS, NINA_ARGS(ARG_BYTE(fd)),
1, ARG_8BITS, NINA_VALS({&size, &sock})) != 0) { 1, ARG_8BITS, NINA_VALS({&size, &sock})) != 0) {

View File

@ -518,11 +518,7 @@ static int py_nina_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_t
if (timeout_ms == UINT32_MAX) { if (timeout_ms == UINT32_MAX) {
// no timeout is given, set the socket to blocking mode. // no timeout is given, set the socket to blocking mode.
timeout_ms = 0; timeout_ms = 0;
} else if (timeout_ms == 0) { }
// non-blocking mode, set the timeout to a small number other than zero.
timeout_ms = 10;
} // otherwise, timeout is provided.
socket->timeout = timeout_ms; socket->timeout = timeout_ms;
return 0; return 0;
} }