From 46b24fec9a20ec61713b1a06bfdd0b431a98b442 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 17 Jul 2023 18:56:30 -0700 Subject: [PATCH] Dirty on Luminance change (#727) --- src/NeoPixelBusLg.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/NeoPixelBusLg.h b/src/NeoPixelBusLg.h index c27b0f8..9afaeee 100644 --- a/src/NeoPixelBusLg.h +++ b/src/NeoPixelBusLg.h @@ -74,9 +74,16 @@ public: protected: uint8_t _luminance; - void setLuminance(uint8_t luminance) + bool setLuminance(uint8_t luminance) { - _luminance = luminance; + bool different = (_luminance != luminance); + + if (different) + { + _luminance = luminance; + } + + return different; } uint8_t getLuminance() const @@ -135,7 +142,10 @@ public: // does NOT affect current pixel data as there is no safe way // to reconstruct the original color values after being // modified with both luminance and gamma without storing them - Shader.setLuminance(luminance); + if (Shader.setLuminance(luminance)) + { + this->Dirty(); + } } uint8_t GetLuminance() const