Update I2CTarget.c

Correction of the timeout value range needed to set the timeout to 'forever'.
The line 162 checks timeout for a value of 0 while the function definition defaults timeout to -1. In the current version of the code timeout is only checked for a value of 0 or in the 'else if' part for a value of > 0. So, values of <0 will not be taken in to account.  That is the reason of my modification.
This commit is contained in:
Paulus H.J. Schulinck 2022-10-03 13:09:40 +01:00
parent 041766351c
commit 89e0601a39

View File

@ -159,7 +159,7 @@ STATIC mp_obj_t i2ctarget_i2c_target_request(size_t n_args, const mp_obj_t *pos_
bool forever = false;
uint64_t timeout_end = 0;
if (timeout_ms == 0) {
if (timeout_ms <= 0) {
forever = true;
} else if (timeout_ms > 0) {
timeout_end = common_hal_time_monotonic_ms() + timeout_ms;