Hi,
I've hit an issue I'm unable to solve whereby after deep sleeping my ESP32 and saving and loading state with RTC memory or after a manual reset using EEPROM as per the Arduino example basic_config_state.ino, my callback is not being invoked until I execute Bsec2::run() for a second time after deep sleeping. This means I have to I have to wait either 3s or 300s depending on BSEC_SAMPLE_RATE_* at full power or at least light sleep before getting a reading and returning to deep sleep.
It seems after deep sleeping even when loading in the previous state from EEPROM the next call time remains zero. Please see the image I've attached for detailed logging of this happening in my application.
All subsequent calls are fine and outputs look correct. Thus I can only assume there is a bug in the bsec_set_state() function that is not initialising the libraries state fully until a second call is made to Bsec2::run().
Furthermore, to actually get deep sleep working I've had to add back in missing functionality to the API from BSEC 1.0:
/**
* @brief Constructor
*/
Bsec::Bsec()
{
nextCall = 0;
...
That provided public access to when the "nextCall" is available. This is missing in both the downloadable and the github version of BSEC 2.0 library so I added a getter for it (in the downloaded version I'm using):
/**
* @brief Function to return the time when the algorithm has to be called next in ms
*/
int64_t Bsec::getNextTime(void)
{
return _bsec_bme_settings.next_call / INT64_C(1000000);
}
Any help with this issue would be greatly appreciated.
Thanks in advance.