Git Product home page Git Product logo

Comments (10)

SV-Zanshin avatar SV-Zanshin commented on June 12, 2024

I see what you mean; you've done the correct thing by setting the alarm state to FALSE in the SetAlarm() method.

Looking at my code for the method isAlarm(), I don't check whether or not that bit is set. And since the 2 bits for the alarms keep their old values, this results in the problem you see.

I'm going to make some changes to the isAlarm() method in the library. I don't have a DS3231M handy to test my logic, can you check to see if it is now working?

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 12, 2024

I've made the changes to the isAlarm() method. Can you add that to your code and see if that correctly resolves the alarm problem?

from ds3231m.

capitainekurck avatar capitainekurck commented on June 12, 2024

Hi,
I try the new version, there is a problem, now the alarm is fire on every test : if (isAlarm() ...
like the isAlarm() is always true even with the clearAlarm()

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 12, 2024

That's not good :(
I will look at the code again; it sounds like I've mixed up some && and || conditions...

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 12, 2024

OK, now I think I've done it correctly, I also simplified the logic to

uint8_t controlByte = readByte(DS3231M_CONTROL) & 0x02; // Mask out all but last 2 bits for ALM1&2
uint8_t statusByte = readByte(DS3231M_STATUS) & 0x02; // Mask out all but last 2 bits for ALM1&2

The last two bits of both variables contain corresponding bits for "active" and "alarmed", so "and"ing them together will give either 0 for no alarms, or 0,1 and 2 (11b, 10b, 01b) for the alarm that is set.

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 12, 2024

Sorry, I didn't want to close this until you confirm that it is working.

from ds3231m.

capitainekurck avatar capitainekurck commented on June 12, 2024

hi,

I will do more test but for the first test it seem to work 👍

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 12, 2024

Excellent news. I've rechecked the datasheet and my programming logic and can't find a mistake. But I'll wait for your further testing before you or I close the ticket.

from ds3231m.

capitainekurck avatar capitainekurck commented on June 12, 2024

Hello

All tests i made are OK, i think you can close the case.
regards

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 12, 2024

That's good news. I think I'll draft a new version that incorporates this fix.

from ds3231m.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.