Closed HHH-01 closed 5 years ago
Looking into the possible causes of this problem
When the library sets the weekday, it cleared the OSCRUN, VBATEN and PWRFAIL register bits which caused the error. The fix is to only set the 3 relevant bits for the DOW and leave the rest of the register unchanged. Good catch!
The adjust() function resets the RTCWDAY, PWRFAIL bit and VBATEN bit somehow; this function should only affect the WDAY2-WDAY0 bits?
So if you use a backup battery and multiple adjust() functions in the main loop, the battery will be disabled whenever you call the adjust() function moving forward.