add Indicators

This commit is contained in:
Stephan Mühl
2023-04-10 13:02:20 +02:00
parent 04a2382ec5
commit c5c10f4d17
8 changed files with 159 additions and 19 deletions

View File

@@ -30,8 +30,8 @@
#include "MatrixDisplayUi.h"
#include "Fonts/AwtrixFont.h"
GifPlayer gif1;
GifPlayer gif2;
GifPlayer gif1;
GifPlayer gif2;
MatrixDisplayUi::MatrixDisplayUi(FastLED_NeoMatrix *matrix)
{
@@ -223,11 +223,28 @@ void MatrixDisplayUi::tick()
}
this->matrix->clear();
if (this->AppCount > 0)
this->drawApp();
this->drawOverlays();
this->drawIndicators();
this->matrix->show();
}
void MatrixDisplayUi::drawIndicators()
{
if (indicator1State)
{
matrix->drawPixel(31, 0, indicator1Color);
matrix->drawPixel(30, 0, indicator1Color);
matrix->drawPixel(31, 1, indicator1Color);
}
if (indicator2State)
{
matrix->drawPixel(31, 7, indicator2Color);
matrix->drawPixel(31, 6, indicator2Color);
matrix->drawPixel(30, 7, indicator2Color);
}
}
void MatrixDisplayUi::drawApp()
{
@@ -293,3 +310,17 @@ uint8_t MatrixDisplayUi::getnextAppNumber()
return this->nextAppNumber;
return (this->state.currentApp + this->AppCount + this->state.appTransitionDirection) % this->AppCount;
}
void MatrixDisplayUi::setIndicator1(bool state, uint16_t color)
{
this->indicator1State = state;
if (color > 0)
this->indicator1Color = color;
}
void MatrixDisplayUi::setIndicator2(bool state, uint16_t color)
{
this->indicator2State = state;
if (color > 0)
this->indicator2Color = color;
}