-
Notifications
You must be signed in to change notification settings - Fork 83
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
Optional clear flag in checkIfAlarm() / #9 #58
Conversation
…e Alarm, bool clearflag)
So... you're overloading the checkIfAlarm() function? Now there would be two versions, one with the boolean parameter and the other without it? I don't oppose this change. I'm asking the question to gather information for future documentation, because if we go this way then both of these similarly-named methods would need to be disclosed and their differences explained. Observations without any intent to criticize:
I mention the following solely for conversational purposes. I've thought about this same issue. The approach I considered was to separate and distinguish the two tasks that the function presently performs.
Then the two functions would be clearly different and more or less self-documenting:
|
Yes, that is absolutely correct. I overload the First, I wouldn't want to alter the existing method too much for it could break existing code. Your suggestion to separate the alarm check and the clear flag is surely an option, but this would break code, that relies on clearing the alarm flag in Second, checking the alarm without clearing the flag is actually not that uncommon. In particular, in interrupting code, you usually want to respond to one alarm uninterrupted until all your alarm logic is completed and then clear the flag. In fact, the I hope this explains my design decisions. Best regards, |
I understand. As you wish. Thank you. We could avoid breaking old code while adding the two, distinctly named functions to the Library for the benefit of clarity in future code. Leave the |
Overloading seems to me a good solution to keep backwards compatibility while adding the requested more limited scope of the function. |
A note to @jnuernberg: It seems that your local commits are not linked with your GitHub account, and therefore the system is not noting your contributions to the repository. If this is important to you, please link these, and I will try to retroactively apply this. In this way, your name will appear when generating doi-labeled releases via GitHub + Zenodo. |
Hi @awickert, thanks for pointing that out. I had my global configs changed lately for demonstration purposes an apparantly didn't change them back. |
This PR tackles the challanges brought up in issue #9 by adding an addition method
checkIfAlarm
to the DS3231 class, that makes clearing the alarm flags optional.Summary:
bool DS3231::checkIfAlarm(byte Alarm, bool clearflag)
AlarmPolling.ino
to test said method and provide an example for polling alarm codeWith this PR, we may close #9.
Best regards,
Jacob