indicator blink

This commit is contained in:
Stephan Mühl
2023-04-10 14:59:48 +02:00
parent 1447547e42
commit 73c18fbb9e
4 changed files with 67 additions and 11 deletions

View File

@@ -230,15 +230,30 @@ void MatrixDisplayUi::tick()
this->drawIndicators();
this->matrix->show();
}
void MatrixDisplayUi::drawIndicators()
{
if (indicator1State)
if (indicator1State && !indicator1Blink)
{
matrix->drawPixel(31, 0, indicator1Color);
matrix->drawPixel(30, 0, indicator1Color);
matrix->drawPixel(31, 1, indicator1Color);
}
if (indicator2State)
if (indicator2State && !indicator2Blink)
{
matrix->drawPixel(31, 7, indicator2Color);
matrix->drawPixel(31, 6, indicator2Color);
matrix->drawPixel(30, 7, indicator2Color);
}
if (indicator1State && indicator1Blink && (millis() % 1000) < 500)
{
matrix->drawPixel(31, 0, indicator1Color);
matrix->drawPixel(30, 0, indicator1Color);
matrix->drawPixel(31, 1, indicator1Color);
}
if (indicator2State && indicator2Blink && (millis() % 1000) < 500)
{
matrix->drawPixel(31, 7, indicator2Color);
matrix->drawPixel(31, 6, indicator2Color);
@@ -313,7 +328,7 @@ uint8_t MatrixDisplayUi::getnextAppNumber()
void MatrixDisplayUi::setIndicator1Color(uint16_t color)
{
this->indicator1Color = color;
this->indicator1Color = color;
}
void MatrixDisplayUi::setIndicator1State(bool state)
@@ -323,10 +338,20 @@ void MatrixDisplayUi::setIndicator1State(bool state)
void MatrixDisplayUi::setIndicator2Color(uint16_t color)
{
this->indicator2Color = color;
this->indicator2Color = color;
}
void MatrixDisplayUi::setIndicator2State(bool state)
{
this->indicator2State = state;
}
void MatrixDisplayUi::setIndicator1Blink(bool blink)
{
this->indicator1Blink = blink;
}
void MatrixDisplayUi::setIndicator2Blink(bool blink)
{
this->indicator2Blink = blink;
}

View File

@@ -106,6 +106,8 @@ private:
bool indicator1State = false;
bool indicator2State = false;
bool indicator1Blink = false;
bool indicator2Blink = false;
uint8_t getnextAppNumber();
void drawApp();
@@ -158,6 +160,9 @@ public:
void setIndicator2Color(uint16_t color);
void setIndicator2State(bool state);
void setIndicator1Blink(bool Blink);
void setIndicator2Blink(bool Blink);
void drawIndicators();
// Customize indicator position and style