-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed old UI source - Simplified code - Better update begin for ESP32 - Added portal as submodule - Generated webpage - Removed old webpage - Added AsyncWebServer Support - Minor fix - Major improvements and fixes - Updated Portal - Remove portal submodule - Fixed async /upload endpoint - Better post update callback - Updated to previous commit - Removed portal folder - Include FS lib for ESP8266 - Update callback names - Updated portal - Remove portal submodule - Updated webpage - Minor metadata - Minor adjustments - Updated portal - Update ignore - Updated examples - Delete portal submodule
- Loading branch information
1 parent
52717e9
commit 69bd544
Showing
26 changed files
with
1,518 additions
and
14,763 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
.vscode/ | ||
/elegant-webpage | ||
/portal |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
----------------------- | ||
ElegantOTA - Async Demo Example | ||
----------------------- | ||
Skill Level: Beginner | ||
This example provides with a bare minimal app with ElegantOTA functionality which works | ||
with AsyncWebServer. | ||
Github: https://github.com/ayushsharma82/ElegantOTA | ||
WiKi: https://docs.elegantota.pro | ||
Works with both ESP8266 & ESP32 | ||
------------------------------- | ||
Upgrade to ElegantOTA Pro: https://elegantota.pro | ||
*/ | ||
|
||
// IMPORTANT NOTE: This compiler flag is required for ElegantOTA to use AsyncWebServer! | ||
#define ELEGANTOTA_USE_ASYNC_WEBSERVER 1 | ||
|
||
#if defined(ESP8266) | ||
#include <ESP8266WiFi.h> | ||
#include <ESPAsyncTCP.h> | ||
#elif defined(ESP32) | ||
#include <WiFi.h> | ||
#include <AsyncTCP.h> | ||
#endif | ||
|
||
#include <ESPAsyncWebServer.h> | ||
#include <ElegantOTA.h> | ||
|
||
const char* ssid = "........"; | ||
const char* password = "........"; | ||
|
||
AsyncWebServer server(80); | ||
|
||
unsigned long ota_progress_millis = 0; | ||
|
||
|
||
void setup(void) { | ||
Serial.begin(115200); | ||
WiFi.mode(WIFI_STA); | ||
WiFi.begin(ssid, password); | ||
Serial.println(""); | ||
|
||
// Wait for connection | ||
while (WiFi.status() != WL_CONNECTED) { | ||
delay(500); | ||
Serial.print("."); | ||
} | ||
Serial.println(""); | ||
Serial.print("Connected to "); | ||
Serial.println(ssid); | ||
Serial.print("IP address: "); | ||
Serial.println(WiFi.localIP()); | ||
|
||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { | ||
request->send(200, "text/plain", "Hi! This is ElegantOTA AsyncDemo."); | ||
}); | ||
|
||
ElegantOTA.begin(&server); // Start ElegantOTA | ||
|
||
// ElegantOTA callbacks | ||
ElegantOTA.onStart([&]() { | ||
// Log when OTA has started | ||
Serial.println("OTA update started!"); | ||
// <Add your own code here> | ||
}); | ||
|
||
ElegantOTA.onProgress([&](size_t current, size_t final) { | ||
// Log every 1 second | ||
if (millis() - ota_progress_millis > 1000) { | ||
ota_progress_millis = millis(); | ||
Serial.printf("OTA update progress: %u%%\r", (current / (final / 100))); | ||
} | ||
}); | ||
|
||
ElegantOTA.onEnd([&](bool success) { | ||
// Log when OTA has finished | ||
if (success) { | ||
Serial.println("OTA update finished successfully!"); | ||
} else { | ||
Serial.println("There was an error during OTA update!"); | ||
} | ||
// <Add your own code here> | ||
}); | ||
|
||
server.begin(); | ||
Serial.println("HTTP server started"); | ||
} | ||
|
||
void loop(void) { | ||
ElegantOTA.loop(); | ||
} |
This file was deleted.
Oops, something went wrong.
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
Submodule porta
added at
a6b89c
Oops, something went wrong.