Merge pull request #7242 from s-ol/i2ctarget_fix

Don't block in I2CTarget.request(-1)
This commit is contained in:
Jeff Epler 2022-11-20 13:16:22 -06:00 committed by GitHub
commit 63e18cdfe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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; bool forever = false;
uint64_t timeout_end = 0; uint64_t timeout_end = 0;
if (timeout_ms <= 0) { if (timeout_ms == 0) {
forever = true; forever = true;
} else if (timeout_ms > 0) { } else if (timeout_ms > 0) {
timeout_end = common_hal_time_monotonic_ms() + timeout_ms; timeout_end = common_hal_time_monotonic_ms() + timeout_ms;