Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.

Commit af1a8c9

Browse files
authored
Merge pull request #279 from toblum/develop
Merge v2.1.7 from Develop
2 parents 7a44a76 + 267a8f0 commit af1a8c9

File tree

6 files changed

+39
-7
lines changed

6 files changed

+39
-7
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ lib/readme.txt
88
*.h.gch
99
.clang_complete
1010
.gcc-flags.json
11+
12+
.vscode/*

Arduino/McLighting/McLighting.ino

+17-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
WiFiEventHandler wifiDisconnectHandler;
5353
#endif
5454

55+
#ifdef ARDUINOJSON_VERSION
56+
#if !(ARDUINOJSON_VERSION_MAJOR == 6 and ARDUINOJSON_VERSION_MINOR == 6)
57+
#error "Install ArduinoJson v6.6.0-beta"
58+
#endif
59+
#endif
60+
5561

5662
// ***************************************************************************
5763
// Instanciate HTTP(80) / WebSockets(81) Server
@@ -317,11 +323,15 @@ void setup() {
317323

318324
// Uncomment if you want to restart ESP8266 if it cannot connect to WiFi.
319325
// Value in brackets is in seconds that WiFiManger waits until restart
320-
//wifiManager.setConfigPortalTimeout(180);
326+
#ifdef WIFIMGR_PORTAL_TIMEOUT
327+
wifiManager.setConfigPortalTimeout(WIFIMGR_PORTAL_TIMEOUT);
328+
#endif
321329

322330
// Uncomment if you want to set static IP
323331
// Order is: IP, Gateway and Subnet
324-
//wifiManager.setSTAStaticIPConfig(IPAddress(192,168,0,128), IPAddress(192,168,0,1), IPAddress(255,255,255,0));
332+
#ifdef WIFIMGR_SET_MANUAL_IP
333+
wifiManager.setSTAStaticIPConfig(IPAddress(_ip[0], _ip[1], _ip[2], _ip[3]), IPAddress(_gw[0], _gw[1], _gw[2], _gw[3]), IPAddress(_sn[0], _sn[1], _sn[2], _sn[3]));
334+
#endif
325335

326336
//fetches ssid and pass and tries to connect
327337
//if it does not connect it starts an access point with the specified name
@@ -415,6 +425,10 @@ void setup() {
415425
// ***************************************************************************
416426
// Configure MQTT
417427
// ***************************************************************************
428+
#ifdef ENABLE_MQTT_HOSTNAME_CHIPID
429+
snprintf(mqtt_clientid, 64, "%s-%08X", HOSTNAME, ESP.getChipId());
430+
#endif
431+
418432
#ifdef ENABLE_MQTT
419433
if (mqtt_host != "" && atoi(mqtt_port) > 0) {
420434
snprintf(mqtt_intopic, sizeof mqtt_intopic, "%s/in", HOSTNAME);
@@ -1007,6 +1021,7 @@ void loop() {
10071021
exit_func = false;
10081022
}
10091023
#endif
1024+
if (prevmode == SET_MODE) prevmode = HOLD;
10101025
}
10111026
#ifdef ENABLE_LEGACY_ANIMATIONS
10121027
if (mode == TV) {

Arduino/McLighting/definitions.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//#define USE_WS2812FX_UART // Uses PIN is ignored & set to D4/GPIO2 Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
33

44
// Neopixel
5-
#define PIN D1 // PIN (14 / D5) where neopixel / WS2811 strip is attached
5+
#define PIN 14 // PIN (14 / D5) where neopixel / WS2811 strip is attached
66
#define NUMLEDS 24 // Number of leds in the strip
77
#define BUILTIN_LED 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192
88
#define BUTTON 4 // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button.
@@ -18,6 +18,15 @@ const char HOSTNAME[] = "McLighting01"; // Friedly hostname
1818
//#define MQTT_HOME_ASSISTANT_SUPPORT // If defined, use AMQTT and select Tools -> IwIP Variant -> Higher Bandwidth
1919
#define ENABLE_LEGACY_ANIMATIONS
2020

21+
//#define WIFIMGR_PORTAL_TIMEOUT 180
22+
//#define WIFIMGR_SET_MANUAL_IP
23+
24+
#ifdef WIFIMGR_SET_MANUAL_IP
25+
uint8_t _ip[4] = {192,168,0,128};
26+
uint8_t _gw[4] = {192,168,0,1};
27+
uint8_t _sn[4] = {255,255,255,0};
28+
#endif
29+
2130
#if defined(USE_WS2812FX_DMA) and defined(USE_WS2812FX_UART)
2231
#error "Cant have both DMA and UART method."
2332
#endif
@@ -72,9 +81,9 @@ uint32_t autoParams[][4] = { // color, speed, mode, duration (seconds)
7281

7382
//#define ENABLE_MQTT_HOSTNAME_CHIPID // Uncomment/comment to add ESPChipID to end of MQTT hostname
7483
#ifdef ENABLE_MQTT_HOSTNAME_CHIPID
75-
const char* mqtt_clientid = String(String(HOSTNAME) + "-" + String(ESP.getChipId())).c_str(); // MQTT ClientID
84+
char mqtt_clientid[64];
7685
#else
77-
const char* mqtt_clientid = HOSTNAME; // MQTT ClientID
86+
const char* mqtt_clientid = HOSTNAME;
7887
#endif
7988

8089
char mqtt_host[64] = "";

Arduino/McLighting/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define SKETCH_VERSION "2.1.6"
1+
#define SKETCH_VERSION "2.1.7"

Arduino/McLighting/version_info.ino

+6
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,10 @@
2525
* - Retire NeoAnimationFX
2626
* - Use DMA or UART method along with WS2812FX instead
2727
* - fix #248
28+
*
29+
* 3 Dec 2018 v 2.1.7
30+
* - Contributions by @ MrTheBarbarian from #270
31+
* - rethink ESP.getChipId implementaion
32+
* - check ArduinoJSON version
33+
* - Try restting prevmode as suggested in #276
2834
*/

platformio.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ upload_resetmethod = ${common.upload_resetmethod}
4747
lib_deps =
4848
4949
AsyncMqttClient
50-
https://github.com/bblanchon/ArduinoJson.git#v6.5.0-beta
50+
https://github.com/bblanchon/ArduinoJson.git#v6.6.0-beta
5151
WS2812FX
5252
NeoPixelBus
5353
WebSockets

0 commit comments

Comments
 (0)