Skip to content

Byte for "week" in DS3231_SetTime is for day of the week, not week of the year #12

@zzjlamb

Description

@zzjlamb

I'm not sure if this code is still being maintained, but even if it isn't, this might be useful for other users.
The default NowTime for DS3231_SetTime has x28 for the "week" byte. This byte is actually the day of the week on the DS3231, not the week of the year. It is meant to have values from x01 to x07, with an arbitrary start of the week. If you choose to map the values to the more usual 0-6 system, with Sunday as 0 (like Javascript), then the value should be x04 (Wednesday 14 July 2021), not x28.
Most times it shouldn't matter as the DS3231 ignores the highest 4 bits and unless you are relying on the device for the day of the week, it won't affect the date and time readings.
I suggest that the byte be named "weekday" rather than "week" and the x28 be changed to x04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions