This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EVERY_N_MILLISECONDS(PAUSE) { | |
uint8_t color; | |
if((pos % 2) && (pos <= (msglen * 2))) { | |
char letter = msg[pos/2]; | |
char mapped = mapChar(letter); | |
// Serial.printf("pos: %d, char: %c, num: %d\n", pos, letter, mapped); | |
if(mapped > 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <ESP8266WebServer.h> | |
#include <ESP8266mDNS.h> | |
#include <DNSServer.h> | |
#include <FS.h> | |
#include <FastLED.h> | |
#include <PGMWrap.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <EEPROM.h> | |
#define FLAGSET 0x55 | |
#define FLAGCLEAR 0xAA | |
#define FLAGADDRESS 00 | |
#define FLAGTIMEOUT 3000 | |
uint32_t flag = FLAGCLEAR; | |
void setup() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(115200); Serial.println(); | |
pinMode(LED_BUILTIN, OUTPUT); | |
digitalWrite(LED_BUILTIN, HIGH); | |
//Activate the EEPROM before attempting to use it | |
EEPROM.begin(sizeof(flag)); | |
//Check to see if the flag is still set from the previous boot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool checkFlag() { | |
flag = EEPROM.read(FLAGADDRESS); | |
return flag == FLAGSET; | |
} | |
void writeFlag(uint32_t value) { | |
flag = value; | |
EEPROM.write(FLAGADDRESS, flag); | |
EEPROM.commit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <EEPROM.h> | |
#define FLAGSET 0x55 | |
#define FLAGCLEAR 0xAA | |
#define FLAGADDRESS 00 | |
#define FLAGTIMEOUT 3000 | |
uint32_t flag = FLAGCLEAR; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <ESP8266WebServer.h> | |
#include <FS.h> | |
#include "EEPROMAnything.h" | |
#define RESETPIN D1 | |
ESP8266WebServer webServer(80); | |
struct config_t{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If the passwords match we can update the config with the new settings | |
// Check to see if there is a new value (also doubles to check the length of the new value is long enough) | |
if(webServer.arg("newpassword").length() > 7) | |
webServer.arg("newpassword").toCharArray(config.password, sizeof(config.password)); | |
if(webServer.arg("newssid").length() > 7) | |
webServer.arg("newssid").toCharArray(config.ssid, sizeof(config.ssid)); | |
// Store the new settings to EEPROM | |
EEPROM_writeAnything(0, config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void handleAdmin() { | |
// Create a string containing all the arguments, send them out to the serial port | |
Serial.printf("handleAdmin\n"); | |
// Construct a list of all the arguments for debug | |
String message = "#Args:" + String(webServer.args()) + "\n"; | |
for (int i = 0; i < webServer.args(); i++) | |
message.concat(webServer.argName(i) + ": "+ webServer.arg(i) + "\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webServer.on("/", [](){ | |
webServer.send(200, "text/plain", "visit /admin for wifi configuration"); | |
}); | |
webServer.serveStatic("/admin", SPIFFS, "/admin.html"); | |
webServer.on("/admin", handleAdmin); | |
webServer.begin(); |
NewerOlder