Make sure that we don't output value less than 0. This was causing lights to stay on.

This commit is contained in:
Robert Marshall 2018-11-29 22:17:32 +00:00
parent 11c37b7180
commit 2c343241a6

View file

@ -61,6 +61,8 @@ void Lighting::updateRGB(int now) {
void Lighting::updateWhite(){ void Lighting::updateWhite(){
float brightness = (_heatIndex - 0.5) / 0.5; float brightness = (_heatIndex - 0.5) / 0.5;
if (brightness<0)
brightness = 0;
analogWrite(_whitePin, 1024 * brightness); analogWrite(_whitePin, 1024 * brightness);
} }