I'm trying to use the 2022_05_17_01_09_bsec_h2s_nonh2s_2_2_0_0.config file from the BSEC188.8.131.52 library to get the estimates for the H2S/non H2S that should be given by the BSEC_OUTPUT_GAS_ESTIMATE_1 and BSEC_OUTPUT_GAS_ESTIMATE_2 in the virtual sensors . I also requested TPHG and all the sample rates are set to SCAN.
The first thing that differs from what should be the standard way to do it is that i don't actually load the .config file (bsec_set_configuration returns a mismatch version error) but i use the bsec_serialized_configurations_selectivity.h and bsec_serialized_configurations_selectivity.c files to load the configuration since it works and gives me the OK code as a return.
Next i initialize the bme library and call the bsec update subscription.
Inside the main loop i then call the sensor control from which the returned mode is the parallel (2) and from which i take all the parameters for the oversampling and the heater duration and temperature profiles and then i set all the configurations and the op mode.
Next i check if i the trigger measuramente is 1 and if so i call the get data.
Then i check i process_data is not 0 and if so a for loop is called to initialize the input array with the data[i] values that are then passed to bsec do steps.
When checking the output parameter from bsec_do_steps() though i don't have the values for the estimates but only for TPHG.
How do i get the values for the gas estimates? Do i have to call the bsec_do_step() with different parameters with respect to the forced mode? Do i have to wait more time?
Solved! Go to Solution.
I also noticed that if i request TPHG the bietfield of process_data in bsec_bme_settings_t is 15 that is ..001111 in binary so requesting the signals for TPHG as the input. When i add the GAS_ESTIMATE_1 in the virtual sensors the bitfield becomes the equivalent of 8388623 in deciamal (something like 1000..001111 at 24 bits). Why is that 1 at the beginning? What does it mean? Does it influence the output somehow?
I strictly referred to the integration guide, while i needed to adapt the example code to my case because i am using a raspberry pi pico.
The main problem is that i don't get any values for requesting the gas estimates. I don't even get zeros. One more difference is that when loading the configuration i cannot use the .config file because i get a version mismatch error, while i can load the .h and .c file, and i don't know if this changes something (referring to the BSEC_184.108.40.206_Generic_Release_30052022\config\bsec_sel_iaq_33v_3s_4d files).
The workflow in my code is the one defined in the sequence diagram in the integration guide.
EDIT: i checked the version of the bsec loaded by the pico through bsec_get_version and it is 220.127.116.11