[LED] Avoid gpio error message at start and fix led macro (#2017)
Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
1 parent
11ea8210a2
commit
068c2e457a
1 file changed
+37
-31
+37
-31
@@ -460,8 +460,8 @@ int lowpowermode = DEFAULT_LOW_POWER_MODE;
|
|||||||
# ifndef LED_ERROR_ON
|
# ifndef LED_ERROR_ON
|
||||||
# define LED_ERROR_ON HIGH
|
# define LED_ERROR_ON HIGH
|
||||||
# endif
|
# endif
|
||||||
# ifndef LED_ON_ON
|
# ifndef RGB_LED_ON_ON
|
||||||
# define LED_ON_ON HIGH
|
# define RGB_LED_ON_ON HIGH
|
||||||
# endif
|
# endif
|
||||||
# ifndef LED_INFO
|
# ifndef LED_INFO
|
||||||
# ifdef ESP8266
|
# ifdef ESP8266
|
||||||
@@ -473,10 +473,10 @@ int lowpowermode = DEFAULT_LOW_POWER_MODE;
|
|||||||
# ifndef LED_INFO_ON
|
# ifndef LED_INFO_ON
|
||||||
# define LED_INFO_ON HIGH
|
# define LED_INFO_ON HIGH
|
||||||
# endif
|
# endif
|
||||||
# ifdef LED_ON
|
# ifdef RGB_LED_ON
|
||||||
# define SetupIndicatorError() \
|
# define SetupIndicatorError() \
|
||||||
pinMode(LED_ON, OUTPUT);
|
pinMode(RGB_LED_ON, OUTPUT);
|
||||||
# define ONIndicatorON() digitalWrite(LED_ON, LED_ON_ON)
|
# define ONIndicatorON() digitalWrite(RGB_LED_ON, RGB_LED_ON_ON)
|
||||||
# else
|
# else
|
||||||
# define ONIndicatorON()
|
# define ONIndicatorON()
|
||||||
# endif
|
# endif
|
||||||
@@ -605,62 +605,68 @@ Adafruit_NeoPixel leds3(ANEOPIX_IND_NUM_LEDS, ANEOPIX_IND_DATA_GPIO3, ANEOPIX_IN
|
|||||||
# if !defined(ANEOPIX_IND_DATA_GPIO2) && !defined(ANEOPIX_IND_DATA_GPIO3)
|
# if !defined(ANEOPIX_IND_DATA_GPIO2) && !defined(ANEOPIX_IND_DATA_GPIO3)
|
||||||
// during boot the RGB LED is on to signal also reboots
|
// during boot the RGB LED is on to signal also reboots
|
||||||
# define SetupIndicators() \
|
# define SetupIndicators() \
|
||||||
|
if (RGB_LED_POWER > -1) { \
|
||||||
pinMode(RGB_LED_POWER, OUTPUT); \
|
pinMode(RGB_LED_POWER, OUTPUT); \
|
||||||
digitalWrite(RGB_LED_POWER, HIGH); \
|
digitalWrite(RGB_LED_POWER, HIGH); \
|
||||||
|
} \
|
||||||
leds.begin(); \
|
leds.begin(); \
|
||||||
leds.setPixelColor(ANEOPIX_INFO_LED, ANEOPIX_BOOT); \
|
leds.setPixelColor(ANEOPIX_INFO_LED, ANEOPIX_BOOT); \
|
||||||
leds.show();
|
leds.show();
|
||||||
# elif defined(ANEOPIX_IND_DATA_GPIO2) && !defined(ANEOPIX_IND_DATA_GPIO3)
|
# elif defined(ANEOPIX_IND_DATA_GPIO2) && !defined(ANEOPIX_IND_DATA_GPIO3)
|
||||||
# define SetupIndicators() \
|
# define SetupIndicators() \
|
||||||
|
if (RGB_LED_POWER > -1) { \
|
||||||
pinMode(RGB_LED_POWER, OUTPUT); \
|
pinMode(RGB_LED_POWER, OUTPUT); \
|
||||||
digitalWrite(RGB_LED_POWER, HIGH); \
|
digitalWrite(RGB_LED_POWER, HIGH); \
|
||||||
|
} \
|
||||||
leds.begin(); \
|
leds.begin(); \
|
||||||
leds2.begin();
|
leds2.begin();
|
||||||
# else
|
# else
|
||||||
# define SetupIndicators() \
|
# define SetupIndicators() \
|
||||||
|
if (RGB_LED_POWER > -1) { \
|
||||||
pinMode(RGB_LED_POWER, OUTPUT); \
|
pinMode(RGB_LED_POWER, OUTPUT); \
|
||||||
digitalWrite(RGB_LED_POWER, HIGH); \
|
digitalWrite(RGB_LED_POWER, HIGH); \
|
||||||
|
} \
|
||||||
leds.begin(); \
|
leds.begin(); \
|
||||||
leds2.begin(); \
|
leds2.begin(); \
|
||||||
leds3.begin();
|
leds3.begin();
|
||||||
# endif
|
# endif
|
||||||
# ifndef LED_ERROR
|
# ifndef RGB_LED_ERROR
|
||||||
# define LED_ERROR leds
|
# define RGB_LED_ERROR leds
|
||||||
# endif
|
# endif
|
||||||
# ifndef LED_SR
|
# ifndef RGB_LED_SR
|
||||||
# define LED_SR leds
|
# define RGB_LED_SR leds
|
||||||
# endif
|
# endif
|
||||||
# ifndef LED_INFO
|
# ifndef RGB_LED_INFO
|
||||||
# define LED_INFO leds
|
# define RGB_LED_INFO leds
|
||||||
# endif
|
# endif
|
||||||
# ifndef LED_ON
|
# ifndef RGB_LED_ON
|
||||||
# define LED_ON leds
|
# define RGB_LED_ON leds
|
||||||
# endif
|
# endif
|
||||||
# define ONIndicatorON() \
|
# define ONIndicatorON() \
|
||||||
LED_ON.setPixelColor(ANEOPIX_ON_LED, ANEOPIX_POWER); \
|
RGB_LED_ON.setPixelColor(ANEOPIX_ON_LED, ANEOPIX_POWER); \
|
||||||
LED_ON.setBrightness(SYSConfig.rgbbrightness); \
|
RGB_LED_ON.setBrightness(SYSConfig.rgbbrightness); \
|
||||||
LED_ON.show();
|
RGB_LED_ON.show();
|
||||||
# define ErrorIndicatorON() \
|
# define ErrorIndicatorON() \
|
||||||
LED_ERROR.setPixelColor(ANEOPIX_ERROR_LED, ANEOPIX_ERROR); \
|
RGB_LED_ERROR.setPixelColor(ANEOPIX_ERROR_LED, ANEOPIX_ERROR); \
|
||||||
LED_ERROR.setBrightness(SYSConfig.rgbbrightness); \
|
RGB_LED_ERROR.setBrightness(SYSConfig.rgbbrightness); \
|
||||||
LED_ERROR.show();
|
RGB_LED_ERROR.show();
|
||||||
# define ErrorIndicatorOFF() \
|
# define ErrorIndicatorOFF() \
|
||||||
LED_ERROR.setPixelColor(ANEOPIX_ERROR_LED, ANEOPIX_OFF); \
|
RGB_LED_ERROR.setPixelColor(ANEOPIX_ERROR_LED, ANEOPIX_OFF); \
|
||||||
LED_ERROR.show();
|
RGB_LED_ERROR.show();
|
||||||
# define SendReceiveIndicatorON() \
|
# define SendReceiveIndicatorON() \
|
||||||
LED_SR.setPixelColor(ANEOPIX_SEND_RECEIVE_LED, ANEOPIX_SENDRECEIVE); \
|
RGB_LED_SR.setPixelColor(ANEOPIX_SEND_RECEIVE_LED, ANEOPIX_SENDRECEIVE); \
|
||||||
LED_SR.setBrightness(SYSConfig.rgbbrightness); \
|
RGB_LED_SR.setBrightness(SYSConfig.rgbbrightness); \
|
||||||
LED_SR.show();
|
RGB_LED_SR.show();
|
||||||
# define SendReceiveIndicatorOFF() \
|
# define SendReceiveIndicatorOFF() \
|
||||||
LED_SR.setPixelColor(ANEOPIX_SEND_RECEIVE_LED, ANEOPIX_OFF); \
|
RGB_LED_SR.setPixelColor(ANEOPIX_SEND_RECEIVE_LED, ANEOPIX_OFF); \
|
||||||
LED_SR.show();
|
RGB_LED_SR.show();
|
||||||
# define InfoIndicatorON() \
|
# define InfoIndicatorON() \
|
||||||
LED_INFO.setPixelColor(ANEOPIX_INFO_LED, ANEOPIX_INFO); \
|
RGB_LED_INFO.setPixelColor(ANEOPIX_INFO_LED, ANEOPIX_INFO); \
|
||||||
LED_INFO.setBrightness(SYSConfig.rgbbrightness); \
|
RGB_LED_INFO.setBrightness(SYSConfig.rgbbrightness); \
|
||||||
LED_INFO.show();
|
RGB_LED_INFO.show();
|
||||||
# define InfoIndicatorOFF() \
|
# define InfoIndicatorOFF() \
|
||||||
LED_INFO.setPixelColor(ANEOPIX_INFO_LED, ANEOPIX_OFF); \
|
RGB_LED_INFO.setPixelColor(ANEOPIX_INFO_LED, ANEOPIX_OFF); \
|
||||||
LED_INFO.show();
|
RGB_LED_INFO.show();
|
||||||
# ifdef ANEOPIX_IND_DATA_GPIO2 // Used for relay power indicator
|
# ifdef ANEOPIX_IND_DATA_GPIO2 // Used for relay power indicator
|
||||||
// For the critical ON indicator there is no method to turn it off, the only way is to unplug the device
|
// For the critical ON indicator there is no method to turn it off, the only way is to unplug the device
|
||||||
// This enable to have persistence of the indicator to inform the user
|
// This enable to have persistence of the indicator to inform the user
|
||||||
|
|||||||
Reference in new issue
Block a user