Adjusted light sensor detection logic