Working (tested) routine for casting sorts and calibrating the machine