Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RTClib] (Bugfix) Write month correctly to DS3231 (#3749) #3751

Merged

Conversation

tonhuisman
Copy link
Contributor

@tonhuisman tonhuisman commented Aug 7, 2021

After a report in the forum, then reported in the issue tracker.

Resolves #3749

@TD-er
Copy link
Member

TD-er commented Aug 7, 2021

Wasn't this something about the century bit also being stored in the month field?

@TD-er
Copy link
Member

TD-er commented Aug 7, 2021

Yep, looks like a messy copy/paste from me.

@TD-er TD-er merged commit a437d23 into letscontrolit:mega Aug 7, 2021
@tonhuisman tonhuisman deleted the bugfix/rtc-ds3231-write-month-correctly branch August 8, 2021 08:02
@uzi18
Copy link
Contributor

uzi18 commented Aug 8, 2021

@tonhuisman in fact it should be more like this:

RTCWireBus->_I2C_WRITE(bin2bcd(dt.month()) &0x7f | (dt.year()>=2000 ? 0x80 : 0x00)); // Need to add the century bit

@TD-er
Copy link
Member

TD-er commented Aug 8, 2021

@uzi18 I just realized it myself, so I went back to this PR to mention something similar.
I think in practice the value can simply have 0x80 added, as the year will always be past 2000 now... I think ;)

@uzi18
Copy link
Contributor

uzi18 commented Aug 8, 2021

Sure, it is :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The month is incorrectly read from the external time source DS3231
3 participants