diff --git a/code/main/application/inc/clock.h b/code/main/application/inc/clock.h index 6c48194..11a82f6 100644 --- a/code/main/application/inc/clock.h +++ b/code/main/application/inc/clock.h @@ -100,7 +100,7 @@ class Clock int calculateHours(struct tm time); - std::list specialList; + std::list loveulist; }; diff --git a/code/main/application/src/clock.cpp b/code/main/application/src/clock.cpp index 31f164c..e70b35c 100644 --- a/code/main/application/src/clock.cpp +++ b/code/main/application/src/clock.cpp @@ -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* 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::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; + } + } + } } diff --git a/code/main/main.cpp b/code/main/main.cpp index 8db48f8..81b431f 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -235,9 +235,10 @@ extern "C" void app_main(void) daywords.setColour(0x00, 0xFF, 0xFF); temperaturewordmap tempwords = temperaturewordmap(&matrix); + tempwords.setColour(0xA0, 0x00, 0xA0); messagewordmap messagewords = messagewordmap(&matrix); - messagewords.setColour(0xC0, 0x00, 0xC0); + messagewords.setColour(0xA0, 0x00, 0x00); for (int cnt = 0; cnt < 10; cnt++) @@ -283,6 +284,7 @@ extern "C" void app_main(void) { clockwords.setWord(wordmap::Language_t::NL, *it, true); daywords.setWord(wordmap::Language_t::NL, *it, true); + messagewords.setWord(wordmap::Language_t::NL, *it, true); } // Get the temperature from sensor @@ -316,7 +318,7 @@ extern "C" void app_main(void) runninglightIndex < (MATRIX_NMBR_COLUMS - 1) ? runninglightIndex++ : runninglightIndex = 0; } } - vTaskDelay(1000); + vTaskDelay(100); } } diff --git a/code/main/platform/src/prgm_ledstrip.cpp b/code/main/platform/src/prgm_ledstrip.cpp index 91ff1a0..2f8c881 100644 --- a/code/main/platform/src/prgm_ledstrip.cpp +++ b/code/main/platform/src/prgm_ledstrip.cpp @@ -67,6 +67,7 @@ prgm_ledstrip::prgm_ledstrip(uint32_t numberOfLEDs, uint32_t gpio) : numberOfLED rmt_config.clk_src = RMT_CLK_SRC_DEFAULT; // different clock source can lead to different power consumption rmt_config.resolution_hz = 10 * 1000 * 1000; // 10MHz rmt_config.flags.with_dma = false; // whether to enable the DMA feature + rmt_config.mem_block_symbols = 128; #endif ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip)); }