seanlano/WiLED

LEDOutput.cpp: Unclear why lockout is only checked on last transition

HowManyOliversAreThere opened this issue · 1 comments

In both the LEDOutput::setDimStepUp() and LEDOutput::setDimStepDown() functions, a lockout is always set if the __state_dim_level_goal is changing, however it is only checked if it is not active on the last transition. This results in an unintuitive functionality where a user can rapidly cycle to the second last state, but is then gated before making the final transition.

If this is intended functionality, it should be commented to justify why this is the case, as it is unclear from an outside perspective. If this is not the intended functionality, this should be resolved.

Well spotted - in fact that is exactly the purpose, to be able to quickly jump to either the lowest on state or the second-highest on state, but then having to wait for a short delay before either switching off or going to full on.
The idea is that if:
a) Reducing brightness: the user would not want to turn the output off altogether - or they would have just pressed the dial instead to turn the output off immediately.
b) Increasing brightness: this is a little more vague, but the hardware that I have (of which a schematic will be uploaded soon) is intended to run usually at a lower than full output. The full output is very bright, whereas one step down from that is an ideal brightness.

You are correct though, this needs to be better documented. I will also include a compiler statement that would allow this to be disabled (in one or both directions) if desired by other developers.