BME680: bugfix save state
This commit is contained in:
parent
a0a96b36dd
commit
8267e4e3b6
@ -147,7 +147,7 @@ void updateState(void) {
|
|||||||
bool update = false;
|
bool update = false;
|
||||||
|
|
||||||
if (stateUpdateCounter == 0) {
|
if (stateUpdateCounter == 0) {
|
||||||
/* First state update when IAQ accuracy is >= 1 */
|
/* First state update when IAQ accuracy is >= 3 */
|
||||||
if (iaqSensor.iaqAccuracy >= 3) {
|
if (iaqSensor.iaqAccuracy >= 3) {
|
||||||
update = true;
|
update = true;
|
||||||
stateUpdateCounter++;
|
stateUpdateCounter++;
|
||||||
@ -161,10 +161,10 @@ void updateState(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
memcpy(bsecstate_buffer, cfg.bsecstate, BSEC_MAX_STATE_BLOB_SIZE);
|
|
||||||
cfg.bsecstate[BSEC_MAX_STATE_BLOB_SIZE + 1] = BSEC_MAX_STATE_BLOB_SIZE;
|
|
||||||
iaqSensor.getState(bsecstate_buffer);
|
iaqSensor.getState(bsecstate_buffer);
|
||||||
checkIaqSensorStatus();
|
checkIaqSensorStatus();
|
||||||
|
memcpy(cfg.bsecstate, bsecstate_buffer, BSEC_MAX_STATE_BLOB_SIZE);
|
||||||
|
cfg.bsecstate[BSEC_MAX_STATE_BLOB_SIZE + 1] = BSEC_MAX_STATE_BLOB_SIZE;
|
||||||
ESP_LOGI(TAG, "saving BSEC state to NVRAM");
|
ESP_LOGI(TAG, "saving BSEC state to NVRAM");
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user