Compensation for variation of ambient pressure or temperature