There's a minor bug in
and while it's not affecting my projects, it generates a warning when I compile with warnings enabled, which is annoying.
Around line 111 we find:
uint16_t m; m = measureRaw(); if (m == -1)
And the if is never going to be true, because in C++ the (32 bit integer value) -1 is going to be promoted to 0xffffffffU which is never going to compare equal to a 16 bit value. Basically, the error check is never going to work. And if the error does happen, the oversample conversion could then return a surprise value that looks like success.
g++ can see the problem and warns about it, which tells me the library was provided without anyone checking warnings.
And while it's not a bug and more of a style issue, it would be nice if the library would stop returning -1 as an error, since it's using unsigned values and it's going to lead other people to make mistakes like the one at 111. 0xffffU would be less confusing, as that's what's actually going to happen anyway.