You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just know the basics in python but from toying with the size of the variable bytes_l in the function write_datetime I saw a few things.
So I am speaking about this
bytes_l = [0] * 9
If you multiplie by anything equals or below 6 you will experience index out of range exception.
With 7 or 8, the seconds seems to be saved (you trigger the if condition with the time difference between write and read).
With 9 you do not write the seconds.
With 10 you do not write the minutes and the seconds.
With 11 you do not write the hours, the minutes and the seconds.
With 12 you do not write the days, the hours, the minutes and the seconds.
With 13 you do not write the months, the days, the hours, the minutes and the seconds.
With 14 only the year is written.
With 15 and above the following is written "2000 0 0 0 0 0".
So by setting the multiplier to 7 or 8 you should trigger the if condition.
i use ds1302_set_utc to set the datetime, usually get the message:
unable to set RTC time
so i checked the code, found this clause cannot fullfill
-2 < (dt_write - dt_read).total_seconds() < +2
so after i call rtc.write_datetime(dt_write), then read time out
dt_read = rtc.read_datetime(), always get the seconds begin from 0.
The text was updated successfully, but these errors were encountered: