Just fixed. In an hour or so the latest should be available at:
Thanks, just tested and works fine.
Next tested a big application (>1800 blocks) and workd fine too.
Sorry if this is the wrong thread, but I'm also getting bogus readings from the BMP180 as reported in comment #12. For example -29363 Pa. Tested using both 1v69 and the 1v70 build from yesterday, with the same result.
Is there something I can do to work around this in the meantime, or should I wait for a fix?
I'm gonna try and fix this tonight.
I think it can be fixed with judicious use of parenthesis
Edit: Okay, yeah, I see the problem. It looks like that was written for an unsigned 32-bit integer (the code was ported from arduino), and still has workarounds for handling the large numbers.
var p = Math.round(B7 < 0x80000000 ? (B7 << 1) / B4 : (B7 / B4) << 1);
In my tests at ambient pressure, B7 is 1.6 billion or so - so when it left-shifts it, it turns into a negative number.
In at least the current ambient conditions, changing that to
var p=Math.round((B7/B4) << 1);
seems to work, but I don't think it will work at all pressures - I fear that B7 can get large enough that it could roll over to a negative number on the line before that one (since they test whether it's greater than 0x80000000, which is the point at which it would have already rolled over)
Thanks a lot! Works great, for my current ambient pressure at least. It will do the trick until the underlying problem is fixed :)
I've just pulled in @DrAzzy's changes, so hopefully this will magically be fixed the next time you upload your code.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem