Integrate RTC chip #16
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "add-rtc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
To keep track of time while the ESP32 is unpowered, add a DS3231 RTC chip with its own battery.
Update the time automatically when the webform is submitted.
I have the RTC module talking to the ESP32 and a way to fill in the unix timestamp in the webform, but the timestamp is from when the page was loaded, not when it was submitted.
I think we can do time with
onsubmit
: https://stackoverflow.com/a/33102497/2152245Trying to convert from string to long, it should work with new build flag but it's not.
I thought the issue was string conversion, but what has been causing the crash is
rtc.adjust(DateTime();
, no matter what value is in it (or empty).Functions in RTClib I can use: https://adafruit.github.io/RTClib/html/class_r_t_c___d_s3231.html
Calling RTClib as a dependency as the GitHub url in
platformio.ini
file. It is a newer version (2.1.2) than the library in PlatformIO/VSCode.That seems to work.
why does it seem like webform files are being written twice? Javascript?not doing it anymoreThis makes it crash:
rtc.now().toString("DDD, DD MMM YYYY hh:mm:ss");
Had to use
rtc.now().timestamp()
to get string rather than char. 🙄