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;
}

View File

@@ -77,7 +77,6 @@ class MatrixDisplayUi
private:
FastLED_NeoMatrix *matrix;
// Values for the Apps
AnimationDirection appAnimationDirection = SLIDE_DOWN;
int8_t lastTransitionDirection = 1;
@@ -102,6 +101,12 @@ private:
// Bookeeping for update
uint8_t updateInterval = 33;
uint16_t indicator1Color = 63488;
uint16_t indicator2Color = 31;
bool indicator1State = false;
bool indicator2State = false;
uint8_t getnextAppNumber();
void drawApp();
void drawOverlays();
@@ -148,6 +153,10 @@ public:
*/
void setTimePerTransition(uint16_t time);
void setIndicator1(bool state, uint16_t color);
void setIndicator2(bool state, uint16_t color);
void drawIndicators();
// Customize indicator position and style
// App settings