pi3g / bme68x-python-library

Python 3 Library for BME688 and BME680 (Bosch Sensortec sensors), supports Bosch BSEC
MIT License
47 stars 19 forks source link

bsec_set_sample_rate: Invalid argument #4

Closed Andreapoi13 closed 2 years ago

Andreapoi13 commented 3 years ago

I started working on a bme688 sensor using the "bme68x" library with BSEC. When I initialize the sensor in Thonny, using "sens=bme68x.BME68X(0x76,1)", i get this:

INITIALIZED BME68X VARIANT=BME688 INITIALIZED BSEC BSEC VERSION 2.0.6.1 set BSEC config: Success bsec_set_sample_rate: Invalid argument bsec_rslt=10

Then it start giving me data from "sens.get_bsec_data()", but all gas data have 0 accuracy.

puresilk commented 3 years ago

BSEC needs to run a while to improve the accuracy - please refer to the datasheet / BSEC documentation.

Andreapoi13 commented 3 years ago

Yes, I understood that (I have already read the BSEC documentation). But how I set sensor parametres, to avoid this error "bsec_set_sample_rate: Invalid argument"?

puresilk commented 3 years ago

@NathanBusler can you please comment on this? Thank you

Andreapoi13 commented 3 years ago

I'm working on a Raspberry Pi 4

NathanBusler commented 3 years ago

rslt = 10 refers to BSEC_W_SU_UNKNOWNOUTPUTGATE = 10 in bsec_datatypes.h "Output (virtual) sensor id passed to bsec_update_subscription() is not in the valid range; e.g., n_requested_virtual_sensors > actual number of output (virtual) sensors requested"

So there seems to be a problem with our internal bsec_set_sample_rate function in (internal_functions.c). For now, changing the macro

define BME688_NUM_OUTPUTS 18

in internal_functions.c to

define BME688_NUM_OUTPUTS 14

should resolve this issue

Note that this requires to recompile and reinstall the extension. This bug will be fixed in a later version.

Andreapoi13 commented 3 years ago

Thanks, I'll try it later this day.