Closed helgibbons closed 2 years ago
Looks like it's creating a new instance of the internal object every time it's initialized. It sets an "initialized" var, but never does anything with it:
I'm guessing... or at least hoping, because most of the code involved is internal to Sensirion's driver... that this is what's going wrong.
Okay I'm wrong- the sensor itself is getting into a bad state that the Pico doesn't like.
Removing breakout_scd41.start()
before running the code again fixes the problem, so it seems that calling this twice is... bad... somehow. And, indeed, calling it twice causes an immediate lockup.
Thanks! Yep - doing a breakout_scd41.stop()
before I breakout_scd41.start()
seems to sort things!
You're a step ahead of me :laughing: I'm baking that into the library now, along with a reinit for good measure.
Looks like that did the trick- try the CI build from this PR: https://github.com/pimoroni/pimoroni-pico/pull/340
Works great, ta!
MicroPython code using SCD41 seems to run fine once but pressing stop crashes the RP2040 and requires a USB unplug/replug before the sensor will read again.
I can replicate this on a Plasma 2040 and a Badger 2040 by attempting to run the basic example multiple times.