Add diagnostics support and simplify the calibration code to have smaller rounds.