-
Notifications
You must be signed in to change notification settings - Fork 91
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
Date and time with MJD and example usage #38
base: master
Are you sure you want to change the base?
Conversation
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.
The intention is welcome and a good extension. See my coments.
@@ -18,12 +18,14 @@ | |||
#define DEBUG_FUNC0(fn) { Serial.print(fn); Serial.println("()"); } | |||
|
|||
/// Setup the RDS object and initialize private variables to 0. | |||
RDSParser::RDSParser() { | |||
RDSParser::RDSParser() | |||
{ |
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.
Here and in other places re re-formatting should be reversed to focus on the changes.
int day; | ||
int year; | ||
}; | ||
|
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.
The MDJ structures and functions should be moved into RDSParser to be available is all sketches.
|
||
void getMJDInfo(uint32_t mjd, MJD_INFO *mjdInfo) | ||
{ | ||
int _year = (int)((mjd - 15078.2) / 365.25); |
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.
Please avoid floating-point arithmetic. I hope you find a pure integer based solution.
_year = _year + k + 1900; | ||
_month = _month - 1 - k * 12; | ||
|
||
long WD = (long)((mjd + 2) % 7) + 1; //modulo 7 | Day of the Week |
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.
WD is calculated by not used. can be removed or commented.
extern "C" { | ||
typedef void(*receiveServicenNameFunction)(char *name); | ||
typedef void(*receiveTextFunction)(char *name); | ||
typedef void(*receiveTimeFunction)(uint8_t hour, uint8_t minute); | ||
typedef void(*receiveTimeFunction)(uint8_t hour, uint8_t minute, uint32_t MJD, int8_t offset); |
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.
Pleas add a new callback function to not break compatibility.
No description provided.