This question is basically about a programmable clock with a RTC DS3231 i'm making on a project thru screen and encoder, and yeah, i can set it and it gets applied, but since i like to adjust the time using compile time (DATE and TIME), when i hit reset to check if it persists, it applies the last compile time, erasing the time i set previously.
(The entire project code is huge) The RTC setup void is basically this:
(...)
//This goes before setup()
/* RTC */
#include <Wire.h>
#include "Adafruit_BusIO_Register.h"
#include "RTClib.h"
RTC_DS3231 rtc;
//time values
int mins, hh, dd, mm, yy;
(...)
void rtcsetup() //This gets called on setup(), like a normal piece of code
{
rtc.begin();
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
(...)
I was thinking about something that could tell when compile time has changed or not, something like this?)
void rtcsetup()
{
rtc.begin();
if(__DATE__ || __TIME__){rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));}
else;
}
Of course it doesn't work, but that was an idea i had, maybe using the eeprom to save at least the minute of the compile time, and compare if it has changed everytime arduino starts?