Added fading function to brigthness

This commit is contained in:
Jens Noack 2020-10-18 15:56:43 +02:00
parent c6acffd06f
commit 74eaed2ff5
2 changed files with 4 additions and 2 deletions

View file

@ -91,6 +91,7 @@ public:
bool setBrightness(int brightness);
private:
// matrix objects
TaskHandle_t displayUpdateTask;
NeoPixelBrightnessBusGfx<NeoGrbFeature, Neo800KbpsMethod> *matrix;

View file

@ -2,7 +2,8 @@
LedDisplayController *ledDisplayControllerGlobal = nullptr;
static const uint8_t StepsFade = 255;
static const float RFade = (StepsFade*log10(2))/log10(255);
// --------------------
// - Public functions -
@ -188,7 +189,7 @@ void LedDisplayController::disp_scroll_text()
void LedDisplayController::show_matrix(const char *text, int pos, const char *color)
{
//Serial.printf("TEXT: %s (pos=%d, color=%d)\n", text, pos, this->colorFromHex(String(color)));
this->matrix->SetBrightness(this->text_sets.disp_brightness);
this->matrix->SetBrightness(pow (2, (this->text_sets.disp_brightness / RFade)) - 1);
this->matrix->setTextColor(this->colorFromHex(String(color)));
this->matrix->setCursor(pos, 0);
this->matrix->print(text);