Skip to content

Conversation

phooey
Copy link
Contributor

@phooey phooey commented Oct 22, 2020

As explained in this comment the set_baseline method of the SGP30 class has the wrong parameter order, and is also making an incorrect call to self.command.

In this pull request these issues are fixed and the set_baseline method can now be used to correctly set a new baseline.

With the following example it now works as expected with this change:

from sgp30 import SGP30
sgp30 = SGP30()

result = sgp30.get_baseline()
print("{:02x} {:02x}".format(result.equivalent_co2, result.total_voc))
sgp30.set_baseline(result.equivalent_co2, result.total_voc)
result = sgp30.get_baseline()
print("{:02x} {:02x}".format(result.equivalent_co2, result.total_voc))

=>

90d7 936b
90d7 936b

@phooey phooey changed the title Fix set_baseline function Fix set_baseline method in class SGP30 Oct 22, 2020
@Gadgetoid Gadgetoid merged commit e96d952 into pimoroni:master Oct 28, 2020
@Gadgetoid
Copy link
Member

Thanks for doing the legwork here and PR'ing a fix, much appreciated!

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

Successfully merging this pull request may close these issues.

2 participants