cleaning up dimming logic

Fixes an issue where lighting would report the wrong level when being dimmed in certain conditions.