Updated the matrix to the real size

Fixed orientation missings
added the temperature wordmap
This commit is contained in:
Matthias Mitscherlich
2023-11-25 15:24:51 +01:00
parent edeaedeb07
commit 7c2b0d8d24
17 changed files with 723 additions and 48 deletions
+65 -16
View File
@@ -43,6 +43,9 @@
#include "clock.h"
#include "clockwordmap.h"
#include "daywordmap.h"
#include "temperaturewordmap.h"
#include "temperature.h"
// --------------------------------------------------------------------------------------------------------------------
@@ -80,11 +83,11 @@ static rmt_encoder_handle_t led_encoder = NULL;
static LEDMatrix_Parameters_t ledmatrix_parameters =
{
LEDMATRIX_ORIENTATION_ROW_RIGHT_LEFT,
LEDMATRIX_ORIENTATION_ROW_LEFT_RIGHT,
LEDMATRIX_ORIENTATION_COLUM_UP_DOWN,
LEDMATRIX_ORIENTATION_COLUM,
11,
10,
LEDMATRIX_ORIENTATION_ROW,
20,
13,
&led_chan,
&led_encoder,
&tx_config
@@ -93,6 +96,8 @@ static LEDMatrix_Parameters_t ledmatrix_parameters =
static LEDMatrix matrix(&ledmatrix_parameters);
static ClockWordmap clockWordmap(&matrix);
static DayWordmap dayWordmap(&matrix);
static TemperatureWordmap tempWordmap(&matrix);
static gptimer_handle_t matrixRefreshTimer = NULL;
@@ -209,6 +214,8 @@ extern "C" void app_main(void)
// Set the sensor to NORMAL mode
bmp280.setSensorMode(BMP280::BMP280_Mode_t::NORMAL);
Temperature temperature;
//--------------------------------------------
// LED Matrix
//
@@ -255,28 +262,49 @@ extern "C" void app_main(void)
Clock clock(Clock::mode::TEN_BEFORE_HALF);
countdown(200);
clockWordmap.setColour(0xFF, 0x00, 0xFF);
dayWordmap.setColour(0x20, 0xFF, 0x80);
tempWordmap.setColour(0x40, 0x40, 0xFF);
list<string> wordlist;
countdown(1000);
list<string> clockWordlist;
list<string> tempWordList;
while (true)
{
clock.generateWordlist(&wordlist);
clock.generateWordlist(&clockWordlist);
matrix.clear();
std::list<string>::iterator it;
for(it = wordlist.begin(); it != wordlist.end(); it++)
for(it = clockWordlist.begin(); it != clockWordlist.end(); it++)
{
clockWordmap.setWord(Wordmap::Language_t::NL, *it, true);
dayWordmap.setWord(Wordmap::Language_t::NL, *it, true);
}
// Get the temperature from sensor
int currentTemperature = bmp280.getTemperature();
currentTemperature = 19;
// LOGGER_INFO("The current temperature is: %i", temperature);
// Generate temperature wordlist
temperature.generateWordlist(currentTemperature, &tempWordList);
for(it = tempWordList.begin(); it != tempWordList.end(); it++)
{
tempWordmap.setWord(Wordmap::Language_t::NL, *it, true);
}
// Add a seconds indicator
matrix.setPixelValue(10, 9, clock.getTime() % 2);
matrix.setPixelValue(11, 11, clock.getTime() % 2);
// Update the matrix
matrix.tick();
// Update the clock every second (1000 ms)
vTaskDelay(1000);
}
}
@@ -296,22 +324,43 @@ static void devTask(void* parameters)
static void colourMapTask(void* parameters)
{
uint8_t red = 0x10;
uint8_t green = 0;
uint8_t blue = 0x04;
uint8_t red = 0xF0;
uint8_t green = 0x20;
uint8_t blue = 0xF0;
// uint8_t red = 0x00;
// uint8_t green = 0x00;
// uint8_t blue = 0x00;
uint32_t counter = 0;
while (true)
{
matrix.setGlobalColour(red, green, blue);
// red = 0;
// green = 0;
// blue = 0;
// if ((counter % 2) == 0)
// {
// red = 0xFF;
// }
// if ((counter % 5) == 0)
// {
// green = 0xFF;
// }
// if ((counter % 9) == 0)
// {
// blue = 0xFF;
// }
// matrix.setGlobalColour(red, green, blue);
// red = counter & 0xFF;
// green = (counter >> 8) & 0xFF;
// blue = (counter >> 16) & 0xFF;
// counter++;
vTaskDelay(30);
counter++;
vTaskDelay(200);
}
}
@@ -354,7 +403,7 @@ static bool IRAM_ATTR timerCallback(gptimer_handle_t timer, const gptimer_alarm_
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xHigherPriorityTaskWoken = matrix.tick();
// xHigherPriorityTaskWoken = matrix.tick();
return xHigherPriorityTaskWoken == pdTRUE;
}