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);
|
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_sntp.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
|
|
||||||
|
#include "logger.h"
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -51,13 +52,26 @@
|
|||||||
|
|
||||||
Clock::Clock(Mode_t mode)
|
Clock::Clock(Mode_t mode)
|
||||||
{
|
{
|
||||||
specialList.clear();
|
loveulist.clear();
|
||||||
|
|
||||||
// Add Angelas birthday as special day
|
// Note: The MONTH field starts with 0, while the DAY field starts with 1
|
||||||
struct tm abirthday;
|
// Add weddingday as special day
|
||||||
abirthday.tm_mon = 12;
|
struct tm weddingday;
|
||||||
abirthday.tm_mday = 7;
|
weddingday.tm_mon = 5;
|
||||||
specialList.push_back(abirthday);
|
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;
|
currentTime = 40000;
|
||||||
|
|
||||||
@@ -185,6 +199,23 @@ void Clock::generateWordlist(std::list<std::string>* wordlist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For special days, add the "i love you"
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -235,9 +235,10 @@ extern "C" void app_main(void)
|
|||||||
daywords.setColour(0x00, 0xFF, 0xFF);
|
daywords.setColour(0x00, 0xFF, 0xFF);
|
||||||
|
|
||||||
temperaturewordmap tempwords = temperaturewordmap(&matrix);
|
temperaturewordmap tempwords = temperaturewordmap(&matrix);
|
||||||
|
tempwords.setColour(0xA0, 0x00, 0xA0);
|
||||||
|
|
||||||
messagewordmap messagewords = messagewordmap(&matrix);
|
messagewordmap messagewords = messagewordmap(&matrix);
|
||||||
messagewords.setColour(0xC0, 0x00, 0xC0);
|
messagewords.setColour(0xA0, 0x00, 0x00);
|
||||||
|
|
||||||
|
|
||||||
for (int cnt = 0; cnt < 10; cnt++)
|
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);
|
clockwords.setWord(wordmap::Language_t::NL, *it, true);
|
||||||
daywords.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
|
// Get the temperature from sensor
|
||||||
@@ -316,7 +318,7 @@ extern "C" void app_main(void)
|
|||||||
runninglightIndex < (MATRIX_NMBR_COLUMS - 1) ? runninglightIndex++ : runninglightIndex = 0;
|
runninglightIndex < (MATRIX_NMBR_COLUMS - 1) ? runninglightIndex++ : runninglightIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vTaskDelay(1000);
|
vTaskDelay(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.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.resolution_hz = 10 * 1000 * 1000; // 10MHz
|
||||||
rmt_config.flags.with_dma = false; // whether to enable the DMA feature
|
rmt_config.flags.with_dma = false; // whether to enable the DMA feature
|
||||||
|
rmt_config.mem_block_symbols = 128;
|
||||||
#endif
|
#endif
|
||||||
ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip));
|
ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user