kike-canaries / canairio_sensorlib

Particle sensor manager for multiple sensors: Honeywell, Plantower, Panasonic, Sensirion, etc. This is sensors layer of CanAirIO project too.
https://canair.io/docs/sensorlib.html
GNU General Public License v3.0
37 stars 12 forks source link

Issue with Sensors::setTempOffset() for SCD30 #192

Closed melkati closed 7 months ago

melkati commented 7 months ago

I'm looking at a bug reported by a user (https://github.com/melkati/CO2-Gadget/issues/155) and after a while of looking it seems that the error is in the way sensorlib handles the setTempOffset(tempOffset) function.

It seems that in the case of the SCD30 it passes tempOffset directly to the Adafruit library but the library expects the value of tempOffset in hundredths of a degree (1015 => 10.15 degrees C).

Sensorlib setTempOffset(tempOffset) seems to want to work in degrees and not in hundredths, because for example the SCD40 does get it correctly.

I think this is not the way sensorlib is expected to work, in order to abstract the sensors,

I recently switched from the old version of sensorlib to the new one and I don't remember this happening before (and I swear I used setTempOffset() often myself).

https://github.com/kike-canaries/canairio_sensorlib/blob/681d542d56c7eb15989e72c6eeafc8d4e9bd8fbe/src/Sensors.cpp#L386-L391

melkati commented 7 months ago

I sent a binary to the user for testing with the fix at #196. Still waiting for an answer https://github.com/melkati/CO2-Gadget/issues/155.

melkati commented 7 months ago

The user reported it's working fine. Closing the issue. Thank you.