jled icon indicating copy to clipboard operation
jled copied to clipboard

Allow to trigger callback after an effect is finished

Open jandelgado opened this issue 4 years ago • 1 comments

#82 inspired this MR: Added a new UpdateAndFinally method that will update the effect like Update but will trigger the provided callback when the effect is finished. This allows e.g. reconfiguration of an effect.

Example:

#include <jled.h>

auto breathe = JLed(2).Breathe(500);

void setup() { }

void loop()  {
  breathe.UpdateAndFinally(
          [] (JLed& led, void*) {
            led.Breathe(random(50,5000));
            led.Reset();
    }
  );
}

jandelgado avatar Dec 11 '21 20:12 jandelgado

Coverage Status

Coverage increased (+0.08%) to 97.03% when pulling 12684d8d64f460cf0187314053b6ff2dd481129a on add_update_and_finally into 1971249379c6d9038f42c14c36d1ace589e1960b on master.

coveralls avatar Dec 11 '21 20:12 coveralls