Power Supply Update

Moved the pin setting for POWER_SUPPLY to definitions.h instead of the main sketch.
This commit is contained in:
ryancasler
2019-12-08 01:00:54 -05:00
parent fa31f97c47
commit a613b8c978
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -781,13 +781,13 @@ void loop() {
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
if (prevmode != mode) {digitalWrite(POWER_SUPPLY, !POWER_ON); } // 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
if (prevmode != mode) {digitalWrite(POWER_SUPPLY, POWER_ON); } // power on -> external power supply
}
#endif
+3
View File
@@ -13,6 +13,9 @@
//#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
#if defined(POWER_SUPPLY)
#define POWER_ON HIGH // Define the output state to turn on the power supply, either HIGH or LOW. Opposite will be uses for power off.
#endif
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.