simondlevy / VL53L5CX

Arduino library for ST Microelectronics VL53L5CX multizone Time-of-Flight ranging sensor
MIT License
28 stars 13 forks source link

Last resolution.ino doesn't work on a Teensy4.0 ? #10

Closed louismarieb closed 1 year ago

louismarieb commented 3 years ago

Hi,

First of all , thanks a lot for your work ! I am testing your dev resolution.ino (update last night) for a resolution 8x8 on a Teensy4.0 and it doesn't work. Nothing in the serial and the function vl53l5cx_check_data_ready(&_dev, &is_ready) in the sensor.isReady() line block.

I have last version of all framework and library and i use PlatformIO (but i don't think it is the problem). When i test, *p_ready is never to 1, it keep 0, so function vl53l5cx_check_data_ready engage an infinite loop because the following condition in never true : if((p_dev->temp_buffer[0] != p_dev->streamcount) && (p_dev->temp_buffer[0] != (uint8_t)255) && (p_dev->temp_buffer[1] == (uint8_t)0x5) && ((p_dev->temp_buffer[2] & (uint8_t)0x5) == (uint8_t)0x5) && ((p_dev->temp_buffer[3] & (uint8_t)0x10) ==(uint8_t)0x10) )

More precisely those conditions is never true : p_dev->temp_buffer[0] != p_dev->streamcount p_dev->temp_buffer[0] != (uint8_t)255 p_dev->temp_buffer[3] & (uint8_t)0x10) == (uint8_t)0x10

Is there a buffer trouble ?

simondlevy commented 3 years ago

Thanks for the inquiry. I believe I've fixed the issue since you posted, because I just tried out resolution.ino with 8x8 on my Teensy4.0 and it works fine. Please pull the repo, try again, and if you get expected results, free free to close the issue.