Added calibration logic to main.py