jacobqvist / scd30

MIT License
0 stars 3 forks source link

Device not getting ready - possibly because continuous measurement not started #2

Closed florianluediger closed 1 year ago

florianluediger commented 2 years ago

Hey Jacob!

Thanks for your library, this should save me a lot of work trying to work with the SCD30 sensor.

However, I can't really get it working. When trying the code from examples/room.toit I get an error saying "Device is not getting ready.". I assume this is because continuous measurement is not enabled yet on my sensor. (See this documentation in chapter 1.3.1)

I have tried to enable it manually by executing device.write #[0x00,0x10] but that didn't work.

Do you have any idea how I can get the sensor to work?

Thanks a lot already!

jacobqvist commented 2 years ago

Hi @florianluediger!

Thanks for reaching out. I haven't looked at the driver since I created the Christmas ball project last Christmas. I can see if it is possible for me to get it to work with the newest Toit firmware version? The Christmas ball is placed somewhere else, so I will have to see if I can fetch it to take a look at it. @floitsch do you still have the Christmas ball laying around?

Did you do some debugging and test if it was possible to get it to work in an Arduino setting? Remember that I had some wirering problems at first :)

floitsch commented 2 years ago

I just left for vacation, but maybe @erikcorry can have a look. If not, I will try to investigate in about two weeks.

jacobqvist commented 2 years ago

Thanks @floitsch! Enjoy your vacation 👍 🥇

florianluediger commented 2 years ago

Alight, here are some updates:

I have flashed some example code using this Arduino library which worked and produced some sensor readings.

This also seemed to be enough to kick the SCD30 into continuous measurement mode which means that now the Toit code also works. The sensor will even work after power cycling it. I don't really know why the sensor comes preconfigured with continuous measurement off.

Currently this means that for using the SCD30 with this Toit library, I would always have to flash some Arduino code to start the continuous measurement and only then I can use Toit to control it. I couldn't figure out what the Arduino library does differently then my experiments with Toit but maybe you guys can figure that out.

erikcorry commented 2 years ago

Hi

I found our sensor in the moving boxes, and managed to reproduce your problem.

I've made a pull request at https://github.com/qvisten999/scd30/pull/5

@qvisten999, if you prefer we could just move the package to the official Toitlang github so you don't have to bother with this sort of thing going forwards.

jacobqvist commented 2 years ago

Hi @erikcorry

Yeah, sounds like a plan :)

erikcorry commented 2 years ago

Turns out there's no great way to "move" a package, so all I could do is create a new one.

For now I've sent you another PR at #6

jacobqvist commented 2 years ago

Okay @erikcorry. Thought it was possible to fork the repo, remove my package from tpkg and then create a new package from the forked version.

erikcorry commented 2 years ago

@qvisten999 Yes, but I think that means everyone who used the old one can't build any more without fixing it.

erikcorry commented 2 years ago

I released v1.1.0 in the package registry, which should fix this issue.

(I accidentally released a v1.1.0 under a slightly different name first. If you got that before I removed it from the registry you may need to do toit.pkg uninstall scd30 toit.pkg install scd30 to get the right version. Adjust the command depending on which version of Toit you are using)

florianluediger commented 2 years ago

I have already tested your changes in the PR that you have created so I can confirm that this works. If you want, you can close the issue. Thanks for putting in the work to fix this!