Added the Matrix handling and clock/day wordmaps

Time and day display is functional again
This commit is contained in:
Matthias Mitscherlich
2024-03-21 16:39:20 +01:00
parent ac8505a157
commit 0fcd60ff57
17 changed files with 498 additions and 571 deletions
+132
View File
@@ -0,0 +1,132 @@
// --------------------------------------------------------------------------------------------------------------------
/// \file wordmap.cpp
/// \brief Description
// --------------------------------------------------------------------------------------------------------------------
//
// vbchaos software design
//
// --------------------------------------------------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2023 vbchaos
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Include files
// --------------------------------------------------------------------------------------------------------------------
#include <wordmap.h>
#include <algorithm>
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Type definitions
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// File-scope variables
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// Function definitions
// --------------------------------------------------------------------------------------------------------------------
wordmap::wordmap(ledmatrix* matrix)
{
wordmap::matrix = matrix;
wordmap::language = NL;
wordmap::red = 0xFF;
wordmap::green = 0xFF;
wordmap::blue = 0xFF;
}
bool wordmap::setWord(Language_t lang, std::string& identifier, bool value)
{
bool returnValue;
auto _compare = [&](struct word currentword)
{
if (identifier.compare(currentword.identifier) == 0)
{
return true;
}
else
{
return false;
}
};
// Create a list Iterator
std::list<struct word>::iterator it;
// Fetch the iterator of element with value 'the'
it = find_if(wordlist[lang].begin(), wordlist[lang].end(), _compare);
// Check if iterator points to end or not
if(it != wordlist[lang].end())
{
returnValue = true;
}
else
{
returnValue = false;
}
if (returnValue)
{
std::list<ledmatrix::coordinate>::iterator pixel;
for (pixel = it->pixels.begin(); pixel != it->pixels.end(); pixel++)
{
if (value)
{
matrix->setPixel(pixel->y, pixel->x, wordmap::red, wordmap::green, wordmap::blue);
}
else
{
matrix->setPixel(pixel->y, pixel->x, 0, 0, 0);
}
}
}
return returnValue;
}
bool wordmap::setColour(uint8_t red, uint8_t green, uint8_t blue)
{
bool returnValue = true;
wordmap::red = red;
wordmap::green = green;
wordmap::blue = blue;
return returnValue;
}
void wordmap::createList_NL(void)
{
// First, clear the list
wordlist[NL].clear();
}
void wordmap::createList_EN(void)
{
// First, clear the list
wordlist[EN].clear();
}