Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeat() and DelayAfter() on the same effect in a sequence #122

Closed
mattbk opened this issue Sep 9, 2023 · 4 comments
Closed

Repeat() and DelayAfter() on the same effect in a sequence #122

mattbk opened this issue Sep 9, 2023 · 4 comments
Labels

Comments

@mattbk
Copy link

mattbk commented Sep 9, 2023

When I run code like this, I would expect the first effect to repeat three times with a delay of three seconds after each time. But the first effect runs once and then it moves on to the next effect. Am I missing something?

It looks like Repeat() alone works as expected but DelayAfter() alone does not.

Modified from https://github.com/jandelgado/jled/blob/master/examples/sequence/sequence.ino.

#include <jled.h>

constexpr auto LED_PIN = 3;

JLed leds[] = {
    JLed(LED_PIN).Breathe(2000).Repeat(3).DelayAfter(1000),
    JLed(LED_PIN).Blink(750, 250).Repeat(3),
    JLed(LED_PIN).FadeOff(1000).Repeat(3),
    JLed(LED_PIN).Blink(500, 500).Repeat(3),
    JLed(LED_PIN).FadeOn(1000).Repeat(3),
    JLed(LED_PIN).Off(5000)
};

JLedSequence sequence(JLedSequence::eMode::SEQUENCE, leds);

void setup() { }

void loop() {
    sequence.Update();
    delay(1);
}

Thanks a bunch for the Morse example, I'm using it for exactly that purpose (to key a radio). The use case is that I want to repeat a Morse message n times, then wait a number of seconds. But without DelayAfter() on the message, the final dit and the first dah run together.

@mattbk mattbk changed the title Repeat() and DelayAfter() together in a sequence Repeat() and DelayAfter() on the same effect in a sequence Sep 9, 2023
@mattbk
Copy link
Author

mattbk commented Sep 9, 2023

I realized that for my use case, I can add an extra space (" ") at the end of the MorseEffect message, and the messages won't run together. I don't think this manual intervention is possible for regular LED sequences, though.

@jandelgado
Copy link
Owner

jandelgado commented Sep 10, 2023

Thanks for the report - I can confirm that there is a problem in the JLed code, introduced recently (and not covered by tests...). Will investigate further ...

@jandelgado jandelgado added the bug label Sep 10, 2023
jandelgado added a commit that referenced this issue Sep 10, 2023
because this reveales the root cause of #122, that false is returned
while the effect is acutally running
jandelgado added a commit that referenced this issue Sep 10, 2023
* also check the outcome of Update() in tests
because this reveales the root cause of #122, that false is returned
while the effect is acutally running

* upgrade to catch2 v3

* update platformio to 6.1.10

* release 4.13.1

* update coversall action
@jandelgado
Copy link
Owner

fixed with 4.13.1, please check if it's ok now

@mattbk
Copy link
Author

mattbk commented Sep 12, 2023

Works a treat, thank you!

@mattbk mattbk closed this as completed Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants