Skip to content

Commit

Permalink
Fix callback sequence (#153)
Browse files Browse the repository at this point in the history
Save-/restore callbacks need to be defined before knx.readMemory() to ensure the restore callback is called.
  • Loading branch information
Sonnengruesser committed Dec 13, 2021
1 parent 616599c commit 87edd3d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/knx-bme680/knx-bme680.ino
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ void setup(void)
wifiManager.autoConnect("knx-bme680");
#endif

// set save and restore callbacks
knx.setSaveCallback(saveBme680State);
knx.setRestoreCallback(loadBme680State);

// read adress table, association table, groupobject table and parameters from eeprom
knx.readMemory();

// register callback for reset GO
if(knx.configured())
goTriggerSample.callback(triggerCallback);


// Configure Wire pins before this call if needed.
Wire.begin();
// depends on sensor board. Try BME680_I2C_ADDR_PRIMARY if it doen't work.
Expand All @@ -87,9 +90,6 @@ void setup(void)
BSEC_OUTPUT_GAS_PERCENTAGE
};

knx.setSaveCallback(saveBme680State);
knx.setRestoreCallback(loadBme680State);

if (knx.configured())
{
cyclSend = knx.paramInt(0);
Expand Down

0 comments on commit 87edd3d

Please sign in to comment.