01-22-2024 06:48 AM
I'm working on getting the BSEC library working with Rust, as it has support for linking to C libraries. I have the system almost working perfectly, but I have run into one problem. The compensated temperature and humidity values are very wrong. I should be reading around 40% humidity, and around 22 degrees C, but the outputs from the library are reporting 100% humidity and -3.4 degrees C.
I've been able to trace the issue down to my call of `bsec_do_steps` in the library. The data I pass into it all looks accurate, but the output data has the issues as shown in the previous image.
Is there any information that could suggest what I am doing wrong with passing the information into this function? Maybe I misconfigured something somehwhere else in the code.
I understand that actual help with rust is probably outside of the normal realm of support for this forum, but was hoping for some more general pointer on where I could look for that may be causing this issue.
Solved! Go to Solution.
01-22-2024 07:25 AM
Hi marsfan,
Could we know which sensor(BME680, BME688) and BSEC version you used?
And which official BSEC example code you refer to?
01-22-2024 08:11 AM - edited 01-22-2024 08:21 AM
Sorry, I should have provided that. I'm using the BME688 with BSEC version 2.4.0.0. I'm not sure what you mean by BSEC example code. I'm not using any existing example code, as I am integrating the library with Rust.
The code I am working with is pretty much a direct port of some work I was doing a couple of months ago in C++ (which does not have this issue), but I wanted to try using Rust instead. The source code for my rust project is not currently a public repository on github, but I was planning on making it public soon. I can make it public now if that helps.
01-25-2024 05:37 AM - edited 01-25-2024 06:43 AM
@BSTRobinI have made the code that is having issues open-source. It is available here: https://github.com/marsfan/envionment_monitor_rust
The bindings for the BSEC library are auto-generated from the BSEC header files and then I hook into them in the file environment_monitor_rust/src/bsec/mod.rs
01-25-2024 07:15 AM
I figured it out myself. I had mixed up the use of "Ambient Temperature" in the BME68x Driver with the "temp_offset" used in the BSEC library, and was passing a value of 25 into the entire BSEC library, which was being applied as an offset to all of the temperature readings.