jandelgado / jled

Non-blocking LED controlling library for Arduino and friends.
MIT License
324 stars 51 forks source link

Update() not returning false for On() #126

Closed danyhm closed 8 months ago

danyhm commented 8 months ago

Hello,

if the following code:

auto ledOn = JLed(LED).On().DelayAfter(500);

loop()
{
if(!ledOn.update())
{
// code here
}
}

Update() is not returning false. is this by design for solid states ?

jandelgado commented 8 months ago

Yes, that's by design an also documented, see: https://github.com/jandelgado/jled#static-on-and-off

Technically, Set, On and Off are effects with a default period of 1ms, that set the brightness to a constant value. Specifying a different period has an effect on when the Update() method will be done updating the effect and return false (like for any other effects). This is important when for example in a JLedSequence the LED should stay on for a given amount of time.

In your example Update will return true for (1+500)ms == 501ms

danyhm commented 8 months ago

Well it's always returning true. So i take it this should not happen?

jandelgado commented 8 months ago

Could you please provide a complete example so I can try to reproduce the problem? Which version of JLed are you using?

danyhm commented 8 months ago

i'm sorry. you were right. it does return false. my bad