Closed terrillmoore closed 4 years ago
It turns out ... that the Si1133 does not make progress if it's being polled aggressively. References on the web suggest a minimum 5 ms delay between polls in order for it to make progress. It's also suggested that we should delay 200 ms before starting to poll. So this suggested fix need to be updated to cater to this as well.
Closed by #231
If you set up multiple concurrent operations with the Si1133, and use it in asynchronous mode, you will find that
Catena_Si1133::isOneTimeReady()
will never returntrue
.The problem is here at line 348:
https://github.com/mcci-catena/Catena-Arduino-Platform/blob/899e5f5fde13a5afcfae0ca4b8ef6f98fbbea0ea/src/lib/Catena_Si1133.cpp#L345-L348
If there are multiple channels enabled with different measurement parameters, the IRQ flags may not all get set at once. And these bits are clear-on-read (see section 5.4.11 of the datasheet). So the channel enable mask will never match the IRQ flags, unless you wait long enough that all have completed before you try to read.
The solution is to keep a mask of "completed" bits observed from
IRQ_STATUS
in the main object. We already have a flag (m_fOneTime
) so it's trivial to also add a mask that gets cleared at start and keeps getting posted until all have completed.