Update 'dclock.ino'

This commit is contained in:
ivan 2021-03-13 21:47:39 +01:00
parent b96ca3f74d
commit 1bd9a30575
1 changed files with 10 additions and 8 deletions

View File

@ -21,15 +21,17 @@ float erisiansec; // Erisian second
// Custom settings:
int brightnessPercent = 32; // Display brightness percentage value
long timezoneOffset = (-28800); // Erisian timezoneOffset. Formula for calculating: ((-5 christian chours) - (GMT hours))
long timezoneOffset = (-28800); // Erisian timezoneOffset. Formula for calculating:
// ((-5 christian chours) - (GMT hours))
// Examples:
// GMT+3: ( (-5)-(+3) )*60*60 = -28800
// GMT-0: ( (-5)-(0) )*60*60 = -18000
// GMT-3: ( (-5)-(-3) )*60*60 = -7200
// GMT-5: ( (-5)-(-5) )*60*60 = 0
// GMT-7: ( (-5)-(-7) )*60*60 = 7200
// The beginning of Discordian day (0 hours, 0 minutes, 0 seconds) coincides
// with the beginning of Christian day on Easter Island on winter time (GMT-5).
// The beginning of Discordian day (0 hours, 0 minutes,
// 0 seconds) coincides with the beginning of Christian
// day on Easter Island on winter time (GMT-5).
// Details: https://discordia.fandom.com/wiki/Erisian_Time
void setup() {
@ -46,7 +48,7 @@ void setup() {
display.print("HAIL_EriS"); // Shows display initialization
}
pinMode(buttonPin, INPUT); // Button setting
// Main thread thread initialization:
// Main thread initialization:
mainThread.onRun(mainLoop);
mainThread.setInterval(mainCheck);
}
@ -157,16 +159,16 @@ void ddate() {
display.setColonOn(0);
if (viewMode == 2) {
if (m == 1 || m == 2) {
daynumber = days[(m - 1)] + d; // for any type of year, it calculate the number of days for January or February
daynumber = days[(m - 1)] + d; // for any type of year, it calculate the number of days for January or February
dday = daynumber;
dseason = 0;
} // Now, try to calculate for the other months
} // Now, try to calculate for the other months
else if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) { //those are the conditions to have a leap year
daynumber = days[(m - 1)] + d + 1; // if leap year, calculate in the same way but increasing one day
daynumber = days[(m - 1)] + d + 1; // if leap year, calculate in the same way but increasing one day
dday = (daynumber % 73) - 1;
dseason = (daynumber - 1) / 73;
}
else { // if not a leap year, calculate in the normal way, such as January or February
else { // if not a leap year, calculate in the normal way, such as January or February
daynumber = days[(m - 1)] + d;
dday = daynumber % 73;
dseason = daynumber / 73;