updated the clock to show special I LOVE YOU date messages
tweaked the LED strip for more stability
This commit is contained in:
@@ -100,7 +100,7 @@ class Clock
|
||||
|
||||
int calculateHours(struct tm time);
|
||||
|
||||
std::list<struct tm> specialList;
|
||||
std::list<struct tm> loveulist;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "esp_sntp.h"
|
||||
#include "esp_wifi.h"
|
||||
|
||||
#include "logger.h"
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
@@ -51,13 +52,26 @@
|
||||
|
||||
Clock::Clock(Mode_t mode)
|
||||
{
|
||||
specialList.clear();
|
||||
loveulist.clear();
|
||||
|
||||
// Add Angelas birthday as special day
|
||||
struct tm abirthday;
|
||||
abirthday.tm_mon = 12;
|
||||
abirthday.tm_mday = 7;
|
||||
specialList.push_back(abirthday);
|
||||
// Note: The MONTH field starts with 0, while the DAY field starts with 1
|
||||
// Add weddingday as special day
|
||||
struct tm weddingday;
|
||||
weddingday.tm_mon = 5;
|
||||
weddingday.tm_mday = 7;
|
||||
loveulist.push_back(weddingday);
|
||||
|
||||
// Add aniversary as special day
|
||||
struct tm anniversary;
|
||||
anniversary.tm_mon = 7;
|
||||
anniversary.tm_mday = 31;
|
||||
loveulist.push_back(anniversary);
|
||||
|
||||
// Add Valentines day
|
||||
struct tm valentine;
|
||||
valentine.tm_mon = 1;
|
||||
valentine.tm_mday = 14;
|
||||
loveulist.push_back(valentine);
|
||||
|
||||
currentTime = 40000;
|
||||
|
||||
@@ -185,6 +199,23 @@ void Clock::generateWordlist(std::list<std::string>* wordlist)
|
||||
}
|
||||
|
||||
// For special days, add the "i love you"
|
||||
// The message should be shown the whole day over, every 10 minutes for 1 minute
|
||||
std::list<struct tm>::iterator it;
|
||||
for (it = loveulist.begin(); it != loveulist.end(); it++)
|
||||
{
|
||||
// The day and the month must be equal with todays date
|
||||
if ((it->tm_mday == tm.tm_mday) && (it->tm_mon == tm.tm_mon))
|
||||
{
|
||||
// An entry matches todays date
|
||||
// Enable the text only every 10 minutes
|
||||
if ((tm.tm_min % 10) == 0)
|
||||
{
|
||||
wordlist->push_back("iloveyou");
|
||||
// Break out of the loop, an entry has already been found, another one does not add anything
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user