Light adaptation for visual pattern recognition in flies