adafruit / Adafruit_BMP280_Library

Arduino Library for BMP280 sensors
255 stars 186 forks source link

Fix issue #67 printSensorDetails() issue #68

Closed hpsaturn closed 2 years ago

hpsaturn commented 2 years ago

Overview

This pull request fix the issue #67

TODO

Output:

22:31:17.229 > == CanAirIO Setup ==
22:31:17.233 > 
22:31:17.237 > -->[CONF] dM5StickCPlus initializing...OK
22:31:18.157 > -->[TGUI] display config ready.
22:31:18.181 > -->[TGUI] displayed welcome screen
22:31:18.181 > -->[HEAP] GUI  bytes used        : 0476b/230Kb
22:31:18.185 > -->[INFO] ESP32MAC:      94:B9:7E:8C:83:CA
22:31:18.189 > -->[INFO] Hostname:      CanAirIO3CA
22:31:18.193 > -->[INFO] Revision:      r884
22:31:18.193 > -->[INFO] Firmware:      0.5.1
22:31:18.197 > -->[INFO] Flavor  :      M5STICKCPLUS
22:31:18.201 > -->[INFO] Target  :      dev
22:31:18.201 > -->[INFO] Detecting sensors:
22:31:18.205 > -->[INFO] Sensorslib version     : 0.4.4
22:31:18.209 > -->[INFO] enable sensor GPIO     : 27
22:31:18.213 > -->[HEAP] GPIO bytes used        : 0000b/230Kb
22:31:18.213 > -->[INFO] config UART sensor     : 0
22:31:18.309 > -->[SLIB] new sample time        : 1
22:31:18.309 > -->[SLIB] Sensorlib version      : 0.4.4
22:31:18.313 > -->[SLIB] Sensorlib revision     : 342
22:31:18.317 > -->[SLIB] Sensorlib debug mode   : enable
22:31:18.321 > -->[SLIB] temperature offset     : 5.90
22:31:18.325 > -->[SLIB] altitude offset        : 0.00
22:31:18.325 > -->[SLIB] only i2c sensors       : 1
22:31:18.329 > -->[SLIB] try to enable sensor   : I2C SPS30.. 
22:31:18.333 > [E][SLIB] SPS30 could not probe. 
22:31:18.337 > -->[SLIB] try to enable sensor   : PANASONIC GCJA5.. 
22:31:18.341 > -->[SLIB] I2C sensor detected    : SN-GCJA5
22:31:18.345 > -->[SLIB] GCJA5 FAN status       : 0
22:31:18.349 > -->[SLIB] try to enable sensor   : AM2320.. 
22:31:18.353 > -->[SLIB] try to enable sensor   : SHT31.. 
22:31:18.357 > -->[SLIB] I2C sensor detected    : SHT31
22:31:18.361 > -->[SLIB] try to enable sensor   : BME280.. 
22:31:18.365 > -->[SLIB] try to enable sensor   : BMP280.. 
22:31:18.461 > -->[SLIB] I2C sensor detected    : BMP280
22:31:18.465 > ------------------------------------
22:31:18.469 > Sensor:       BMP280
22:31:18.469 > Type:         Ambient Temp (C)
22:31:18.473 > Driver Ver:   1
22:31:18.473 > Unique ID:    280
22:31:18.477 > Min Value:    -40.00
22:31:18.477 > Max Value:    85.00
22:31:18.481 > Resolution:   0.01
22:31:18.481 > ------------------------------------
22:31:18.485 > 
22:31:18.485 > ------------------------------------
22:31:18.489 > Sensor:       BMP280
22:31:18.489 > Type:         Pressure (hPa)
22:31:18.493 > Driver Ver:   1
22:31:18.493 > Unique ID:    0
22:31:18.497 > Min Value:    300.00
22:31:18.497 > Max Value:    1100.00
22:31:18.501 > Resolution:   0.01
22:31:18.501 > ------------------------------------
22:31:18.505 > 
ladyada commented 2 years ago

please change to test if the pointers are not NULL first

hpsaturn commented 2 years ago

Ok, I added a validation before.

caternuson commented 2 years ago

Check should be for NOT null?

hpsaturn commented 2 years ago

Nop, I know that this weird, but if I put it, a not null validation we have the issue again.

hpsaturn commented 2 years ago

Let me do some test more with other board

hpsaturn commented 2 years ago

I added more details about the issue, here and I confirm that the current code in the PR is the right fix.