I kept Pin3 floating all the time since it is internally pull up by a resistor to 5V. During calibration, pin 3 is grounded momentarily using a switch. To avoid debounce on the pin, the variable AdjOffsetFlag is allow set only if the variable is false.