Added fading function to brigthness
This commit is contained in:
parent
c6acffd06f
commit
74eaed2ff5
2 changed files with 4 additions and 2 deletions
|
@ -91,6 +91,7 @@ public:
|
||||||
bool setBrightness(int brightness);
|
bool setBrightness(int brightness);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// matrix objects
|
// matrix objects
|
||||||
TaskHandle_t displayUpdateTask;
|
TaskHandle_t displayUpdateTask;
|
||||||
NeoPixelBrightnessBusGfx<NeoGrbFeature, Neo800KbpsMethod> *matrix;
|
NeoPixelBrightnessBusGfx<NeoGrbFeature, Neo800KbpsMethod> *matrix;
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
LedDisplayController *ledDisplayControllerGlobal = nullptr;
|
LedDisplayController *ledDisplayControllerGlobal = nullptr;
|
||||||
|
|
||||||
|
static const uint8_t StepsFade = 255;
|
||||||
|
static const float RFade = (StepsFade*log10(2))/log10(255);
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
// - Public functions -
|
// - Public functions -
|
||||||
|
@ -188,7 +189,7 @@ void LedDisplayController::disp_scroll_text()
|
||||||
void LedDisplayController::show_matrix(const char *text, int pos, const char *color)
|
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)));
|
//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->setTextColor(this->colorFromHex(String(color)));
|
||||||
this->matrix->setCursor(pos, 0);
|
this->matrix->setCursor(pos, 0);
|
||||||
this->matrix->print(text);
|
this->matrix->print(text);
|
||||||
|
|
Loading…
Reference in a new issue