1 Commits

Author SHA1 Message Date
d9ee4b6816 Updated README, fixed Arduino ESP8266FS tool link. 2017-12-12 13:37:46 -06:00
9 changed files with 133 additions and 110 deletions

View File

@ -70,7 +70,7 @@ The app depends on the following libraries. They must either be downloaded from
Download the app code from GitHub using the green Clone or Download button from [the GitHub project main page](https://github.com/jasoncoon/esp8266-fastled-webserver) and click Download ZIP. Decompress the ZIP file in your Arduino sketch folder. Download the app code from GitHub using the green Clone or Download button from [the GitHub project main page](https://github.com/jasoncoon/esp8266-fastled-webserver) and click Download ZIP. Decompress the ZIP file in your Arduino sketch folder.
The web app needs to be uploaded to the ESP8266's SPIFFS. You can do this within the Arduino IDE after installing the [Arduino ESP8266FS tool](https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md#uploading-files-to-file-system). The web app needs to be uploaded to the ESP8266's SPIFFS. You can do this within the Arduino IDE after installing the [Arduino ESP8266FS tool](http://esp8266.github.io/Arduino/versions/2.3.0/doc/filesystem.html#uploading-files-to-file-system).
With ESP8266FS installed upload the web app using `ESP8266 Sketch Data Upload` command in the Arduino Tools menu. With ESP8266FS installed upload the web app using `ESP8266 Sketch Data Upload` command in the Arduino Tools menu.

153
WiFi.h
View File

@ -4,35 +4,66 @@
//const byte DNS_PORT = 53; //const byte DNS_PORT = 53;
// bool apMode = false;
// AP mode password // AP mode password
const char WiFiAPPSK[] = ""; const char WiFiAPPSK[] = "";
// Wi-Fi network to connect to (leave blank to connect to saved network, or to start in AP mode) // Wi-Fi network to connect to (if not in AP mode)
const char* ssid = ""; char* ssid = "";
const char* password = ""; char* password = "";
#define HOSTNAME "ESP8266-" ///< Hostname. The initializeWiFi function adds the Chip ID at the end. #define HOSTNAME "ESP8266-" ///< Hostname. The initializeWiFi function adds the Chip ID at the end.
#define DEBUG_WIFI 1 #define DEBUG_WIFI 1
WiFiMode mode = WIFI_STA; // connect to existing Wi-Fi network unsigned long futureTimeout = 0;
//WiFiMode mode = WIFI_AP; // act as an Access Point, creating a new Wi-Fi network uint16_t connectionTimeout = 20000;
//WiFiMode mode = WIFI_AP_STA; // act as both a client and Access Point (mesh mode)
template <typename Generic>
void debugPrint(Generic text) {
if (DEBUG_WIFI) {
Serial.print(text);
}
}
template <typename Generic> template <typename Generic>
void debugPrintln(Generic text) { void debugPrintln(Generic text) {
if (DEBUG_WIFI) { if (DEBUG_WIFI) {
Serial.print("*WiFi: ");
Serial.println(text); Serial.println(text);
} }
} }
void startAp() {
// WiFi.disconnect();
// apMode = true;
// WiFi.mode(WIFI_AP_STA);
// debugPrintln("SET AP STA");
String AP_NameString = "ESP8266-";
AP_NameString += String(ESP.getChipId(), HEX);
char AP_NameChar[AP_NameString.length() + 1];
memset(AP_NameChar, 0, AP_NameString.length() + 1);
for (int i = 0; i < AP_NameString.length(); i++)
AP_NameChar[i] = AP_NameString.charAt(i);
debugPrintln("Starting soft AP");
if (WiFiAPPSK != NULL) {
debugPrintln(WiFi.softAP(AP_NameChar, WiFiAPPSK) ? "ready" : "failed");
} else {
debugPrintln(WiFi.softAP(AP_NameChar) ? "ready" : "failed");
}
debugPrintln("Connect to Wi-Fi access point: ");
debugPrintln(AP_NameChar);
delay(500); // Without delay I've seen the IP address blank
debugPrintln("AP IP address: ");
debugPrintln(WiFi.softAPIP());
// dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
// dnsServer.start(DNS_PORT, "*", WiFi.softAPIP());
}
String getWiFiJson() { String getWiFiJson() {
String hostname = String(HOSTNAME); String hostname = String(HOSTNAME);
hostname += String(ESP.getChipId(), HEX); hostname += String(ESP.getChipId(), HEX);
@ -46,16 +77,16 @@ String getWiFiJson() {
json += ",\"ssid\":\"" + WiFi.SSID() + "\""; json += ",\"ssid\":\"" + WiFi.SSID() + "\"";
json += ",\"rssi\":\"" + String(WiFi.RSSI()) + "\""; json += ",\"rssi\":\"" + String(WiFi.RSSI()) + "\"";
json += ",\"networks\":["; // json += ",\"networks\":[";
byte ssidCount = WiFi.scanNetworks(); // byte ssidCount = WiFi.scanNetworks();
for (byte i = 0; i < ssidCount; i++) { // for (byte i = 0; i < ssidCount; i++) {
if (i > 0) // if (i > 0)
json += ","; // json += ",";
//
json += "{\"name\":\"" + WiFi.SSID(i) + "\",\"rssi\":\"" + String(WiFi.RSSI(i)) + "\"}"; // json += "{\"name\":\"" + WiFi.SSID(i) + "\",\"rssi\":\"" + String(WiFi.RSSI(i)) + "\"}";
} // }
//
json += "]"; // json += "]";
json += "}"; json += "}";
@ -63,6 +94,8 @@ String getWiFiJson() {
} }
void initializeWiFi() { void initializeWiFi() {
WiFi.mode(WIFI_AP_STA);
// Set Hostname. // Set Hostname.
String hostname = String(HOSTNAME); String hostname = String(HOSTNAME);
hostname += String(ESP.getChipId(), HEX); hostname += String(ESP.getChipId(), HEX);
@ -86,53 +119,20 @@ void initializeWiFi() {
// WiFi.mode(WIFI_STA); // WiFi.mode(WIFI_STA);
String stored_ssid = WiFi.SSID(); String stored_ssid = WiFi.SSID();
if (stored_ssid != NULL && stored_ssid != "") {
if (ssid != NULL && password != NULL && debugPrintln("Connecting to stored SSID:");
ssid != "" && password != "") {
debugPrint("WiFi mode: ");
debugPrintln(WIFI_STA);
WiFi.mode(WIFI_STA);
debugPrint("Connecting to hard-coded SSID: ");
debugPrintln(stored_ssid);
WiFi.begin(ssid, password);
}
else if (stored_ssid != NULL && stored_ssid != "") {
debugPrint("WiFi mode: ");
debugPrintln(WIFI_STA);
WiFi.mode(WIFI_STA);
debugPrint("Connecting to stored SSID: ");
debugPrintln(stored_ssid); debugPrintln(stored_ssid);
WiFi.begin(); WiFi.begin();
}
else {
debugPrintln("No stored SSID");
debugPrint("Starting soft AP: ");
debugPrintln(hostnameChar);
WiFi.mode(WIFI_AP);
if (WiFiAPPSK != NULL) {
debugPrint(WiFi.softAP(hostnameChar, WiFiAPPSK) ? "ready" : "failed");
} else { } else {
debugPrint(WiFi.softAP(hostnameChar) ? "ready" : "failed"); debugPrintln("No stored SSID");
} }
debugPrint("Connect to Wi-Fi access point: "); startAp();
debugPrintln(hostnameChar);
delay(500); // Without delay I've seen the IP address blank
debugPrint("AP IP address: ");
debugPrintln(WiFi.softAPIP());
// dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
// dnsServer.start(DNS_PORT, "*", WiFi.softAPIP());
}
webServer.on("/wifi", HTTP_POST, []() { webServer.on("/wifi", HTTP_POST, []() {
String ssid = webServer.arg("ssid"); String ssid = webServer.arg("ssid");
String password = webServer.arg("password"); String password = webServer.arg("password");
// String mode = webServer.arg("mode");
char ssidChars[50]; char ssidChars[50];
ssid.toCharArray(ssidChars, 50); ssid.toCharArray(ssidChars, 50);
@ -140,10 +140,16 @@ void initializeWiFi() {
char passwordChars[50]; char passwordChars[50];
password.toCharArray(passwordChars, 50); password.toCharArray(passwordChars, 50);
debugPrint("Connecting to new SSID: "); debugPrintln("Connecting to new SSID:");
debugPrintln(ssid); debugPrintln(ssid);
// dnsServer.stop();
// WiFi.softAPdisconnect(true);
// apMode = false;
// WiFi.mode(WIFI_STA);
WiFi.begin(ssidChars, passwordChars); WiFi.begin(ssidChars, passwordChars);
// futureTimeout = millis() + connectionTimeout;
webServer.sendHeader("Location", "/wifi.htm"); webServer.sendHeader("Location", "/wifi.htm");
webServer.send(303); webServer.send(303);
@ -155,3 +161,26 @@ void initializeWiFi() {
}); });
} }
void checkWiFi() {
// if (WiFi.status() == WL_CONNECTED) {
// debugPrintln("connected");
// futureTimeout = millis() + connectionTimeout;
// return;
// }
//
// if (apMode) {
// debugPrintln("Already running in AP mode.");
// return;
// }
//
// // time to give up on the stored network and switch to ap mode?
// if (futureTimeout != 0 && millis() < futureTimeout) {
// return;
// }
//
// debugPrintln("Switching to AP mode, timeout elapsed: ");
// debugPrintln(connectionTimeout);
//
// startApMode();
}

View File

@ -8,12 +8,12 @@
<title>ESP8266 + FastLED by Evil Genius Labs</title> <title>ESP8266 + FastLED by Evil Genius Labs</title>
<!-- request CSS from internet CDN --> <!-- request CSS from internet CDN -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.css" integrity="sha256-4wnSkPYU5B4yngAlx/rEb8LdfMah4teUth4AfhGEuaY=" crossorigin="anonymous" /> <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.css" integrity="sha256-4wnSkPYU5B4yngAlx/rEb8LdfMah4teUth4AfhGEuaY=" crossorigin="anonymous" /> -->
<!-- request CSS from the ESP8266 web server --> <!-- request CSS from the ESP8266 web server -->
<!-- <link rel="stylesheet" href="css/bootstrap.min.css"> --> <link rel="stylesheet" href="css/bootstrap.min.css">
<!-- <link rel="stylesheet" href="css/minicolors.min.css"> --> <link rel="stylesheet" href="css/minicolors.min.css">
<link rel="stylesheet" href="css/styles.css"> <link rel="stylesheet" href="css/styles.css">
@ -216,16 +216,16 @@
</nav> </nav>
<!-- request js from internet CDN --> <!-- request js from internet CDN -->
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> --> <!-- <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.js" integrity="sha256-XAFQ9dZ6hy8p/GRhU8h/8pMvM1etymiJLZW1CiHV3bQ=" crossorigin="anonymous"></script> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.js" integrity="sha256-XAFQ9dZ6hy8p/GRhU8h/8pMvM1etymiJLZW1CiHV3bQ=" crossorigin="anonymous"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script> -->
<!-- request js from the ESP8266 web server --> <!-- request js from the ESP8266 web server -->
<!-- <script src="js/jquery-3.1.1.min.js"></script> --> <script src="js/jquery-3.1.1.min.js"></script>
<!-- <script src="js/bootstrap.min.js"></script> --> <script src="js/bootstrap.min.js"></script>
<!-- <script src="js/minicolors.min.js"></script> --> <script src="js/minicolors.min.js"></script>
<!-- <script src="js/r-websocket.min.js"></script> --> <script src="js/r-websocket.min.js"></script>
<script src="js/app.js"></script> <script src="js/app.js"></script>

View File

@ -1,8 +1,3 @@
// require ./jquery-3.1.1.min.js
// require ./bootstrap.min.js
// require ./minicolors.min.js
// require ./r-websocket.min.js
// used when hosting the site on the ESP8266 // used when hosting the site on the ESP8266
var address = location.hostname; var address = location.hostname;
var urlBase = ""; var urlBase = "";

View File

@ -1,5 +1,3 @@
// require ./jquery-3.1.1.min.js
/*! /*!
* Bootstrap v3.3.7 (http://getbootstrap.com) * Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc. * Copyright 2011-2016 Twitter, Inc.

View File

@ -1,5 +1,3 @@
// require ./jquery-3.1.1.min.js
/* /*
* jQuery MiniColors: A tiny color picker built on jQuery * jQuery MiniColors: A tiny color picker built on jQuery
* *

View File

@ -8,10 +8,10 @@
<title>ESP8266 + FastLED by Evil Genius Labs</title> <title>ESP8266 + FastLED by Evil Genius Labs</title>
<!-- request CSS from internet CDN --> <!-- request CSS from internet CDN -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> -->
<!-- request CSS from the ESP8266 web server --> <!-- request CSS from the ESP8266 web server -->
<!-- <link rel="stylesheet" href="css/bootstrap.min.css"> --> <link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/simple.css"> <link rel="stylesheet" href="css/simple.css">
@ -42,14 +42,14 @@
</div> </div>
<!-- request js from internet CDN --> <!-- request js from internet CDN -->
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> <!-- <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> -->
<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script> <!-- <script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script> -->
<!-- request js from the ESP8266 web server --> <!-- request js from the ESP8266 web server -->
<!-- <script src="js/jquery-3.1.1.min.js"></script> --> <script src="js/jquery-3.1.1.min.js"></script>
<!-- <script src="js/bootstrap.min.js"></script> --> <script src="js/bootstrap.min.js"></script>
<script src="js/simple.js"></script> <script src="js/simple.js"></script>

View File

@ -8,10 +8,10 @@
<title>ESP8266 + FastLED by Evil Genius Labs</title> <title>ESP8266 + FastLED by Evil Genius Labs</title>
<!-- request CSS from internet CDN --> <!-- request CSS from internet CDN -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> -->
<!-- request CSS from the ESP8266 web server --> <!-- request CSS from the ESP8266 web server -->
<!-- <link rel="stylesheet" href="css/bootstrap.min.css"> --> <link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css"> <link rel="stylesheet" href="css/styles.css">
@ -81,14 +81,14 @@
</div> </div>
<!-- request js from internet CDN --> <!-- request js from internet CDN -->
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> <!-- <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> -->
<!-- <script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script> --> <!-- <script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script> --> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script> -->
<!-- request js from the ESP8266 web server --> <!-- request js from the ESP8266 web server -->
<!-- <script src="js/jquery-3.1.1.min.js"></script> --> <script src="js/jquery-3.1.1.min.js"></script>
<!-- <script src="js/bootstrap.min.js"></script> --> <script src="js/bootstrap.min.js"></script>
</body> </body>

View File

@ -16,9 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define FASTLED_INTERRUPT_RETRY_COUNT 1
//#define FASTLED_ALLOW_INTERRUPTS 0
#include <FastLED.h> #include <FastLED.h>
FASTLED_USING_NAMESPACE FASTLED_USING_NAMESPACE
@ -53,12 +50,12 @@ ESP8266HTTPUpdateServer httpUpdateServer;
#include "FSBrowser.h" #include "FSBrowser.h"
#define DATA_PIN D5 #define DATA_PIN D8
#define LED_TYPE WS2812 #define LED_TYPE WS2811
#define COLOR_ORDER RGB #define COLOR_ORDER GRB
#define NUM_LEDS 50 #define NUM_LEDS 24
#define MILLI_AMPS 3000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA) #define MILLI_AMPS 2000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA)
#define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower. #define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower.
CRGB leds[NUM_LEDS]; CRGB leds[NUM_LEDS];
@ -248,6 +245,8 @@ void setup() {
initializeWiFi(); initializeWiFi();
checkWiFi();
httpUpdateServer.setup(&webServer); httpUpdateServer.setup(&webServer);
webServer.on("/all", HTTP_GET, []() { webServer.on("/all", HTTP_GET, []() {
@ -417,6 +416,10 @@ void loop() {
// Add entropy to random number generator; we use a lot of it. // Add entropy to random number generator; we use a lot of it.
random16_add_entropy(random(65535)); random16_add_entropy(random(65535));
EVERY_N_SECONDS(10) {
checkWiFi();
}
// dnsServer.processNextRequest(); // dnsServer.processNextRequest();
webSocketsServer.loop(); webSocketsServer.loop();
webServer.handleClient(); webServer.handleClient();
@ -946,7 +949,7 @@ void sinelon()
{ {
// a colored dot sweeping back and forth, with fading trails // a colored dot sweeping back and forth, with fading trails
fadeToBlackBy( leds, NUM_LEDS, 20); fadeToBlackBy( leds, NUM_LEDS, 20);
int pos = beatsin16(speed, 0, NUM_LEDS - 1); int pos = beatsin16(speed, 0, NUM_LEDS);
static int prevpos = 0; static int prevpos = 0;
CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255); CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255);
if( pos < prevpos ) { if( pos < prevpos ) {