Skip to content

BUG: Setting month greater than 9 fails #4

@GianlucaLocri

Description

@GianlucaLocri

Hi, first of all thanks for this library!
I think I found a small bug in function ds3231_set_time at line 217.
The result of bin2bcd() is masked with 0x0F and as a result tens are removed.

I fixed by changing
raw_time[5] = bin2bcd(timeptr->tm_mon + DS3231_MONTHS_OFFSET) & DS3231_MONTHS_MASK;
to
raw_time[5] = bin2bcd(timeptr->tm_mon + DS3231_MONTHS_OFFSET);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions