Calibration: code refactoring

* Part of the function update()
  was separated and moved to a new
  function: discover_regions()