From 3aba0583be5eafe40832b08aeee5ed37bcdfe9a8 Mon Sep 17 00:00:00 2001 From: mattbk Date: Mon, 11 Sep 2023 21:47:37 -0500 Subject: [PATCH] Stub out a non-working function to set up Jled sequences. --- vulpes/src/main.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index 2e46b53..6a806d2 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -333,6 +333,27 @@ JLed morses_blink[] = { }; auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink); +JLedSequence make_sequence(MorseEffect morse_effect, int gpio, int wpm, int step_length, int n_transmitters){ + int ms_per_dit = 1000 * (60 / (50 * wpm)); + int word_space_ms = ms_per_dit * 7; + int period = morse_effect.Period(); + int repeats = step_length / period; + int remainder_wait = step_length - (period * repeats); + int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); + //auto blinker_continuous = JLed(gpio).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms); + //auto blinker_continuous_wait = JLed(gpio).Off(total_wait); + JLed morses_blink[] = { + JLed(gpio).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms), + JLed(gpio).Off(total_wait) + }; + + auto sequence = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink); + return sequence; +} + +auto morses_sequence_blink_test = make_sequence(morseEffectMOE, blinker, 10, 10000, 2); + + //================================================================================ // start_program(): a function to start the planned program at the planned time //================================================================================ @@ -628,13 +649,13 @@ void loop() { //int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); // Nothing makes it out of this scope... - blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms); - blinker_continuous_wait = JLed(blinker).Off(total_wait); - JLed morses_blink[] = { - blinker_continuous, - blinker_continuous_wait - }; - auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink); + // blinker_continuous = JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats).DelayAfter(word_space_ms); + // blinker_continuous_wait = JLed(blinker).Off(total_wait); + // JLed morses_blink[] = { + // blinker_continuous, + // blinker_continuous_wait + // }; + // auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink); morses_sequence_blink.Forever().Update(); programRunning = true;