Measuring water level inside a drinking glass
A peristaltic pump delivers a set volume per revolution so relate that volume to the size of cup and have a select button : size1 or size 2. Count the revolutions and you deliver the correct volume .