diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index 03df3d6..ee06621 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -427,6 +427,10 @@ void setup() { } #endif +#if defined(POWER_SUPPLY) + pinMode(POWER_SUPPLY, OUTPUT); // output to control external power supply +#endif + // start ticker with 0.5 because we start in AP mode and try to connect ticker.attach(0.5, tick); @@ -776,8 +780,17 @@ void loop() { #if defined(ENABLE_MQTT) if (prevmode != mode) { snprintf(mqtt_buf, sizeof(mqtt_buf), "OK =off", ""); } #endif + #if defined(POWER_SUPPLY) + if (prevmode != mode) {digitalWrite(POWER_SUPPLY, LOW); } // power off -> external power supply + #endif } +#if defined(POWER_SUPPLY) + if (mode != OFF) { + if (prevmode != mode) {digitalWrite(POWER_SUPPLY, HIGH); } // power on -> external power supply + } +#endif + if (mode == AUTO) { if (prevmode != mode) { handleAutoStart(); diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index 91cb4ed..f47c0a8 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -12,6 +12,7 @@ #define FX_OPTIONS 48 // ws2812fx Options 48 = SIZE_SMALL + FADE_MEDIUM is configurable just for the start; for WS2812FX setSegment OPTIONS, see: https://github.com/kitesurfer1404/WS2812FX/blob/master/extras/WS2812FX%20Users%20Guide.md //#define LED_TYPE_WS2811 // Uncomment, if LED type uses 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) #define LED_BUILTIN 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192 +#define POWER_SUPPLY 12 // PIN (12 / D6) If defined, enable output to control external power supply char HOSTNAME[65] = "McLightingRGBW"; // Friedly hostname is configurable just for the start. Hostname should not contain spaces as this can break Home Assistant discovery if used. diff --git a/Arduino/McLighting/version.h b/Arduino/McLighting/version.h index c1cb01b..c3b43d1 100644 --- a/Arduino/McLighting/version.h +++ b/Arduino/McLighting/version.h @@ -1 +1 @@ -#define SKETCH_VERSION "2.2.6.RU1.rgbw.3c" +#define SKETCH_VERSION "2.2.7.RU1.rgbw.3c" diff --git a/Arduino/McLighting/version_info.ino b/Arduino/McLighting/version_info.ino index a74007e..fbbb069 100644 --- a/Arduino/McLighting/version_info.ino +++ b/Arduino/McLighting/version_info.ino @@ -165,4 +165,7 @@ * adressed issue: #31 * adressed issue: #32 * + * 09 Oktober 2019 + * Version Bump to 2.2.7 rgbw 3colors + * added output to control external power supply */