Hello @Whandall thanks for replying,
As I pointed out in my original question, the problem remains even when using the first sketch that doesn't include the getCalibration function. Other than that, thanks for the tip, I'm going to make some changes to the code.