-
Notifications
You must be signed in to change notification settings - Fork 0
Use custom datetime #9
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
Open
dbgen1
wants to merge
17
commits into
main
Choose a base branch
from
datetime_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Mikefly123 If you have time, I would love to get your feedback on this change as well! |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change makes it easier for developers to interact with the RV3028 driver in a number of ways by overhauling date/time setting. This PR does the following:
Adds custom basic classes for handling date and time, namely date, time, and datetime. The eventual goal is to add support for iso8601-formatted string parsing into these classes, to make it simple for users to set the time and date of the satellite. With the current changes, instead of having to create and pass arbitrary looking tuples for the date and time, users can create a date or time object.
In addition, the driver has been modified to no longer keep track of weekdays. Realistically, there is no case for our purposes where a weekday is needed, so removing the calculation and storing of weekdays removes some overhead.
Previously:
Now, this same functionality can be achieved with:
And planned for the future:
This system is more easily readable and understandable, and has better flexibility than before. It also performs error checking, accounts for year offsets and manages weekdays for the user automatically.
Testing
Future plans
Note
The initial goal of this PR was to use the adafruit_datetime library, but it turned out that was too heavy on memory usage for the RP2040 in conjunction with the satellite code. The custom datetime library is intended to strip away unneeded information like time zone info, timedeltas, and more.