Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

getSurreal
Copy link

No description provided.

Copy link
Owner

@mathertel mathertel left a 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()
{
Copy link
Owner

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;
};

Copy link
Owner

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);
Copy link
Owner

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
Copy link
Owner

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);
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants