* Create ESP_NetworkInterface class and have Ethernet extending it * Update CMakeLists.txt * Split networking from WiFi (H2 can now use Ethernet) Now all libs have been checked yet. More to do on WiFi side * Fix build errors * Guard WiFi classes and fix RMII ETH examples * Decouple network related libraries from WiFi * Fix examples and WiFiUpdate * Guard WiFiProv lib to compile only on WiFi chips * Add periman string for network and "fix" mdns on the first ETH * Revert back location of Client/Server/Udp in order to accept some PRs * Fix periman * Some fixes from merging master * Fix web server missing fs.h * Move Client, Server and Udp out of WiFi * More fixes * more fixes * Fix CMakekLists and rework lib menu dependencies * Fix CMake issues * move back WiFiClient to rebase with master * Update ETH_TLK110.ino * Move back WiFiClient * Update progress * Update WiFiGeneric.cpp * More fixes * Switch AP to the new interface * Cleanup * Rename AP methods * Add extra interface info for Printable * Rename IPv6 getters to clarify that they are returning LinkLocal address cc @sgryphon * Rename network classes cc @sgryphon * Update NetworkManager.h * Rename WiFi Server and UDP * Rename WiFiClient and WiFiClientSecure * Update CMakeLists.txt * Update on-push.sh * Rename Network library * Remove unnecessary guard * Get the correct interface MAC address for mDND Workstation service * Apply suggestions from code review Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> --------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
50 lines
No EOL
1.1 KiB
C++
50 lines
No EOL
1.1 KiB
C++
/*
|
|
To upload through terminal you can use: curl -F "image=@firmware.bin" esp32-webupdate.local/update
|
|
*/
|
|
|
|
#include <WiFi.h>
|
|
#include <NetworkClient.h>
|
|
#include <WebServer.h>
|
|
#include <ESPmDNS.h>
|
|
#include <HTTPUpdateServer.h>
|
|
|
|
#ifndef STASSID
|
|
#define STASSID "your-ssid"
|
|
#define STAPSK "your-password"
|
|
#endif
|
|
|
|
const char* host = "esp32-webupdate";
|
|
const char* ssid = STASSID;
|
|
const char* password = STAPSK;
|
|
|
|
WebServer httpServer(80);
|
|
HTTPUpdateServer httpUpdater;
|
|
|
|
void setup(void) {
|
|
|
|
Serial.begin(115200);
|
|
Serial.println();
|
|
Serial.println("Booting Sketch...");
|
|
WiFi.mode(WIFI_AP_STA);
|
|
WiFi.begin(ssid, password);
|
|
|
|
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
|
WiFi.begin(ssid, password);
|
|
Serial.println("WiFi failed, retrying.");
|
|
}
|
|
|
|
if (MDNS.begin(host)) {
|
|
Serial.println("mDNS responder started");
|
|
}
|
|
|
|
|
|
httpUpdater.setup(&httpServer);
|
|
httpServer.begin();
|
|
|
|
MDNS.addService("http", "tcp", 80);
|
|
Serial.printf("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
|
|
}
|
|
|
|
void loop(void) {
|
|
httpServer.handleClient();
|
|
} |