Hello, I have been trying for a few days now to get time triggered events to work. Using localtimeiinfo, I am able to get the time to trigger, but it triggers every millisecond. I am not sure how to proceed with fixing this. I am attaching my sketch, This is not all my work, upon aproval from the author, I have been tasked with adding new features and if they work he will implement them into master. Anyways, I hope someone can assist me. Maybe im missing something obvious?
Error log from time trigger. Note: Device crashes and reboots.
is_https_Heroku 0
JSON query NSurl = 'https://api/v1/entries.json'
http.begin OK
Returning with error -1 after 46 ms :-(
connection refused
Battery 4.17 V = 100%
Local time: 12:44:29 DST 0
Sensor time difference = 1634147069 sec
Glyk: 0.0
Last 10 values: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Alarm time difference = 66 sec
Snooze time remaining = 0 sec, Snooze until 0
WARNING NO READINGS
Battery 4.17 V = 100%
Local time: 12:44:44 DST 0
Sensor time difference = 1634147084 sec
Glyk: 0.0
Last 10 values: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Alarm time difference = 81 sec
Snooze time remaining = 0 sec, Snooze until 0
WARNING NO READINGS
Battery 4.17 V = 100%
Local time: 12:44:59 DST 0
Sensor time difference = 1634147099 sec
Glyk: 0.0
Last 10 values: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Alarm time difference = 96 sec
Snooze time remaining = 0 sec, Snooze until 0
WARNING NO READINGS
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
Entered playWAV
volumeGain:2.34
AudioGeneratorWAV::begin: file not open
ntry 0x400806a8
REBOOT
�M5Core2 initializing...axp: vbus limit off
axp: gpio1 init
axp: gpio2 init
axp: rtc battery charging enabled
axp: esp32 power voltage was set to 3.35v
axp: lcd backlight voltage was set to 2.80v
axp: lcd logic and sdcard voltage preset to 3.3v
axp: vibrator voltage preset to 2v
touch: FT6336 ready (fw id 0x10 rel 1, lib 0x300E)
OK
E (1502) SPIFFS: mount failed, -10025
M5Stack CORE2 code starting
Free Heap: 236320
SD Card Type: SDHC
SD Card Size: 15193 MB
Ini file exists
section 'config' has an entry 'nightscout' with value
section 'config' has an entry 'token' with value
bootpic =
name = dev_unit
You might be doing this already (4000 lines of code is too much to dig through) but the usual way is to keep track if something is done; below just as an example.
It's highly advisable to start splitting your code over more functions. A function should basically fit on a sheet of A4. And in the next step split your code over multiple files.
This basically indicates a design flaw; it will also make your code very difficult to follow; again, more functions.
Thank you, I will definetly try that example. Yes I know the code is messy, the original author left a mess. I'm trying to clean up but it breaks a lot.
Even with this its calling the file multiple times. I cant figure out why.
d.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (88960) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89031) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89102) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89173) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89244) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89315) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89386) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89457) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89528) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
AudioGeneratorWAV::begin: file not open
E (89599) vfs_fat: open: no free file descriptors
/wav/warningsound.wav
volumeGain:3.51
The errors do not indicate that triggering of events is not working. It seems the event trigger works just fine and the error is with opening the file.
That may not be a very good way of doing it, sorry. (and yes I just put a second statement in this morning) decided to try helloworld print instead of crashing the device every time.
On an ESP32 millis() is just a function. An ESP32 uses several cycle timers, one cycle timer is a micros timer instead of a millis() timer. If you have hardware timers setup on the ESP32 they are completely separate from the cycle timers.
Code snippets are hard to troubleshoot. Yea, I know 100000 of millions of lines of code your project is. Only you know your codes interactions.