SGP30 getBaseline and setBaseline assistance

I am using the SparkFun Library (Arduino with ESP32) for the SGP30 and I want to use getBaseline and setBaseline, but I can’t find any example of doing it in the examples, or if I Google it online. I can see the getBaseline and setBaseline in the Library ccp and h files, but I not sure how to do it properly. I want to get the baseline after 12 hours, print it, and then set it. If I missed some example code somewhere here on the forum, or the SparkFun website, please just point me to it, or if you could provide me with just an example, I can take it from there…

OK, I think I figured this out… I added a couple of chunks of code that should provide most of the info… STILL DEBUGGING though, so I may have to add an update later…

Getting the baseline…

void doGetBaseline()

{

SGP.getBaseline();

uint16_t baselineCO2 = SGP.baselineCO2;

uint16_t baselineTVOC = SGP.baselineTVOC;

Serial.print(" BaseLineCO2: 0x");

Serial.print(baselineCO2, HEX);

Serial.print(" BaseLineTVOC: 0x");

Serial.println(baselineTVOC, HEX);

}

Storing it to EEPROM…

int address = 0;

EEPROM.put(address, baselineCO2);

address += sizeof(uint16_t);

EEPROM.put(address, baselineTVOC);

Serial.println(" Store SGP30 Baselines to EEPROM");

Setting the stored baseline from EEPROM back in setup()

int address = 0;

EEPROM.get(address, restoredECO2Baseline);

address += sizeof(uint16_t);

EEPROM.get(address, restoredTVOCBaseline);

SGP.setBaseline(restoredECO2Baseline, restoredTVOCBaseline);

Serial.println(“Setting BaseLine to previously stored values”);