Skip to content

Conversation

tyeth
Copy link
Member

@tyeth tyeth commented Apr 30, 2025

This changes the functionality for pressure/temperature/humidity from returning NaN at key values (fixed values returned when sampling rate is None/Skip), to returning NaN if sampling is off.

Minor docstring changes too.

Tested on MetroS3 w/BME280, using simple test and advanced test with humidty test scenario (shows pressure and altitude return nan as pressure sampling is off).

Not verified that exactly 80% relative humidity can be returned (but logically ok).

@tyeth
Copy link
Member Author

tyeth commented Apr 30, 2025

Should close #114

@tyeth tyeth requested a review from Copilot April 30, 2025 13:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the behavior for sensor reading functions so that NAN is returned when sampling is disabled rather than detecting invalid ADC values, and adjusts the associated documentation.

  • Update the sampling condition checks in readTemperature, readPressure, and readHumidity to return NAN if sampling is off.
  • Modify the header comments to correctly describe humidity oversampling.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
Adafruit_BME280.h Updated the comment for osrs_h to reflect humidity oversampling correctly.
Adafruit_BME280.cpp Added early sampling mode checks in sensor reading functions to return NAN.
Files not reviewed (1)
  • library.properties: Language not supported

@tyeth tyeth changed the title Return NAN only if sampling is disabled Return NaN only if sampling is disabled Apr 30, 2025
@tyeth
Copy link
Member Author

tyeth commented Apr 30, 2025

@ladyada ready for review

@tyeth tyeth requested a review from ladyada April 30, 2025 13:19
@tyeth tyeth merged commit ef712e9 into master Apr 30, 2025
2 checks passed
@tyeth tyeth deleted the dont-return-nans-unnecessarily branch April 30, 2025 13:31
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