How to use 2 I2C and UART simultaneously in ESP32?

I did not read how the library works, but it seems that it needs to be able to keep track of the heartbeat. So I assume that it needs to sample many times per second.

Perhaps the 'encode()' can be called many times per second to keep track of the heartbeat, and perhaps the 'isValid()' with the calculation can be called once in a while.

But I'm just guessing here, you have to read how the library works.