pololu / vl53l0x-arduino

Pololu Arduino library for VL53L0X time-of-flight distance sensor
https://www.pololu.com/product/2490
Other
345 stars 163 forks source link

Timeout overflow #35

Closed macedolfm closed 5 years ago

macedolfm commented 5 years ago

Timeout variables shall be unsigned long, so if sensor init() is called latter after MCU start up they do not overflow. This happened to me !!

uint16_t io_timeout; => unsigned long io_timeout; uint16_t timeout_start_ms; => unsigned long timeout_start_ms;

Also timeout functions signatures shall also be unsigned long:

inline void setTimeout(unsigned long timeout) inline unsigned long getTimeout(void)

kevin-pololu commented 5 years ago

This is probably a duplicate of #32. If you think it's a different problem, please reopen this issue and tell me more about your setup include what kind of Arduino you're using and what unexpected behavior you see.