alexh-name / bsec_bme680_linux

Read the BME680 sensor with the BSEC library on Linux (e.g. Raspberry Pi)
Other
87 stars 48 forks source link

Sleep method in milliseconds #4

Closed akirsch76 closed 6 years ago

akirsch76 commented 6 years ago

Hello,

thank you very much for your work but I found an error in your code.

/*

This method does not sleep at all. If the software want so sleep for 25ms for example 25/1000 is 0. And the sleep function uses seconds. You should replace sleep with usleep in microseconds and multiply with 1000. void _sleep(uint32_t t_ms) { usleep(t_ms * 1000); }

Kind regards

Alex

alexh-name commented 6 years ago

Wow thanks for pointing this out. While your suggestion would work as well I took the opportunity to make it more POSIX compliant and used nanosleep: e6e6fb0

Best, Alex

akirsch76 commented 6 years ago

There are 1000 ways to rome ;-). But usleep() is also posix conform... ;-). But posix is somehow like SQL... Nice standard and a lot of implementation differences (my regular job)...

Best regards

Alex