Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

softReset #19

Closed
bytesontherocks opened this issue Sep 23, 2020 · 2 comments
Closed

softReset #19

bytesontherocks opened this issue Sep 23, 2020 · 2 comments

Comments

@bytesontherocks
Copy link

bytesontherocks commented Sep 23, 2020

Hello,

I'm not using your library but having a look at your code I noticed that Adafruit_SGP30::softReset has the following issue:

The reset command shouldn't be{ i2c_addr, 0x00, 0x06} but {0x00, 0x06}

I can see 2 quick ways to fix it:

  1. Modify readWordFromCommand to take the device address as a parameter with SGP30_I2CADDR_DEFAULT as default and pass 0 when softReset is called

or

  1. Do
    {
    _i2c->beginTransmission(0x00);
    _i2c->write(0x06);
    _i2c->endTransmission();
    }
    with the magical numbers in macros/ constexpr?

What do you think?

@bytesontherocks
Copy link
Author

bytesontherocks commented Sep 23, 2020

@PepperBurst, I see that you created a pull request for the Soft Reset. What do think about my comment?

@PepperBurst
Copy link
Contributor

@bytesontherocks Hi I'm sorry for overlooking this. Looking back at my previous code which is

#ifdef ENABLE_DEBUG
	Serial.println(F("Soft Reset"));
#endif
	Wire.beginTransmission(SOFT_RESET_ADDR);
	Wire.write(SOFT_RESET_CMD);
	Wire.endTransmission();
#ifdef ENABLE_DEBUG
	Serial.println(F("Resetting..."));
#endif

you are very much right in that regard. Apologies, this is my bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants