Skip to content

Add ability to specify the pressure offset at initialization#20

Open
patrickxia wants to merge 1 commit into
adafruit:masterfrom
patrickxia:master
Open

Add ability to specify the pressure offset at initialization#20
patrickxia wants to merge 1 commit into
adafruit:masterfrom
patrickxia:master

Conversation

@patrickxia

@patrickxia patrickxia commented Sep 30, 2023

Copy link
Copy Markdown

Fixes #19.

The SCD30 only allows you to do this at startup, but the pressure offset is hard-coded in the library. Add an optional pressure offset to Adafruit_SCD30::begin.

This is an API-breaking change, since objects that override Adafruit_SCD30::_init will have the wrong signature. This is done intentionally; any objects that override _init need to take into account the new argument to Adafruit_SCD30::begin.

Also get rid of the unused decl for getAmbiendPressure.

Fixes adafruit#19.

The SCD30 only allows you to do this at startup, but the pressure offset
is hard-coded in the library. Add an optional pressure offset to
Adafruit_SCD30::begin.

This is an API-breaking change, since objects that override
Adafruit_SCD30::_init will have the wrong signature. This is done
intentionally; any objects that override _init need to take into account
the new argument to Adafruit_SCD30::begin.

Also get rid of the unused decl for getAmbiendPressure.
@caternuson

Copy link
Copy Markdown
Contributor

The ambient pressure can be specified as a parameter to startContinuousMeasurement(). The _init() method calls it without any specification just to get things started. If you want to actually specify an ambient pressure, can make a call to startContinuousMeasurement() after the call to begin().

@patrickxia

patrickxia commented Oct 2, 2023

Copy link
Copy Markdown
Author

Sure, but that means that whenever you init you explicitly write a zero into the device register and the scd30 will start recording data with the default pressure offset. This is fine because the start command zeroes out the read buffer, so as long as you don't read between begin and the reset, your data won't be bad, but the general approach seems a bit redundant.

But for API stability I guess the proposed approach works in the status quo. It might be nice to explicitly have as a comment that startContinuousMeasurement (a) clears out the read buffer, and (b) can be called while measurements are already started.

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.

getAmbientPressureOffset without a setAmbientPressureOffset

2 participants