-
Notifications
You must be signed in to change notification settings - Fork 39
Improved RTC Functionality #170
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
Conversation
@adamgarbo I just want to chime in and let you know this PR is not forgotten - we will get to it as soon as we can :D |
Looks like good stuff @adamgarbo. Changing the parameters order of setTime() is not backwards-compatible with anyone (me!) who has written custom code, although it does make more sense. Can I suggest the new version of the function is called "setTimeA()" or something to differentiate it. |
Thanks @oclyke! Let me know if there's anything I can do to help! Cheers, |
I'm reviewing right now - about ready to merge. So far the only bother I have is @stephenf7072's comment about backward compatibility of the I do prefer the new order of setTime parameters. Perhaps we can keep the functional changes in this PR and separate the API changes into a new PR that I will bring in along with v2.0.0? @adamgarbo would you be willing to commit changes that (somehow) revert the API back to its original state? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good. Formatting changes to examples are acceptable. Requesting that the setTime API change is undone in this PR and moved to a separate PR for v2.0.0
Just a note - I'm not sure why the test compile jobs are failing. I tried compilation on my local machine and it worked fine. Now that I am more familiar with GitHub actions I may investigate further. |
Hi @oclyke, Thanks for getting to this! I'm happy to revert the order of the setTime parameters until the v2.0.0 release. I will try to get to this soon, as I'll need to change all the examples that make use of the new setTime parameter ordering. What are your thoughts on the order of the setAlarm parameters? Should they be left as such (i.e. hund, ss, mm, hh, dd, mm), or changed to match setTime (hh, mm, ss, hund, dd, mm)? Cheers, |
Let's match them for this release and then change both APIs at once in v2.0.0 It seems most intuitive that the two would match. I'll see if I can't help with the examples. |
In v1.x.x we are using (hh, mm, ss, hund, dom, mon, year) Planning to change api in v2.0.0 to (hund, mm, ss, hh, dom, mon, year)
I've changed setAlarm to match setTime and updated the examples. All compile. I'd appreciate a second pair of eyes for testing to ensure that the examples are accurate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed some odd behavior - before my latest commit Example3 was broken. This turned out to be due to unclear logic but it was harder to diagnose because For example:
prints but
prints Is there a reason for this? Or can we change |
Hi Owen, Based on my experiences with a number RTC libraries, I've found that it's actually a common behaviour to need to manually poll/update the RTC before executing a print statement. That being said, I don't see any reason why we couldn't include the bulk of the I think one of the reasons for this behaviour is due to the fact we're using the HAL as a middleman to write to the RTC registers. Cheers, |
…Time This allows the user to immediately access correct internal values (myRTC.weekday, myRTC.minute, etc...) ``` myRTC.setTime(23, 59, 59, 99, myRTC.dayOfMonth, myRTC.month, myRTC.year); previousDay = myRTC.weekday; ``` Updated Example3 to make use of this feature
This allows the user to see that the alarm fired 'exactly' when they wanted it to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all great, thanks @adamgarbo!
Hi @nseidle,
Happy to finally submit my Artemis RTC functionality improvements! I've attempted to address all of your comments from the related SparkFun forum post.
Notable changes:
Added functions:
Note that I've changed the order of date/time values for setTime() from:
hh, mm, ss, hund, dd, mm, yy
to:
hund, ss, mm, hh, dd, mm, yy
I believe this is a more intuitive way to set the RTC time, and is also in line with the majority of other SparkFun RTC libraries (e.g. RV1805, RV8803, DS1307, DS3234, etc.). However, glad to get your thoughts on this. As far as I’m aware, this will only break code in the OpenLog Artemis repositories (both OLA and Paul’s GNSS logger). However, these are a minor fixes that I can submit PRs for.
I also created a number of examples to demonstrate the added functionality. I attempted to keep them as simple as possible and included more explanatory information in the comment section.
Examples:
All code was tested using a SparkFun Redboard Artemis, as well as an Edge 2 to confirm the sleep current draw in Example 6.
Happy to address any major/minor concerns!
Cheers,
Adam