Skip to content

Commit

Permalink
minimize value after gamme correction to 1 to prevent LED off during …
Browse files Browse the repository at this point in the history
…dimming
  • Loading branch information
arjanmels committed Nov 17, 2018
1 parent 8979b75 commit e1f2e98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/espurna/light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ unsigned int _toPWM(unsigned long value, bool gamma, bool reverse) {
} else if (value == LIGHT_MAX_VALUE) {
value = LIGHT_LIMIT_PWM;
} else if (gamma) {
value = pow(((float)value/LIGHT_MAX_VALUE),_light_gamma)*LIGHT_LIMIT_PWM;
value = std::max(1UL, (unsigned long)pow(((float)value/LIGHT_MAX_VALUE),_light_gamma)*LIGHT_LIMIT_PWM);
} else {
if (LIGHT_MAX_VALUE != LIGHT_LIMIT_PWM) value = map(value, 0, LIGHT_MAX_VALUE, 0, LIGHT_LIMIT_PWM);
}
Expand Down

0 comments on commit e1f2e98

Please sign in to comment.