I mean the state-save and state_load in the bsec_iot_example.ino. And according to your answer, "all functions in bsec_interface.h are included in library", I think the state-save and state_load should be writen by myself.
The function state_load in the bsec_iot_example.ino, it returns the "number of bytes copied to state_buffer", but I wonder how it knows how many bytes have been copied to state_buffer? In other words, if there's no state data in my non-volatile memory, there's only 000000..... in my non-volatile memory, how can it knows this isn't a state data?
Can you understand me? I think maybe I didn't explain clearly enough..
Oh, I see. Now I'm clear what you are talking about.
Yes, state load and state save are optional functions to store status in NVM area like EEPROM.
We have some example with EEPROM for BSEC Library based on Arduino.
Hope it helps you.
Thank you for your code! I solved the problem.
So the sensor works normally now and I did some test with it. I find a problem which was mentionned in this forum, but it seems not be solved.
The present situation:
BME starts with the state saved when IAQ accuracy=3, and at the beginning, IAQ accuracy=0. After nearly 5 min, IAQ accuracy=3. Then IAQ accuracy falls to 2 and it doesn't turn to 3 during 30min.
The same problem mentionned here: in 6) https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-state-save-state-load-problem/td-...
I think this problem isn't solved because I use the version 184.108.40.206.
In this case, what should I do? Erase the saved state in EEPROM and calibrate it again? There's no another solution, is that?
In our example code case, our example code update status once IAQ accuracy reaches to 3 and update its status regularly after that.
At the first time, around 30 mins for IAQ accuracy is acceptable.