Skip to content

Conversation

@SuperJonotron
Copy link

Added a birthday option where you can configure up to 4 birthdays (can be increased if necessary) to show a special icon set similar to leap years but instead just shows all cakes. I did my best to keep this as close to the current design and to not veer too far from the portal look and also keep the same style of everything is done from the config.h file. Here is how it looks with all the options.

An active birthday with the show year option:
birthday and year

An active birthday with the show age option (overwrites year):
birthday and age

An active birthday with the show age and name option (overwrites year and weekday):
birthday age and name

Back to normal the next day:
next day

Weather always shows normal as it does not care about birthdays:
weather and no year

_display->drawText(I18N_DAYS[now->tm_wday], FONT_MEDIUM, RIGHT, 394, DisplayGDEW075T7::TOP_RIGHT);
}
#endif
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Sorry I didn't review this earlier, I kinda took a break from this project. I don't really like the idea of replacing the day with this information because if they're doing a first + last name that could pretty easily overflow the amount of space available. Maybe this could be underneath the chamber icons using FONT_SMALL, and combined with the age in a format like "{name}, {age}"?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would also remove the need for the name to be in all caps, since FONT_SMALL contains the full set of uppercase and lowercase characters.

#include "localization.h"
#ifdef BIRTHDAYS
#include "birthday.h"
Birthday* activeBirthday = nullptr;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be a global

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this at this level so it would not import into the project unless defined in config to keep memory lower when not used. Where would you propose this import be moved? I can't move birthday.h into config so not sure where else but global this could be.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just talking about the declaration of activeBirthday, not the import. That variable is only used inside the update function so it can be local to that.

#define BIRTHDAY_1_MONTH 0
#define BIRTHDAY_1_DAY 0
#define BIRTHDAY_1_YEAR 0
#define BIRTHDAY_1_Name ""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize name on these just for consistency

* Define a struct objec to hold birthday data
*/
struct Birthday{
Birthday(){};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for trivial constructors, you can create structs with this syntax

Birthday birthday = {
    .month=1,
    .day=2,
    .year=2000,
    .name="name",
};

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to only the default constructor or the entire struct definition? The struct isn't in general trivial as it is reused for each birthday for reusability and repeated methods within it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the constructors, not the definition of the struct itself. That code I provided is a c++ syntax for struct instantiation. Both ways work but unless a struct's constructor is actually doing things other than just setting properties I prefer that syntax.

year = y;
name = n;
}
byte month=0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer uint8_t to byte

@xRealNeon
Copy link

Wouldn't it be cool if the birthdays can be fetched from a caldav server?

@SuperJonotron
Copy link
Author

Wouldn't it be cool if the birthdays can be fetched from a caldav server?

I had a similar thought but haven't gotten back to this. I made the modifications requested for this PR but didn't like how it looked so I kind of let it sit on the back burner. Since then, I've created a separate repo for this to add things that may not directly fit into this display concept. I should be able to finish this PR sometime this wek and add some calendar support, i.e. google calendar, ical and caldav later once the basic concept is accepted.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants