Set up scheduled program cycles #24

Merged
W1CDN merged 41 commits from program-cycle into main 2023-09-15 16:51:45 -05:00
Owner

All the keywords in the title, I guess.

Closes #8.

All the keywords in the title, I guess. Closes #8.
W1CDN added the
enhancement
label 2023-09-04 20:50:18 -05:00
Author
Owner

If using ardino-timer (https://github.com/contrem/arduino-timer), how to set this up?

  • get start time of program from webform
  • start time should be in unix utc, but RTC uses seconds rather than milliseconds
  • subtract current time from start time in milliseconds
  • use timer.at(time, function_to_call); (with time in milliseconds?) RTC built-in alarm
    • only start the program if the controller is on when the start time happens, not if the controller is powered on after the start time. This is the simplest (?) way to keep all the timing together across multiple controllers
  • keep track of whether a program is running or is scheduled to run in the future--some sort of status header that goes along with the value of yourInputSend. - #37
  • function should then call timer.every(interval, function_to_call); and expire
  • the timer.every() function is probably a wrapper to update the variables that go into morseToSend (and `morseToSend_blink).
    • use some math to determine, according to the sending speed, step length, and number of transmitters,
      • how long the timer.every() interval should be
      • how many times to JLed Repeat() send to fill the step length
  • account for any changes in webform along the way
If using ardino-timer (https://github.com/contrem/arduino-timer), how to set this up? - [x] get start time of program from webform - [x] start time should be in unix utc, but RTC uses seconds rather than milliseconds - ~~subtract current time from start time in milliseconds~~ - [x] use ~~`timer.at(time, function_to_call);` (with time in milliseconds?)~~ RTC built-in alarm - [x] only start the program if the controller is on when the start time happens, not if the controller is powered on after the start time. This is the simplest (?) way to keep all the timing together across multiple controllers - keep track of whether a program is running or is scheduled to run in the future--some sort of status header that goes along with the value of `yourInputSend`. - #37 - ~~function should then call `timer.every(interval, function_to_call);` and expire~~ - ~~the `timer.every()` function is probably a wrapper to update the variables that go into `morseToSend` (and `morseToSend_blink).~~ - [x] use some math to determine, according to the sending speed, step length, and number of transmitters, - ~~how long the `timer.every()` interval should be~~ - ~~how many times to JLed `Repeat()` send to fill the step length~~ - [x] account for any changes in webform along the way
Author
Owner

HTML field is datetime-local, which needs to be labeled as UTC.

https://www.w3schools.com/tags/att_input_type_datetime-local.asp

Comes out as 2023-09-02T05:34 format.

Can I use JS to convert this to UTC?

HTML field is datetime-local, which needs to be labeled as UTC. https://www.w3schools.com/tags/att_input_type_datetime-local.asp Comes out as `2023-09-02T05:34` format. Can I use JS to convert this to UTC?
mattbk added 1 commit 2023-09-04 21:53:15 -05:00
Collect unix time from webform, but need to make sure it is UTC.
Author
Owner

I can get the submitted unix time copied into a file/variable, but it might be local time rather than UTC?

I can get the submitted unix time copied into a file/variable, but it might be local time rather than UTC?
mattbk added 1 commit 2023-09-05 11:08:12 -05:00
Author
Owner

Maybe I'll go back and make it use local time everywhere.

Huh, Date.now() gives UTC. Maybe I can use TZ offset on one of the unix timestamps to get where I want to be. https://stackoverflow.com/a/61082536/2152245

Maybe I'll go back and make it use local time everywhere. Huh, `Date.now()` gives UTC. Maybe I can use TZ offset on one of the unix timestamps to get where I want to be. https://stackoverflow.com/a/61082536/2152245
mattbk added 1 commit 2023-09-05 15:42:11 -05:00
Author
Owner

Holy buckets do js missing brackets break everything.

Holy buckets do js missing brackets break everything.
mattbk added 1 commit 2023-09-05 16:55:51 -05:00
Author
Owner

Oh no, DST. The time zone adjustment doesn't know about it. See #26.

Oh no, DST. The time zone adjustment doesn't know about it. See #26.
mattbk added 1 commit 2023-09-05 20:42:03 -05:00
mattbk added 1 commit 2023-09-05 21:11:38 -05:00
Author
Owner

All back on local time now. The current time is saved with an epoch shift according to the timezone offset in JS. The start program time is local by default from the HTML form. Both are stored as unix timestamps on the C++ side.

All back on local time now. The current time is saved with an epoch shift according to the timezone offset in JS. The start program time is local by default from the HTML form. Both are stored as unix timestamps on the C++ side.
Author
Owner

It's not horrible. I'd like the two time formats to match.
image

When I try to format the date differently than return rtc.now().timestamp();, like toString(), the device crashes.

In any case, this is probably the way to go:

  • handle timestamp display with JS rather than C++

This message when you submit an empty date also isn't horrible, but I'd rather store the existing date until a new one is set.
image

It's not horrible. I'd like the two time formats to match. ![image](/attachments/d4cf5a1a-c298-4226-816b-19c1b985ef5e) When I try to format the date differently than `return rtc.now().timestamp();`, like `toString()`, the device crashes. In any case, this is probably the way to go: - [x] handle timestamp display with JS rather than C++ This message when you submit an empty date also isn't horrible, but I'd rather store the existing date until a new one is set. ![image](/attachments/f163396f-b0bf-4837-908a-1a034966a71e)
Author
Owner

Way overthinking this. Time is coming from browser in the first place. If I want to print it, print it from the browser, don't pull it from the controller.

Way overthinking this. Time is coming from browser in the first place. If I want to print it, print it from the browser, don't pull it from the controller.
mattbk added 1 commit 2023-09-06 16:58:10 -05:00
Author
Owner
  • bug: when a start time is submitted, the form submits twice

image

- [x] bug: when a start time is submitted, the form submits twice ![image](/attachments/f7b58390-ad8c-4af5-9123-b496aac2ba85)
232 KiB
Author
Owner

Wow did I ever get messed up there.

If the start date isn't set, a value isn't added to the JS, so it just sees s = ; and breaks everything else in the script. Which means you can't put in a new value from the webform.

Right now there is a hardcoded date in JS, but that needs to be fixed.

Wow did I ever get messed up there. If the start date isn't set, a value isn't added to the JS, so it just sees `s = ;` and breaks everything else in the script. Which means you can't put in a new value from the webform. Right now there is a hardcoded date in JS, but that needs to be fixed.
mattbk added 2 commits 2023-09-06 18:08:42 -05:00
mattbk added 1 commit 2023-09-06 19:24:08 -05:00
Author
Owner

Did a Full Clean/Build Filesystem Image/Upload Filesystem Image/Upload and Monitor.

The empty start time/broken JS seems to be fixed by b97f48858d.

Back to the double submit problem.

Did a Full Clean/Build Filesystem Image/Upload Filesystem Image/Upload and Monitor. The empty start time/broken JS seems to be fixed by b97f48858d7e1ac706e74d34a70b301af7a839cb. Back to the double submit problem.
Author
Owner

No luck on double submit, but I managed to

  • fill in the start time so it doesn't disappear
  • introduce a bug because the start time that's filled in gets converted to local time from local time, so it is wrong

image

No luck on double submit, but I managed to - fill in the start time so it doesn't disappear - [x] introduce a bug because the start time that's filled in gets converted to local time from local time, so it is wrong ![image](/attachments/19d3daf8-e7c4-4d94-83d8-0c55207698b3)
mattbk added 1 commit 2023-09-06 20:16:10 -05:00
mattbk added 1 commit 2023-09-06 21:21:14 -05:00
mattbk added 1 commit 2023-09-06 21:36:15 -05:00
Author
Owner

Ooooh, so close. Going to attack #15 now.

Ooooh, so close. Going to attack #15 now.
mattbk added 1 commit 2023-09-06 21:52:13 -05:00
Author
Owner
Super rad. https://stackoverflow.com/a/48307807
mattbk added 1 commit 2023-09-06 22:07:54 -05:00
Author
Owner

Now. Now maybe I can get to scheduling.

Now. *Now* maybe I can get to scheduling.
mattbk added 1 commit 2023-09-07 20:21:36 -05:00
Author
Owner

OK, so it looks like arduino-timer .at() uses the millis() clock. Are there timers that use real time (like stored in RTC)?

Or should I be using RTC alarms? https://garrysblog.com/2020/07/05/using-the-ds3231-real-time-clock-alarm-with-the-adafruit-rtclib-library/

https://www.arduino.cc/reference/en/libraries/category/timing/

OK, so it looks like arduino-timer `.at()` uses the `millis()` clock. Are there timers that use real time (like stored in RTC)? Or should I be using RTC alarms? https://garrysblog.com/2020/07/05/using-the-ds3231-real-time-clock-alarm-with-the-adafruit-rtclib-library/ https://www.arduino.cc/reference/en/libraries/category/timing/
Author
Owner

RTC alarms seem to fire at the next opportunity, even if they happened when ESP32 was off. This is a problem I wanted to avoid.

Reset the alarm in setup() if it's in the past?

RTC alarms seem to fire at the next opportunity, even if they happened when ESP32 was off. This is a problem I wanted to avoid. Reset the alarm in `setup()` if it's in the past?
Author
Owner

I'm getting weird dates again. I will look at the hardware connections tomorrow. May be a short between the two boards because I sort of overlapped them!

[E][esp32-hal-i2c.c:776] emptyRxFifo(): RxEmpty(1) call on TxBuffer? dq=0
[E][esp32-hal-i2c.c:1434] i2cCheckLineState(): Bus Invalid State, TwoWire() Can't init sda=0, scl=0
RTC can't set time. Trying again.

It's also worth considering using the SQW pin: https://garrysblog.com/2020/07/05/using-the-ds3231-real-time-clock-alarm-with-the-adafruit-rtclib-library/.

I'm getting weird dates again. I will look at the hardware connections tomorrow. May be a short between the two boards because I sort of overlapped them! ``` [E][esp32-hal-i2c.c:776] emptyRxFifo(): RxEmpty(1) call on TxBuffer? dq=0 [E][esp32-hal-i2c.c:1434] i2cCheckLineState(): Bus Invalid State, TwoWire() Can't init sda=0, scl=0 RTC can't set time. Trying again. ``` It's also worth considering using the SQW pin: https://garrysblog.com/2020/07/05/using-the-ds3231-real-time-clock-alarm-with-the-adafruit-rtclib-library/.
Author
Owner

It's this bit that's causing the i2cCheckLineState() error and reboot:

   if ((rtc.alarmFired(2) == true) ){
    
     // Print current time and date
     DateTime now = rtc.now(); // Get the current time
     char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY";
     Serial.println(now.toString(buff));

     // Disable and clear alarm
     rtc.clearAlarm(2); 
   }
It's this bit that's causing the `i2cCheckLineState()` error and reboot: ``` if ((rtc.alarmFired(2) == true) ){ // Print current time and date DateTime now = rtc.now(); // Get the current time char buff[] = "Alarm triggered at hh:mm:ss DDD, DD MMM YYYY"; Serial.println(now.toString(buff)); // Disable and clear alarm rtc.clearAlarm(2); } ```
Author
Owner

Changed true to 1 and it is not crashing. Nope, still crashes. Why intermittent? With the whole if statement commented out, submitting the form doesn't seem to cause crashes. I wonder if it's some race condition between form submission (setting the alarm) and testing the alarm in loop().

Also, even though I get stuff like this, the RTC time seems to be right:

Writing file: /inputMsg.txt
- file written
yourInputTime: 1694179866
UTC time from browser: 2000/0/0 (0) 0:0:0
rtc.now().unixtime(): 3002226120
~~Changed `true` to `1` and it is not crashing.~~ Nope, still crashes. Why intermittent? With the whole `if` statement commented out, submitting the form doesn't seem to cause crashes. I wonder if it's some race condition between form submission (setting the alarm) and testing the alarm in `loop()`. Also, even though I get stuff like this, the RTC time seems to be right: ``` Writing file: /inputMsg.txt - file written yourInputTime: 1694179866 UTC time from browser: 2000/0/0 (0) 0:0:0 rtc.now().unixtime(): 3002226120 ```
mattbk added 1 commit 2023-09-08 08:39:21 -05:00
Author
Owner

I tried the same if ((rtc.alarmFired(2) == true) ) code on the breadboard version and get the same results (crash on form submission).

I will probably breadboard in the SQW pin and see if that works better https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-SQW/DS3231-RTClib-Adafruit-Alarm-Poll-SQW.ino.

I tried the same `if ((rtc.alarmFired(2) == true) )` code on the breadboard version and get the same results (crash on form submission). I will probably breadboard in the SQW pin and see if that works better https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-SQW/DS3231-RTClib-Adafruit-Alarm-Poll-SQW.ino.
mattbk added 1 commit 2023-09-08 10:39:27 -05:00
Author
Owner

Added SQW pin on breadboard to GPIO4.

I can set Alarm2 and have SQW notify of the alarm. I tried

  • setting, turning off the ESP32, waiting past alarm time, and it does not trigger on boot (this is good)
  • setting, rebooting ESP32, and waiting for alarm, and it triggers at right time

But I need to make sure that the time is being held between reboots, because the alarm just takes "day of month" HH:MM:SS, not absolute date. So if it reboots and thinks it's May 2000 but the same day, the alarm will trigger anyway.

On boot: Alarm 2 set for at 15:27:00 Mon, 08 May 2000

Added SQW pin on breadboard to GPIO4. I can set Alarm2 and have SQW notify of the alarm. I tried - setting, turning off the ESP32, waiting past alarm time, and it does not trigger on boot (this is good) - setting, rebooting ESP32, and waiting for alarm, and it triggers at right time But I need to make sure that the time is being held between reboots, because the alarm just takes "day of month" HH:MM:SS, *not* absolute date. So if it reboots and thinks it's May 2000 but the same day, the alarm will trigger anyway. On boot: `Alarm 2 set for at 15:27:00 Mon, 08 May 2000`
Author
Owner

Feel slightly better:

yourInputTime: 1694187947
RTC can't set time. Trying again.
UTC time from browser: 2023/9/8 (5) 15:45:47
rtc.now().unixtime(): 1694187947
Writing file: /inputFloat.txt
- file written
1694187960
Writing file: /inputStartTimeUnix.txt
- file written
1694187960
Alarm 2 set for at 15:46:00 Mon, 08 May 2000
Alarm triggered at 15:46:00 Fri, 08 Sep 2023
Feel slightly better: ``` yourInputTime: 1694187947 RTC can't set time. Trying again. UTC time from browser: 2023/9/8 (5) 15:45:47 rtc.now().unixtime(): 1694187947 Writing file: /inputFloat.txt - file written 1694187960 Writing file: /inputStartTimeUnix.txt - file written 1694187960 Alarm 2 set for at 15:46:00 Mon, 08 May 2000 Alarm triggered at 15:46:00 Fri, 08 Sep 2023 ```
Author
Owner

Confirming that I can't set an alarm more than a month in advance (or maybe ~2 months if the current month has 30 days and the next month has 31 days, and you set it for the 31st). Wild.

https://forum.arduino.cc/t/ds3231-alarm-when-date-match/929036/5

The alarm registers on the DS3231 only allow you to store seconds, minutes, hours, and either the day of the month(1-31) or the day of the week (1-7), so there is no way for it to internally adjust for the last day of the month. If you want an alarm on the last day of the month, presumably your code would need to set the day of the month properly.

This is probably OK. I will leave the edge case alone for now. #33.

Confirming that I can't set an alarm more than a month in advance (or maybe ~2 months if the current month has 30 days and the next month has 31 days, and you set it for the 31st). Wild. https://forum.arduino.cc/t/ds3231-alarm-when-date-match/929036/5 > The alarm registers on the DS3231 only allow you to store seconds, minutes, hours, and either the day of the month(1-31) or the day of the week (1-7), so there is no way for it to internally adjust for the last day of the month. If you want an alarm on the last day of the month, presumably your code would need to set the day of the month properly. This is probably OK. I will leave the edge case alone for now. #33.
Author
Owner
  • add to webform that start time is only accurate to day of month
  • cancel the alarm entirely somehow, so it doesn't start up unexpectedly every month on the same day
  • cancel the alarm if it's too late; if I set it under "continuous", alarm time passes, then I switch to "cycle," the alarm triggers. This is bad.
    • might be because I was using Alarm 2, which only matches minutes, not seconds
    • see #24 (comment)
- [x] add to webform that start time is only accurate to day of month - [x] cancel the alarm entirely somehow, so it doesn't start up unexpectedly every month on the same day - [x] cancel the alarm if it's too late; if I set it under "continuous", alarm time passes, then I switch to "cycle," the alarm triggers. This is bad. - might be because I was using Alarm 2, which only matches minutes, not seconds - see https://amiok.net/gitea/W1CDN/vulpes/pulls/24#issuecomment-1208
mattbk added 1 commit 2023-09-08 11:12:47 -05:00
Author
Owner

Before I go too far, consider just comparing rtc.now() and the start time in loop() to trigger the scheduled program.

ETA: This is harder than it looks, so I'll avoid it for now.

Before I go too far, consider just comparing `rtc.now()` and the start time in `loop()` to trigger the scheduled program. ETA: This is harder than it looks, so I'll avoid it for now.
Author
Owner
Random times every once in a while again. https://www.reddit.com/r/arduino/comments/hdg70t/ds3231_rtc_random_numbers/
Author
Owner

I thought I had typed this all out, but

  • Alarm2 has only minute resolution
  • Alarm1 has second resolution

So when I set up Alarm2 but turn off cycle, if I turned cycle back on within the same minute, the alarm was triggered.

I switched to Alarm1.

I thought I had typed this all out, but - Alarm2 has only minute resolution - Alarm1 has second resolution So when I set up Alarm2 but turn off cycle, if I turned cycle back on within the same minute, the alarm was triggered. I switched to Alarm1.
mattbk added 1 commit 2023-09-08 15:02:32 -05:00
mattbk added 1 commit 2023-09-08 15:08:03 -05:00
Author
Owner

To send a cycle, we need to set up the duration of each repeating message.

  • Need webform entries (#8) for
    • step length
    • cycle ID
    • number of transmitters
  • Need a function to call that
    • is called when timer expires
    • calls morseToSend and morseToSend_blink reset/update for step length
    • waits (([step length seconds] * [number of transmitters])) - [number of transmitters]) seconds before starting over

Can this be done with arduino-timer or another timer without rewriting the Jled functions in loop()?

To send a cycle, we need to set up the duration of each repeating message. - [x] Need webform entries (#8) for - step length - cycle ID - number of transmitters - [x] Need a function to call that - is called when timer expires - calls `morseToSend` and `morseToSend_blink` reset/update for step length - waits (([step length seconds] * [number of transmitters])) - [number of transmitters]) seconds before starting over Can this be done with arduino-timer or another timer without rewriting the Jled functions in `loop()`?
Author
Owner

So close to being able to use Jled sequences natively, if I could figure out how to calculate the number of times to repeat for a given step length.

This looks helpful (https://arduino.stackexchange.com/a/22275):

#include <elapsedMillis.h>

elapsedMillis timeElapsed;
unsigned int interval = 60000; //one minute in ms

while(timeElapsed < interval){
    //do stuff
}

Or use millis() directly like

int end_time = millis() + 1000; // 1 second in future
while(millis() < end_time){
// do stuff
}

Jled sequences example 1 (you can repeat a sequence n times or forever) (https://github.com/jandelgado/jled/issues/103#issuecomment-1312098221):

#include <jled.h>

auto blinkTwice = JLed(1).Blink(250,250).Repeat(2);
auto wait = JLed(1).Off().DelayAfter(1000);
JLed leds[] = {blinkTwice, wait};
auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, leds).Forever();
 
void setup() {
}

void loop() {
  seq.Update();
}

Jled sequences example 2 (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),
    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()
};

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

void setup() { }

void loop() {
    sequence.Update();
    delay(1);
}
So close to being able to use Jled sequences natively, if I could figure out how to calculate the number of times to repeat for a given step length. This looks helpful (https://arduino.stackexchange.com/a/22275): ``` #include <elapsedMillis.h> elapsedMillis timeElapsed; unsigned int interval = 60000; //one minute in ms while(timeElapsed < interval){ //do stuff } ``` Or use `millis()` directly like ``` int end_time = millis() + 1000; // 1 second in future while(millis() < end_time){ // do stuff } ``` Jled sequences example 1 (you can repeat a sequence n times or forever) (https://github.com/jandelgado/jled/issues/103#issuecomment-1312098221): ``` #include <jled.h> auto blinkTwice = JLed(1).Blink(250,250).Repeat(2); auto wait = JLed(1).Off().DelayAfter(1000); JLed leds[] = {blinkTwice, wait}; auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, leds).Forever(); void setup() { } void loop() { seq.Update(); } ``` Jled sequences example 2 (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), 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() }; JLedSequence sequence(JLedSequence::eMode::SEQUENCE, leds); void setup() { } void loop() { sequence.Update(); delay(1); } ```
Author
Owner

Another example (https://github.com/jandelgado/jled/issues/34):

#include <Arduino.h>
#include<jled.h>
// blink internal LED every second; 1 second on, 0.5 second off.
auto led = JLed(LED_BUILTIN).Blink(100, 500).Forever();
auto changed = false;

void setup() {}

void loop() {
     static auto time_start = millis();
     if (millis() - time_start > 5000 && !changed) {
         changed = true;
         led = JLed(LED_BUILTIN).Blink(1000, 500).Forever(); 
    }   
    led.Update();
}

Can I rewrite this for what I need?

#include <Arduino.h>
#include<jled.h>
// put the forever morseToSend here
auto led = JLed(LED_BUILTIN).Blink(100, 500).Forever();

auto changed = false; // is the step over?
int step_length = 60000; // duration for this transmitter
int cycle_id = 1; // number of this transmitter in cycle
int n_transmitters = 5; number of transmitters total

...?

void setup() {}

void loop() {
     static auto time_start = millis();
     if (millis() - time_start > 5000 && !changed) {
         changed = true;
         led = JLed(LED_BUILTIN).Blink(1000, 500).Forever(); 
    }   
    led.Update();
}
Another example (https://github.com/jandelgado/jled/issues/34): ``` #include <Arduino.h> #include<jled.h> // blink internal LED every second; 1 second on, 0.5 second off. auto led = JLed(LED_BUILTIN).Blink(100, 500).Forever(); auto changed = false; void setup() {} void loop() { static auto time_start = millis(); if (millis() - time_start > 5000 && !changed) { changed = true; led = JLed(LED_BUILTIN).Blink(1000, 500).Forever(); } led.Update(); } ``` Can I rewrite this for what I need? ``` #include <Arduino.h> #include<jled.h> // put the forever morseToSend here auto led = JLed(LED_BUILTIN).Blink(100, 500).Forever(); auto changed = false; // is the step over? int step_length = 60000; // duration for this transmitter int cycle_id = 1; // number of this transmitter in cycle int n_transmitters = 5; number of transmitters total ...? void setup() {} void loop() { static auto time_start = millis(); if (millis() - time_start > 5000 && !changed) { changed = true; led = JLed(LED_BUILTIN).Blink(1000, 500).Forever(); } led.Update(); } ```
Author
Owner

Neat but not what I'm looking for: https://github.com/tfeldmann/Arduino-Blinkenlight.

Neat but not what I'm looking for: https://github.com/tfeldmann/Arduino-Blinkenlight.
Author
Owner

GTK (https://github.com/jandelgado/jled/issues/11#issuecomment-429887353):

There is no need to redefine the object each time.
Just call the variable with the new parameters.

ex: leds[0].Blink(50, 1800).DelayBefore(450).Forever();

GTK (https://github.com/jandelgado/jled/issues/11#issuecomment-429887353): > There is no need to redefine the object each time. Just call the variable with the new parameters. > ex: `leds[0].Blink(50, 1800).DelayBefore(450).Forever();`
Author
Owner

Oh wow, you can get the duration of the Morse effect with Serial.println(morseEffectMO5.Period()); or similar.

This will let me calculate how many repeats fit into each step length.

Then hopefully I can make a sequence (from above):

auto blinkTwice = JLed(1).Blink(250,250).Repeat(2);
auto wait = JLed(1).Off().DelayAfter(1000);
JLed leds[] = {blinkTwice, wait};
auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, leds).Forever();
Oh wow, you can get the duration of the Morse effect with `Serial.println(morseEffectMO5.Period());` or similar. This will let me calculate how many repeats fit into each step length. Then hopefully I can make a sequence (from above): ``` auto blinkTwice = JLed(1).Blink(250,250).Repeat(2); auto wait = JLed(1).Off().DelayAfter(1000); JLed leds[] = {blinkTwice, wait}; auto seq = JLedSequence(JLedSequence::eMode::SEQUENCE, leds).Forever(); ```
mattbk added 1 commit 2023-09-08 21:21:26 -05:00
Author
Owner

Very simple example working. To get it going:

  • set a different message than 0, save
  • set message to 0 and start continuous, save

The message should send once, but really it is limited to int repeats step_length / morseEffectTEST.Period(); and when step_length = 30000 (30 seconds), a ~19-second message can only be sent once.

Next steps are to

  • finish this sequence by setting up an LED-off wait (see above) and
  • set up conditionals under // See which message we are sending to differentiate between continuous and cycle sending.
Very simple example working. To get it going: - set a different message than 0, save - set message to 0 and start continuous, save The message should send once, but really it is limited to `int repeats step_length / morseEffectTEST.Period();` and when `step_length = 30000` (30 seconds), a ~19-second message can only be sent once. Next steps are to - finish this sequence by setting up an LED-off wait (see above) and - set up conditionals under `// See which message we are sending` to differentiate between continuous and cycle sending.
mattbk added 1 commit 2023-09-08 22:55:39 -05:00
Author
Owner

My brain needs a rest.

My brain needs a rest.
Author
Owner

I am debugging this in Sites/jled/ and there may be a bug with using DelayAfter() in a sequence: https://github.com/jandelgado/jled/issues/122.

What's funny is that my little test file almost does everything needed but without the overhead of having it configurable away from PlatformIO.

I am debugging this in `Sites/jled/` and there may be a bug with using `DelayAfter()` in a sequence: https://github.com/jandelgado/jled/issues/122. What's funny is that my little test file almost does everything needed but without the overhead of having it configurable away from PlatformIO.
mattbk added 1 commit 2023-09-09 12:53:49 -05:00
Author
Owner

This is basically working. Observations:

  • message and timing are hardcoded for now
    • need to update in loop, based on webform entry
  • no gap between end of message repeat and beginning of next message repeat (see https://github.com/jandelgado/jled/issues/122)
    • "working" fix by adding a space (" ") to the end of each message
  • if switching continuous to cycle, the continuous message keeps going
  • if switching off to cycle, the cycle message keeps going
    • it should probably not, because who knows if the timing stays the same
    • it should switch off sending until the start time is reached
    • fixed in 70decbbcca
This is basically working. Observations: - message and timing are hardcoded for now - need to update in loop, based on webform entry - ~~no gap between end of message repeat and beginning of next message repeat (see https://github.com/jandelgado/jled/issues/122)~~ - "working" fix by adding a space (" ") to the end of each message - ~~if switching continuous to cycle, the continuous message keeps going~~ - it should stop sending - fixed in 70decbbcca420194fc144ea19fc4d1319038b8a9 - ~~if switching off to cycle, the cycle message keeps going~~ - it should probably not, because who knows if the timing stays the same - it should switch off sending until the start time is reached - fixed in 70decbbcca420194fc144ea19fc4d1319038b8a9
mattbk added 1 commit 2023-09-09 13:14:32 -05:00
mattbk added 1 commit 2023-09-09 16:01:48 -05:00
Author
Owner

My use of "cycle" and "program" are very confused right now, but making progress.

My use of "cycle" and "program" are very confused right now, but making progress.
Author
Owner

So close. Trying to let the user change the cycle message and running to problems.

Things like morse_cycle = morseEffectMOE; just don't work in loop(). And I can't even overwrite an initial auto morse_cycle = morseEffectMOE; with a later MorseEffect morse_cycle("MOE ", ms_per_dit);

I'm going to set this aside and see if anything else can be updated. If not, will need to reassess.

So close. Trying to let the user change the cycle message and running to problems. Things like `morse_cycle = morseEffectMOE;` just don't work in `loop()`. And I can't even overwrite an initial `auto morse_cycle = morseEffectMOE;` with a later `MorseEffect morse_cycle("MOE ", ms_per_dit);` I'm going to set this aside and see if anything else can be updated. If not, will need to reassess.
Author
Owner
  • test power cycle between when start time is set and start time is reached. Does it work the way it should? It should start the program at the scheduled time with no input from the webform.

If it doesn't work, need to store programRunning in file and check on boot., No, that should only be needed if we want to resume from a power loss in the middle of a program, and that will require more math to figure out when to restart the program.

- [x] test power cycle between when start time is set and start time is reached. Does it work the way it should? It should start the program at the scheduled time with no input from the webform. ~~If it doesn't work, need to store `programRunning` in file and check on boot.~~, No, that should only be needed if we want to resume from a power loss in the middle of a program, and that will require more math to figure out when to restart the program.
Author
Owner

Um, no, the program doesn't seem to survive a reboot. Fun.

Well, it works if I push the reset button, but didn't when I unplugged the USB cable.

Um, no, the program doesn't seem to survive a reboot. Fun. Well, it works if I push the reset button, but didn't when I unplugged the USB cable.
Author
Owner

Maybe this could be a function?

  if(startProgram == true){
  //auto morse_cycle = morseEffectMOS;
    int period = morse_cycle.Period();
    int repeats = step_length / period;
    int remainder_wait = step_length - (period * repeats);
    int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
    JLed morses_blink[] = {
        // WOW it looks like you can't do Repeat() and DelayAfter() at the same time?
        // Opened https://github.com/jandelgado/jled/issues/122
        JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats),
        //JLed(blinker).FadeOn(1000).Repeat(3)
        JLed(blinker).Off(total_wait)
    };
    auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink);

    morses_sequence_blink.Forever().Update();
    programRunning = true;
    startProgram = false;
  }
Maybe this could be a function? ``` if(startProgram == true){ //auto morse_cycle = morseEffectMOS; int period = morse_cycle.Period(); int repeats = step_length / period; int remainder_wait = step_length - (period * repeats); int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); JLed morses_blink[] = { // WOW it looks like you can't do Repeat() and DelayAfter() at the same time? // Opened https://github.com/jandelgado/jled/issues/122 JLed(blinker).UserFunc(&morse_cycle).Repeat(repeats), //JLed(blinker).FadeOn(1000).Repeat(3) JLed(blinker).Off(total_wait) }; auto morses_sequence_blink = JLedSequence(JLedSequence::eMode::SEQUENCE, morses_blink); morses_sequence_blink.Forever().Update(); programRunning = true; startProgram = false; } ```
Author
Owner

Sigh. RTC is off after reset. That's no good. This was at 19:05 local time.

morseEffectTEST.Period(): 20520
RTC time on startup: 2023-09-09T18:30:38
Alarm 1 set for at 23:58:00 Tue, 09 May 2000 (only HH:MM:SS day-of-month are accurate)
Sigh. RTC is off after reset. That's no good. This was at 19:05 local time. ``` morseEffectTEST.Period(): 20520 RTC time on startup: 2023-09-09T18:30:38 Alarm 1 set for at 23:58:00 Tue, 09 May 2000 (only HH:MM:SS day-of-month are accurate) ```
Author
Owner

Don't know if this is good/relevant info or not (https://arduino.stackexchange.com/a/84893):

So you disconnect the 5V to the DS3231, but keep the SDA and SCL pins connected? By doing that, you are working outside of the recommended operating conditions.
If you leave the SDA and SCL pins connected, those pins will be at around 5V. The datasheet specifies that those pins shouldn't be higher that Vcc+0.3V. Where Vcc is 0V, in your case.
Removing power from the Arduino board will also remove the power from the I2C pins, keeping things within specifications.

This is the behavior I see: https://forum.arduino.cc/t/ds3231-not-keeping-time-on-battery/363363/5

Battery measures 3.8V. Is it possible the battery wiring is bad? Try the other DS3231 next.

Same value between DS3231 pin 14 (Vbat) and 13 (ground).
image

Don't know if this is good/relevant info or not (https://arduino.stackexchange.com/a/84893): > So you disconnect the 5V to the DS3231, but keep the SDA and SCL pins connected? By doing that, you are working outside of the recommended operating conditions. >If you leave the SDA and SCL pins connected, those pins will be at around 5V. The datasheet specifies that those pins shouldn't be higher that Vcc+0.3V. Where Vcc is 0V, in your case. >Removing power from the Arduino board will also remove the power from the I2C pins, keeping things within specifications. This is the behavior I see: https://forum.arduino.cc/t/ds3231-not-keeping-time-on-battery/363363/5 Battery measures 3.8V. Is it possible the battery wiring is bad? Try the other DS3231 next. Same value between DS3231 pin 14 (Vbat) and 13 (ground). ![image](/attachments/e4aaf8e1-a6a2-46da-a93b-888aca92a684)
408 KiB
Author
Owner

Reviews on what I bought:

Sounds like these might be fake/counterfeit DS3231 or just bad design with the charging circuit. I guess I can sacrifice one to see if it works better without the charging circuit: https://www.amazon.com/gp/customer-reviews/R3TPKHQJHR0RWU/ref=cm_cr_arp_d_rvw_ttl?ie=UTF8&ASIN=B09LLMYBM1

Same behavior I see (lose on time on power loss), all the 2-star reviews: https://www.amazon.com/gp/customer-reviews/R3T8ND2O2X0U0V/ref=cm_cr_getr_d_rvw_ttl?ie=UTF8&ASIN=B09LLMYBM1

Reviews on what I bought: Sounds like these might be fake/counterfeit DS3231 or just bad design with the charging circuit. I guess I can sacrifice one to see if it works better without the charging circuit: https://www.amazon.com/gp/customer-reviews/R3TPKHQJHR0RWU/ref=cm_cr_arp_d_rvw_ttl?ie=UTF8&ASIN=B09LLMYBM1 Same behavior I see (lose on time on power loss), all the 2-star reviews: https://www.amazon.com/gp/customer-reviews/R3T8ND2O2X0U0V/ref=cm_cr_getr_d_rvw_ttl?ie=UTF8&ASIN=B09LLMYBM1
Author
Owner

I tore the charging circuit resistor out, but still seeing weird results. The chip remembers something because it's showing a time. But why that time? I unplugged it and took the battery out, then replaced it and restarted. The alarm time was reset, but where does 2023-09-09T19:22:31 come from?

RTC time on startup: 1694287351
2023-09-09T19:22:31
Alarm 1 set for at 00:00:00 Sun, 00 May 2000 (only HH:MM:SS day-of-month are accurate)

A bit later: now it seems to be working? I will leave this one unplugged overnight and see what time it shows in the morning.

A bit later: I set a start time and unplugged it for a few minutes, plugged back in before start time. The program started, although it seemed a second or so late.

I tore the charging circuit resistor out, but still seeing weird results. The chip remembers *something* because it's showing a time. But why that time? I unplugged it and took the battery out, then replaced it and restarted. The alarm time was reset, but where does `2023-09-09T19:22:31` come from? ``` RTC time on startup: 1694287351 2023-09-09T19:22:31 Alarm 1 set for at 00:00:00 Sun, 00 May 2000 (only HH:MM:SS day-of-month are accurate) ``` A bit later: now it seems to be working? I will leave this one unplugged overnight and see what time it shows in the morning. A bit later: I set a start time and unplugged it for a few minutes, plugged back in before start time. The program started, although it seemed a second or so late.
Author
Owner

It seems to have worked (turned on at 8:36 AM). Is it 5-6 seconds off?

RTC time on startup: 1694353011
2023-09-10T13:36:51
Alarm 1 set for at 02:16:00 Wed, 10 May 2000 (only HH:MM:SS day-of-month are accurate)
It seems to have worked (turned on at 8:36 AM). Is it 5-6 seconds off? ``` RTC time on startup: 1694353011 2023-09-10T13:36:51 Alarm 1 set for at 02:16:00 Wed, 10 May 2000 (only HH:MM:SS day-of-month are accurate) ```
Author
Owner

After some refreshes in the browser, looks like that one is the correct time. I did the same modification to the other one and it seems to be working similarly.

These are DS3231M chips, so maybe that is removing precision.

I'm going to roll with these for a while to see if they revert to not working. If it becomes a problem, will buy something from Adafruit (https://www.adafruit.com/product/5188) or somewhere else that has quality stuff.

After some refreshes in the browser, looks like that one is the correct time. I did the same modification to the other one and it seems to be working similarly. These are DS3231**M** chips, so maybe that is removing precision. I'm going to roll with these for a while to see if they revert to not working. If it becomes a problem, will buy something from Adafruit (https://www.adafruit.com/product/5188) or somewhere else that has quality stuff.
Author
Owner

Only took 14 hours to "fix" this, I guess: #24 (comment).

Now it looks like the alarm will work after removing/adding power (because the time seems to be kept now).

Back to #24 (comment) now, until something else breaks.

Only took 14 hours to "fix" this, I guess: https://amiok.net/gitea/W1CDN/vulpes/pulls/24#issuecomment-1235. Now it looks like the alarm will work after removing/adding power (because the time seems to be kept now). Back to https://amiok.net/gitea/W1CDN/vulpes/pulls/24#issuecomment-1231 now, until something else breaks.
mattbk added 1 commit 2023-09-10 12:35:11 -05:00
Author
Owner

When using DelayAfter(), need to take that into account for remainer_wait and total_wait math, because it's outside of the duration returned by morse_cycle.Period().

When using `DelayAfter()`, need to take that into account for `remainer_wait` and `total_wait` math, because it's outside of the duration returned by `morse_cycle.Period()`.
Author
Owner

Switching from continuous to off while I was trying to update variables in loop():
image

Switching from continuous to off while I was trying to update variables in `loop()`: ![image](/attachments/e6ccb8ad-49ca-4239-9b82-540a28e0b8a7)
126 KiB
Author
Owner

I'm beginning to think there really is no way to update/replace a Jled sequence on the fly in loop(). So I could set up some basic options and let people choose from a list, until I can figure this out, with Jled or another way.

I'm beginning to think there really is no way to update/replace a Jled sequence on the fly in `loop()`. So I could set up some basic options and let people choose from a list, until I can figure this out, with Jled or another way.
mattbk added 1 commit 2023-09-11 21:14:30 -05:00
Author
Owner

Back to this:

E (37611) ledc: ledc_set_duty(402): channel argument is invalid
E (37616) ledc: ledc_update_duty(334): channel argument is invalid

I am trying to write a function to make new cycle Jled sequences.

Back to this: ``` E (37611) ledc: ledc_set_duty(402): channel argument is invalid E (37616) ledc: ledc_update_duty(334): channel argument is invalid ``` I am trying to write a function to make new cycle Jled sequences.
mattbk added 1 commit 2023-09-11 21:47:41 -05:00
Author
Owner

I'm going to look for JLed alternatives, or maybe ask for help developing this function.

I'm going to look for JLed alternatives, or maybe ask for help developing this function.
Author
Owner

This causes it to reboot over and over:

JLedSequence make_sequence(int gpio, const char* message, int wpm, int step_length, int n_transmitters){
  int ms_per_dit = 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 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(blinker, "MOE", 10, 10000, 2);
This causes it to reboot over and over: ``` JLedSequence make_sequence(int gpio, const char* message, int wpm, int step_length, int n_transmitters){ int ms_per_dit = 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 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(blinker, "MOE", 10, 10000, 2); ```
Author
Owner

https://github.com/ArduinoGetStarted/led (ezLED) is interesting, but I get errors on build. See Sites/ezLED.

https://github.com/ArduinoGetStarted/led (ezLED) is interesting, but I get errors on build. See `Sites/ezLED`.
Author
Owner

Here's an example function, I think: 97ad8480f7/igniter.ino (L118)

JLedSequence* changePeriod(JLedSequence* seq, unsigned int period, unsigned char effect = 0)
{
  Serial.print("\nperiod: ");  Serial.println(period);
  leds[0].Breathe(period);
  leds[1].Breathe(period);
  leds[2].Breathe(period);
  leds[3].Breathe(period);

  if (seq)
    delete seq;
  if (effect > 0)
    seq = new JLedSequence(JLedSequence::eMode::PARALLEL, ledt);
   else
    seq = new JLedSequence(JLedSequence::eMode::PARALLEL, leds);
  return seq;
}
Here's an example function, I think: https://github.com/dariomas/igniter/blob/97ad8480f750b6efcd990ec890027ba8026a4a44/igniter.ino#L118 ``` JLedSequence* changePeriod(JLedSequence* seq, unsigned int period, unsigned char effect = 0) { Serial.print("\nperiod: "); Serial.println(period); leds[0].Breathe(period); leds[1].Breathe(period); leds[2].Breathe(period); leds[3].Breathe(period); if (seq) delete seq; if (effect > 0) seq = new JLedSequence(JLedSequence::eMode::PARALLEL, ledt); else seq = new JLedSequence(JLedSequence::eMode::PARALLEL, leds); return seq; } ```
Author
Owner

The igniter code works pretty well when stripped down, even if I don't understand it. See Sites/igniter.

The problem is that for Morse, I need to know the duration of the message, which means that the MorseEffect needs to be set up first, then the sequence put together. I run into the same issue where it crashes over and over when I try to use the function.


JLedSequence* sequence = NULL;
JLedSequence* make_sequence(JLedSequence* seq, const char* message, int wpm, int step_length, int n_transmitters){
  int ms_per_dit = 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 remainder_wait = step_length - (period * repeats);
  int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait));
  
  JLed morses_blink[] = {
    JLed(blinker).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms),
    JLed(blinker).Off(total_wait)
  };

  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);

The igniter code works pretty well when stripped down, even if I don't understand it. See `Sites/igniter`. The problem is that for Morse, I need to know the duration of the message, which means that the `MorseEffect` needs to be set up first, then the sequence put together. I run into the same issue where it crashes over and over when I try to use the function. ``` JLedSequence* sequence = NULL; JLedSequence* make_sequence(JLedSequence* seq, const char* message, int wpm, int step_length, int n_transmitters){ int ms_per_dit = 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 remainder_wait = step_length - (period * repeats); int total_wait = ((step_length * (n_transmitters - 1) + remainder_wait)); JLed morses_blink[] = { JLed(blinker).UserFunc(&morse_effect).Repeat(repeats).DelayAfter(word_space_ms), JLed(blinker).Off(total_wait) }; 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); ```
Author
Owner

Get a little more information with monitor_filters = esp32_exception_decoder in platformio.ini.

Guru Meditation Error: Core  0 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 0 register dump:
PC      : 0x400d1410  PS      : 0x00060930  A0      : 0x800d1975  A1      : 0x3ffe3a70  
A2      : 0x00000000  A3      : 0x3f400197  A4      : 0x00000000  A5      : 0x00002710  
A6      : 0x00000000  A7      : 0x3ffe3a88  A8      : 0x800d1410  A9      : 0x3ffe3a50  
A10     : 0x00000000  A11     : 0x3f400197  A12     : 0x3ffba704  A13     : 0x00000019  
A14     : 0x3ff49040  A15     : 0x00000000  SAR     : 0x00000020  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0xffffffff  

ELF file SHA256: 0000000000000000

Backtrace: 0x400d1410:0x3ffe3a70 0x400d1972:0x3ffe3b30 0x400d2c3d:0x3ffe3b90 0x40149167:0x3ffe3bb0 0x40084e8d:0x3ffe3bd0 0x400850bc:0x3ffe3c20 0x40079247:0x3ffe3c40 0x400792ad:0x3ffe3c70 0x400792b8:0x3ffe3ca0 0x40079465:0x3ffe3cc0 0x400806da:0x3ffe3df0 0x40007c15:0x3ffe3eb0 0x4000073d:0x3ffe3f20
  #0  0x400d1410:0x3ffe3a70 in make_sequence(jled::JLedSequence*, char const*, int, int, int) at src/main.cpp:345
  #1  0x400d1972:0x3ffe3b30 in _Z41__static_initialization_and_destruction_0ii$constprop$63 at src/main.cpp:361
  #2  0x400d2c3d:0x3ffe3b90 in _GLOBAL__sub_I_server at src/main.cpp:710
  #3  0x40149167:0x3ffe3bb0 in do_global_ctors at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c:510 (discriminator 3)
  #4  0x40084e8d:0x3ffe3bd0 in start_cpu0_default at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c:396
  #5  0x400850bc:0x3ffe3c20 in call_start_cpu0 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c:262
  #6  0x40079247:0x3ffe3c40 in ?? ??:0
  #7  0x400792ad:0x3ffe3c70 in ?? ??:0
  #8  0x400792b8:0x3ffe3ca0 in ?? ??:0
  #9  0x40079465:0x3ffe3cc0 in ?? ??:0
  #10 0x400806da:0x3ffe3df0 in ?? ??:0
  #11 0x40007c15:0x3ffe3eb0 in ?? ??:0
  #12 0x4000073d:0x3ffe3f20 in ?? ??:0
Get a little more information with `monitor_filters = esp32_exception_decoder` in platformio.ini. ``` Guru Meditation Error: Core 0 panic'ed (IntegerDivideByZero). Exception was unhandled. Core 0 register dump: PC : 0x400d1410 PS : 0x00060930 A0 : 0x800d1975 A1 : 0x3ffe3a70 A2 : 0x00000000 A3 : 0x3f400197 A4 : 0x00000000 A5 : 0x00002710 A6 : 0x00000000 A7 : 0x3ffe3a88 A8 : 0x800d1410 A9 : 0x3ffe3a50 A10 : 0x00000000 A11 : 0x3f400197 A12 : 0x3ffba704 A13 : 0x00000019 A14 : 0x3ff49040 A15 : 0x00000000 SAR : 0x00000020 EXCCAUSE: 0x00000006 EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0xffffffff ELF file SHA256: 0000000000000000 Backtrace: 0x400d1410:0x3ffe3a70 0x400d1972:0x3ffe3b30 0x400d2c3d:0x3ffe3b90 0x40149167:0x3ffe3bb0 0x40084e8d:0x3ffe3bd0 0x400850bc:0x3ffe3c20 0x40079247:0x3ffe3c40 0x400792ad:0x3ffe3c70 0x400792b8:0x3ffe3ca0 0x40079465:0x3ffe3cc0 0x400806da:0x3ffe3df0 0x40007c15:0x3ffe3eb0 0x4000073d:0x3ffe3f20 #0 0x400d1410:0x3ffe3a70 in make_sequence(jled::JLedSequence*, char const*, int, int, int) at src/main.cpp:345 #1 0x400d1972:0x3ffe3b30 in _Z41__static_initialization_and_destruction_0ii$constprop$63 at src/main.cpp:361 #2 0x400d2c3d:0x3ffe3b90 in _GLOBAL__sub_I_server at src/main.cpp:710 #3 0x40149167:0x3ffe3bb0 in do_global_ctors at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c:510 (discriminator 3) #4 0x40084e8d:0x3ffe3bd0 in start_cpu0_default at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c:396 #5 0x400850bc:0x3ffe3c20 in call_start_cpu0 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/cpu_start.c:262 #6 0x40079247:0x3ffe3c40 in ?? ??:0 #7 0x400792ad:0x3ffe3c70 in ?? ??:0 #8 0x400792b8:0x3ffe3ca0 in ?? ??:0 #9 0x40079465:0x3ffe3cc0 in ?? ??:0 #10 0x400806da:0x3ffe3df0 in ?? ??:0 #11 0x40007c15:0x3ffe3eb0 in ?? ??:0 #12 0x4000073d:0x3ffe3f20 in ?? ??:0 ```
Author
Owner

Lol, if I comment out the division, I can at least run the function.

  int ms_per_dit = 60;//1000 * (60 / (50 * wpm));
  int repeats = 2;//step_length / period;

So tomorrow I can try to use the object created.

Lol, if I comment out the division, I can at least run the function. ``` int ms_per_dit = 60;//1000 * (60 / (50 * wpm)); int repeats = 2;//step_length / period; ``` So tomorrow I can try to use the object created.
mattbk added 1 commit 2023-09-12 21:32:23 -05:00
Author
Owner

Hmm.
morses_sequence_blink_test->Forever().Update();

Backtrace: 0x400d1c32:0x3ffb1f40 0x400e2799:0x3ffb1fb0 0x4008a39a:0x3ffb1fd0
  #0  0x400d1c32:0x3ffb1f40 in jled::TJLedSequence<jled::JLed, jled::JLedSequence>::Repeat(unsigned short) at .pio/libdeps/esp32doit-devkit-v1/JLed/src/jled_base.h:576
      (inlined by) jled::TJLedSequence<jled::JLed, jled::JLedSequence>::Forever() at .pio/libdeps/esp32doit-devkit-v1/JLed/src/jled_base.h:581
      (inlined by) loop() at src/main.cpp:613
  #1  0x400e2799:0x3ffb1fb0 in loopTask(void*) at /Users/Matt/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:23
  #2  0x4008a39a:0x3ffb1fd0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)

Hmm. `morses_sequence_blink_test->Forever().Update();` ``` Backtrace: 0x400d1c32:0x3ffb1f40 0x400e2799:0x3ffb1fb0 0x4008a39a:0x3ffb1fd0 #0 0x400d1c32:0x3ffb1f40 in jled::TJLedSequence<jled::JLed, jled::JLedSequence>::Repeat(unsigned short) at .pio/libdeps/esp32doit-devkit-v1/JLed/src/jled_base.h:576 (inlined by) jled::TJLedSequence<jled::JLed, jled::JLedSequence>::Forever() at .pio/libdeps/esp32doit-devkit-v1/JLed/src/jled_base.h:581 (inlined by) loop() at src/main.cpp:613 #1 0x400e2799:0x3ffb1fb0 in loopTask(void*) at /Users/Matt/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:23 #2 0x4008a39a:0x3ffb1fd0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1) ```
mattbk added 1 commit 2023-09-13 19:58:53 -05:00
Author
Owner
  • Once #38 is merged here, need to wire up keyer in addition to blinker. - #43
- Once #38 is merged here, need to wire up keyer in addition to blinker. - #43
W1CDN merged commit 3db888e530 into main 2023-09-15 16:51:45 -05:00
W1CDN deleted branch program-cycle 2023-09-15 16:53:09 -05:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: W1CDN/vulpes#24
No description provided.