Addition of RGB-LED signalling for ESP32C3 boards

@1technophile @argafal: Argafal and I suffered from broken FastLED for the RGB LED on our boards, “Wemos Lolin C3 mini v2.1.0” and “Espressiv ESP32-C3-DevKitC-02”. We found a solution by adding code for the Adafruit NeoPixel library to OpenMQTTGateway main/User_config.h.
In principle I added a rewrite of the FastLED code for the new library. I have omitted support for ZactuatorONOFF though because I could not test it.
Then we realized that OMGs send/receive signals were very short on RGB LEDS and difficult to recognize. We tested colors and their intensities for visibility. The result was the addition of color schemes to the code. This also adds the possibility of adding standard OpenMQTTGateway colors. Another important addition was to make boot and reboots visible. The outcome was: info in green or blue, send/receive in bright gold, error red, boot bright aqua.
To access the Adafruit NeoPixel library add

  adafruit/Adafruit NeoPixel@^1.11.0

to the lib_deps and to the build_flags something like

  '-DANEOPIX_IND_DATA_GPIO=8'
  '-DANEOPIX_IND_NUM_LEDS=1'
 ; '-DANEOPIX_BRIGHTNESS=10'   ; 0 - 255, default 20
  '-DANEOPIX_COLOR_SCHEME=1'   ; blue based signalling colors
  '-DRGB_INDICATORS=2'         ; 2 = use Adafruit NeoPixel library

The addition has been thoroughly tested by us. You find the result in the rebase-wroom32c3 branch of my OpenMQTTGateway fork. Necessarily, the branch also includes new [env:esp32c3-dev-c2-ble] environments and a change to [env:lolin_c3_mini], all using the new ${com.esp32_platform}.

At long last: Is this acceptable for review and inclusion to OpenMQTTGateway code?

Hello,

Thanks for your tuning in and sharing this!

Do you thinkAdafruit NeoPixel could replace Fastled for the indicators ?

For reference, this was the discussion regarding the patch so far:

1 Like

Yes. I think for normal signalling of OpenMQTTGateway the Adafruit NeoPixel is better. FastLEDs choice of the right signalling mode and pin does not seem uptodate for newer processors. However, translating OMGs ZactuatorFASTLED looks a bit intimidating.
I left out signalling the second separate RGB LED which ZactuatorONOFF requires. If that is for the Theengs Plug it has to be included into the Adafruit NeoPixel code, and the original colors should to be the default ones. Let me give it a try.

1 Like

I have added the second separate LED and original indicator colors to the Adafruit NeoPixel code. In my neopixel-2leds branch you can have a look at a possible FastLED replacement of OpenMQTTGateway indicators. Admittedly color definitions have become quite verbose but remained readable and flexible. The code compiles and runs fine. Of course I could not test the second LED.

Thanks I will try it

@mrickma:
A small addition that might be neat: should the LED do something when one presses and holds the trigger button and resets the OMG configuration? One (or multiple) white flash(es) for example?

We could start that as a new project after Adafruit NeoPixel issues are resolved. It would include changes to real OMG code: define a WIFIReset indicator triggered from blockingWaitForReset() in main/main.ino.

@mrickma I gave your pull request a 24 hour test with my Lolin C3 mini. Your changes work fine. The LED is happily blinking and the ESP runs stable.

Looks pretty good to me, I will let it run on the plug for some days.
It will be a nice replacement.

My tests were good, feel free to submit a PR with the replacement of Fastled for indicators

Thank you for review and guidance during the PR. I am confident that it will help.

1 Like