The star formation history of Cygnus OB2