Working snapshot.

This commit is contained in:
mattbk 2023-09-12 21:32:11 -05:00
parent 3aba0583be
commit dc765af473
2 changed files with 24 additions and 10 deletions

View File

@ -27,3 +27,4 @@ lib_deps =
https://github.com/adafruit/RTClib.git ; >=2.1.2
adafruit/Adafruit BusIO@^1.14.3
;jchristensen/DS3232RTC@^2.0.1
monitor_filters = esp32_exception_decoder

View File

@ -333,25 +333,34 @@ 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));
JLedSequence* sequence = NULL;
JLedSequence* make_sequence(JLedSequence* seq, const char* message, int wpm, int step_length, int n_transmitters){
int ms_per_dit = 60;//1000 * (60 / (50 * wpm));
int word_space_ms = ms_per_dit * 7;
MorseEffect morse_effect(message, ms_per_dit);
int period = morse_effect.Period();
int repeats = step_length / period;
int repeats = 2;//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)
JLed(blinker).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms),
JLed(blinker).Off(total_wait)
};
auto sequence = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
return sequence;
if (seq){
delete seq;
//seq = new JLedSequence(JLedSequence::eMode::SEQUENCE, leds);
seq = new JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);
}
return seq;
}
// Initial definition of the sequence
JLedSequence* morses_sequence_blink_test = make_sequence(sequence, "MOE", 10, 10000, 2);
auto morses_sequence_blink_test = make_sequence(morseEffectMOE, blinker, 10, 10000, 2);
//================================================================================
@ -369,6 +378,8 @@ auto morses_sequence_blink_test = make_sequence(morseEffectMOE, blinker, 10, 100
void setup() {
Serial.begin(115200);
pinMode(alarmPin, INPUT_PULLUP); // Set alarm pin as pullup
if (! rtc.begin()) {
@ -599,6 +610,8 @@ void loop() {
// Timers
timer.tick();
//morses_sequence_blink_test->Forever().Update();
// See which message we are sending
// Only do this when the message has been updated.
if(yourInputMsg != yourInputMsg_old){