The photodiode dark current calibration (PDOffset) is missing in UpdateCalData function.
UpdateCalData