diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index ee06621..d2b1b98 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -727,6 +727,7 @@ void loop() { WiFi.disconnect(); WiFi.setSleepMode(WIFI_NONE_SLEEP); WiFi.mode(WIFI_STA); + WiFi.hostname(HOSTNAME); WiFi.begin(); } else { if ((strlen(mqtt_host) != 0) && (mqtt_port != 0) && (mqtt_reconnect_retries < MQTT_MAX_RECONNECT_TRIES)) { @@ -781,13 +782,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 diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index f47c0a8..c2c7705 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -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. @@ -168,10 +171,10 @@ bool updateState = false; // Button handling #if defined(ENABLE_BUTTON) -//#define BTN_MODE_SHORT "STA|mo|fxm| h| s| r1| g1| b1| w1| r2| g2| b2| w2| r3| g3| b3| w3" // Example - #define BTN_MODE_SHORT "STA| 5| 0|255|196| 0| 0| 0|255| 0| 0| 0| 0| 0| 0| 0| 0" // Static white - #define BTN_MODE_MEDIUM "STA| 5| 48|200|196|255|102| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0" // Fire flicker - #define BTN_MODE_LONG "STA| 5| 46|200|196|255|102| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0" // Fireworks random +//#define BTN_MODE_SHORT "STA|mo|fxm| s| b| r1| g1| b1| w1| r2| g2| b2| w2| r3| g3| b3| w3" // Example + #define BTN_MODE_SHORT "STA| 5| 0|196|255| 0| 0| 0|255| 0| 0| 0| 0| 0| 0| 0| 0" // Static white + #define BTN_MODE_MEDIUM "STA| 5| 48|196|200|255|102| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0" // Fire flicker + #define BTN_MODE_LONG "STA| 5| 46|196|200|255|102| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0" // Fireworks random unsigned long keyPrevMillis = 0; const unsigned long keySampleIntervalMs = 25; byte longKeyPressCountMax = 80; // 80 * 25 = 2000 ms diff --git a/Arduino/McLighting/request_handlers.h b/Arduino/McLighting/request_handlers.h index b7b0a8a..e8431fe 100644 --- a/Arduino/McLighting/request_handlers.h +++ b/Arduino/McLighting/request_handlers.h @@ -521,8 +521,8 @@ void handleSetNamedMode(uint8_t * mypayload) { ws2812fx_mode = FX_MODE_THEATER_CHASE_RAINBOW; mode = SET_MODE; } -#endif } +#endif void handleSetWS2812FXMode(uint8_t * mypayload) { if (isDigit(mypayload[1])) { @@ -1395,6 +1395,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght DBG_OUTPUT_PORT.println("Re-connecting to Wi-Fi..."); WiFi.setSleepMode(WIFI_NONE_SLEEP); WiFi.mode(WIFI_STA); + WiFi.hostname(HOSTNAME); WiFi.begin(); } diff --git a/Arduino/McLighting/version.h b/Arduino/McLighting/version.h index c3b43d1..e51a3f8 100644 --- a/Arduino/McLighting/version.h +++ b/Arduino/McLighting/version.h @@ -1 +1 @@ -#define SKETCH_VERSION "2.2.7.RU1.rgbw.3c" +#define SKETCH_VERSION "2.2.8.RU1.rgbw.3c" diff --git a/Arduino/McLighting/version_info.ino b/Arduino/McLighting/version_info.ino index fbbb069..226b95f 100644 --- a/Arduino/McLighting/version_info.ino +++ b/Arduino/McLighting/version_info.ino @@ -168,4 +168,9 @@ * 09 Oktober 2019 * Version Bump to 2.2.7 rgbw 3colors * added output to control external power supply + * + * 06 December 2019 + * Version Bump to 2.2.8 rgbw 3colors + * Bugfixes + * adressed issue #59 */ diff --git a/README.md b/README.md index 0c7cf19..fe688ef 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ I hope I didn't miss any sources and mentioned every author. In case I forgot so - [ ] Additional clients - [ ] If no wifi, at least enable button mode. - [ ] Also enable McLighting in Wifi AP mode. +- [ ] Search an non blocking alternative for WifiManager - [ ] Multiple buttons/GPIO Inputs. [Issue](https://github.com/toblum/McLighting/issues/119) - [ ] Music visualizer / Bring back ArtNet [Issue](https://github.com/toblum/McLighting/issues/111) - [ ] Display version and parameters (Number of LEDs, definition settings, ..) in the web UI [Issue](https://github.com/toblum/McLighting/issues/150) diff --git a/platformio.ini b/platformio.ini index 5803450..8d2cfec 100644 --- a/platformio.ini +++ b/platformio.ini @@ -25,6 +25,11 @@ description = The ESP8266 based multi-client lighting gadget # arduino core 2.4.1 = platformIO 1.7.3 # arduino core 2.4.2 = platformIO 1.8.0 # arduino core 2.5.0 = platformIO 2.0.4 +# arduino core 2.5.1 = platformIO 2.1.1 +# arduino core 2.5.2 = platformIO 2.2.3 +# arduino core 2.6.1 = platformIO 2.3.0 +# arduino core 2.6.2 = platformIO 2.3.1 +# arduino core 2.6.3 = platformIO 2.3.2 # arduino core stage = platformIO feature#stage # ------------------------------------------------------------------------------ arduino_core_2_3_0 = espressif8266@1.5.0 @@ -33,7 +38,10 @@ arduino_core_2_4_1 = espressif8266@1.7.3 arduino_core_2_4_2 = espressif8266@1.8.0 arduino_core_2_5_0 = espressif8266@2.0.4 arduino_core_2_5_1 = espressif8266@2.1.1 -arduino_core_2_5_2 = espressif8266@2.2.0 +arduino_core_2_5_2 = espressif8266@2.2.3 +arduino_core_2_6_1 = espressif8266@2.3.0 +arduino_core_2_6_2 = espressif8266@2.3.1 +arduino_core_2_6_3 = espressif8266@2.3.2 arduino_core_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage framework = arduino