Compare commits
No commits in common. "df70f8bd0577818fe2865128117ab0210b084801" and "2e9d328e732c94cfab238cbfd98d4b50e2f8cacd" have entirely different histories.
df70f8bd05
...
2e9d328e73
46
app/app.ino
46
app/app.ino
|
@ -1,18 +1,50 @@
|
||||||
#include <ESP8266WebServer.h>
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <WiFiClient.h>
|
#include <WiFiClient.h>
|
||||||
//#include <ESP8266HTTPClient.h>
|
//#include <ESP8266HTTPClient.h>
|
||||||
|
#include <ESP8266WebServer.h>
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
|
|
||||||
|
ESP8266WebServer server(80);
|
||||||
|
|
||||||
|
//https://steve.fi/Hardware/d1-flash/
|
||||||
|
void handleNotFound() {
|
||||||
|
// If we could serve from flash we're good.
|
||||||
|
Serial.println(server.uri());
|
||||||
|
return;
|
||||||
|
//if (loadFromSpiffs(server.uri()))
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// Otherwise a generic 404.
|
||||||
|
String message = "File Not Detected\n\n";
|
||||||
|
message += "URI: ";
|
||||||
|
message += server.uri();
|
||||||
|
message += "\nMethod: ";
|
||||||
|
message += (server.method() == HTTP_GET) ? "GET" : "POST";
|
||||||
|
message += "\nArguments: ";
|
||||||
|
message += server.args();
|
||||||
|
message += "\n";
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < server.args(); i++) {
|
||||||
|
message +=
|
||||||
|
" NAME:" + server.argName(i) + "\n VALUE:" + server.arg(i) + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
server.send(404, "text/plain", message);
|
||||||
|
Serial.println(message);
|
||||||
|
}
|
||||||
|
|
||||||
void setup_mode() {
|
void setup_mode() {
|
||||||
WiFi.softAP(ssid, password); // Start the access point
|
WiFi.softAP("snapwire", "snapwire"); // Start the access point
|
||||||
Serial.print("Access Point \"");
|
Serial.print("Access Point \"");
|
||||||
Serial.print(ssid);
|
// Serial.print(ssid);
|
||||||
Serial.println("\" started");
|
Serial.println("\" started");
|
||||||
|
|
||||||
Serial.print("IP address:\t");
|
Serial.print("IP address:\t");
|
||||||
Serial.println(
|
Serial.println(
|
||||||
WiFi.softAPIP()); // Send the IP address of the ESP8266 to the computer
|
WiFi.softAPIP()); // Send the IP address of the ESP8266 to the computer
|
||||||
|
|
||||||
|
server.onNotFound(handleNotFound);
|
||||||
|
server.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void connect() {
|
void connect() {
|
||||||
|
@ -58,6 +90,12 @@ void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
SPIFFS.begin();
|
SPIFFS.begin();
|
||||||
startup();
|
startup();
|
||||||
|
setup_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() { delay(2000); }
|
|
||||||
|
//ESP.restart();
|
||||||
|
void loop() {
|
||||||
|
server.handleClient();
|
||||||
|
//delay(2000);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
Loading…
Reference in New Issue