m5stack/STAMP-C3

LED less brilliance - better for the eyes

Closed this issue · 2 comments

Hi, I don't know how your experience is with this example but for me the very high brilliance of the r, g and b values for the LED (for my eyes) are way too high. I almost cannot look into the light without getting blinded for a while.
To solve this I added some definitions for the value of brilliance set initially:
I added the following definitions (from line 41):

/* Added by @PaulskPt */
uint8_t brill_red = 0;     // Initial brilliance
uint8_t brill_green = 25;  // idem
uint8_t brill_blue = 25;   // idem
#define  brill  30       // inside main loop: max value for brilliance

Then I changed : update_led(0, 255, 200);
into:

    ESP_LOGI("Main", "Initial LED brilliance set to: r(%d), g(%d) and b(%d)", brill_red, brill_green, brill_blue); 
    update_led(brill_red, brill_green, brill_blue); 

and inside the loop of app_main():
instead of:

                int r = rand() % 256"
                int g = rand() % 256;
                int b = rand() % 256;

I changed into:

                int r = rand() % brill; 
                int g = rand() % brill;
                int b = rand() % brill;

Finally, below the line printing the MAC address, I added the following print line:

                ESP_LOGI("Main", "LED brilliance for r(%d), g(%d) and b(%d) maximum: %d", r, g, b, brill);

See the mods in my fork:

https://github.com/PaulskPt/STAMP-C3/blob/master/idf/RGB_LED_Control/main/main.c

Below the output of my fork. The last three lines with values of r, g and b are printed after pushing the center button.

2022-07-15_17h28_RGB_LED_Control_fork_PaulskPt

Below the current brilliance after a reset:

IMG_5765

Below the current brilliance during the loop:

IMG_5766

P.S.: times are utc+1

Thanks for your help, I have updated our example.