Add RGB Led management for errors, infos, and send receive events (#1320)

* Add RGB Led management for errors, infos, and send receive events

Add RGB led management for indicators, integrate it for M5 Atom and ESP32 C3 and S3 dev board
Update Fastled version to 3.5.0.

The default behavior is with regular LED, to use RGB Led the macro RGB_INDICATORS needs to be define, along with the FASTLED_IND_TYPE, FASTLED_IND_DATA_GPIO and FASTLED_IND_NUM_LEDS
Note that some RGB led need to have a different color scheme, so in this case it can be entered along with the data PIN definition: -DFASTLED_IND_DATA_GPIO=27,GRB

* Add FastLed library to the environments
This commit is contained in:
Florian authored and GitHub committed 2022-11-16 12:58:22 -06:00
1 parent 0099a579d2
commit 33e162111a
6 files changed
+155 -83

No files matched your search

+78 -38
View File
@@ -388,48 +388,88 @@ int lowpowermode = DEFAULT_LOW_POWER_MODE;
# define ota_timeout_millis 30000
#endif
#ifndef RGB_INDICATORS // Management of Errors, reception/emission and informations indicators with basic LED
/*-------------DEFINE PINs FOR STATUS LEDs----------------*/
#ifndef LED_SEND_RECEIVE
# ifdef ESP8266
# define LED_SEND_RECEIVE 40
# elif ESP32
# define LED_SEND_RECEIVE 40
# elif __AVR_ATmega2560__ //arduino mega
# define LED_SEND_RECEIVE 40
# else //arduino uno/nano
# define LED_SEND_RECEIVE 40
# ifndef LED_SEND_RECEIVE
# ifdef ESP8266
# define LED_SEND_RECEIVE 40
# elif ESP32
# define LED_SEND_RECEIVE 40
# elif __AVR_ATmega2560__ //arduino mega
# define LED_SEND_RECEIVE 40
# else //arduino uno/nano
# define LED_SEND_RECEIVE 40
# endif
# endif
#endif
#ifndef LED_SEND_RECEIVE_ON
# define LED_SEND_RECEIVE_ON HIGH
#endif
#ifndef LED_ERROR
# ifdef ESP8266
# define LED_ERROR 42
# elif ESP32
# define LED_ERROR 42
# elif __AVR_ATmega2560__ //arduino mega
# define LED_ERROR 42
# else //arduino uno/nano
# define LED_ERROR 42
# ifndef LED_SEND_RECEIVE_ON
# define LED_SEND_RECEIVE_ON HIGH
# endif
#endif
#ifndef LED_ERROR_ON
# define LED_ERROR_ON HIGH
#endif
#ifndef LED_INFO
# ifdef ESP8266
# define LED_INFO 44
# elif ESP32
# define LED_INFO 44
# elif __AVR_ATmega2560__ //arduino mega
# define LED_INFO 44
# else //arduino uno/nano
# define LED_INFO 44
# ifndef LED_ERROR
# ifdef ESP8266
# define LED_ERROR 42
# elif ESP32
# define LED_ERROR 42
# elif __AVR_ATmega2560__ //arduino mega
# define LED_ERROR 42
# else //arduino uno/nano
# define LED_ERROR 42
# endif
# endif
#endif
#ifndef LED_INFO_ON
# define LED_INFO_ON HIGH
# ifndef LED_ERROR_ON
# define LED_ERROR_ON HIGH
# endif
# ifndef LED_INFO
# ifdef ESP8266
# define LED_INFO 44
# elif ESP32
# define LED_INFO 44
# elif __AVR_ATmega2560__ //arduino mega
# define LED_INFO 44
# else //arduino uno/nano
# define LED_INFO 44
# endif
# endif
# ifndef LED_INFO_ON
# define LED_INFO_ON HIGH
# endif
# define SetupIndicators() \
pinMode(LED_SEND_RECEIVE, OUTPUT); \
pinMode(LED_INFO, OUTPUT); \
pinMode(LED_ERROR, OUTPUT); \
SendReceiveIndicatorOFF(); \
InfoIndicatorOFF(); \
ErrorIndicatorOFF();
# define ErrorIndicatorON() digitalWrite(LED_ERROR, LED_ERROR_ON)
# define ErrorIndicatorOFF() digitalWrite(LED_ERROR, !LED_ERROR_ON)
# define SendReceiveIndicatorON() digitalWrite(LED_SEND_RECEIVE, LED_SEND_RECEIVE_ON)
# define SendReceiveIndicatorOFF() digitalWrite(LED_SEND_RECEIVE, !LED_SEND_RECEIVE_ON)
# define InfoIndicatorON() digitalWrite(LED_INFO, LED_INFO_ON)
# define InfoIndicatorOFF() digitalWrite(LED_INFO, !LED_INFO_ON)
#else // Management of Errors, reception/emission and informations indicators with RGB LED
# include <FastLED.h>
CRGB leds[FASTLED_IND_NUM_LEDS];
# define SetupIndicators() \
FastLED.addLeds<FASTLED_IND_TYPE, FASTLED_IND_DATA_GPIO>(leds, FASTLED_IND_NUM_LEDS); \
FastLED.setBrightness(20); /* Error, warning and infos display management*/
# define ErrorIndicatorON() \
leds[0] = CRGB::Red; \
FastLED.show()
# define ErrorIndicatorOFF() \
leds[0] = CRGB::Black; \
FastLED.show()
# define SendReceiveIndicatorON() \
leds[0] = CRGB::Blue; \
FastLED.show()
# define SendReceiveIndicatorOFF() \
leds[0] = CRGB::Black; \
FastLED.show()
# define InfoIndicatorON() \
leds[0] = CRGB::Green; \
FastLED.show()
# define InfoIndicatorOFF() \
leds[0] = CRGB::Black; \
FastLED.show()
#endif
#ifdef ESP8266