初始化提交

This commit is contained in:
王立帮
2024-07-20 22:09:06 +08:00
commit c247dd07a6
6876 changed files with 2743096 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@@ -0,0 +1,55 @@
.vscode
elegant-webpage/
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Ayush Sharma
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,174 @@
<p align="center"><img src="https://raw.githubusercontent.com/ayushsharma82/AsyncElegantOTA/master/docs/logo.svg?sanitize=true" width="400"></p>
<hr/>
<p align="center">
<!-- <img src="https://img.shields.io/travis/com/ayushsharma82/ESP-DASH.svg?style=for-the-badge" />
&nbsp; -->
<img src="https://img.shields.io/github/last-commit/ayushsharma82/AsyncElegantOTA.svg?style=for-the-badge" />
&nbsp;
<img src="https://img.shields.io/github/license/ayushsharma82/AsyncElegantOTA.svg?style=for-the-badge" />
&nbsp;
<a href="https://www.patreon.com/asrocks5" target="_blank"><img src="https://img.shields.io/badge/patreon-donate-orange.svg?style=for-the-badge&logo=patreon" /></a>
</p>
<hr/>
<p align="center">Push OTAs to ESP8266 / ESP32 Elegantly (Async)! </p>
<p align="center">
AsyncElegantOTA provides a beautiful interface to upload Over the Air `.bin` updates to your ESP Modules with precise status and progress displayed over UI. This Library shows the current upload progress of your OTA and once finished, it will display the status of your OTA. This Version of Library uses AsyncWebServer. Thanks to @me-no-dev for a wonderful webserver library.
</p>
<br>
<br>
<h2 align="center">Preview</h2>
<p align="center"><img src="https://raw.githubusercontent.com/ayushsharma82/AsyncElegantOTA/master/docs/elegantOtaDemo.gif"></p>
<br>
<br>
<h2>How to Install</h2>
###### Directly Through Arduino IDE ( Currently Submitted for Approval. Use Mannual Install till it gets Approved.)
Go to Sketch > Include Library > Library Manager > Search for "AsyncElegantOTA" > Install
###### Manual Install
For Windows: Download the [Repository](https://github.com/ayushsharma82/AsyncElegantOTA/archive/master.zip) and extract the .zip in Documents>Arduino>Libraries>{Place "ElegantOTA" folder Here}
For Linux: Download the [Repository](https://github.com/ayushsharma82/AsyncElegantOTA/archive/master.zip) and extract the .zip in Sketchbook>Libraries>{Place "ElegantOTA" folder Here}
###### Manually through IDE
Download the [Repository](https://github.com/ayushsharma82/AsyncElegantOTA/archive/master.zip), Go to Sketch>Include Library>Add .zip Library> Select the Downloaded .zip File.
<br>
<h2>Documentation</h2>
<p>AsyncElegantOTA is a dead simple library which does your work in just 1 Line. Honestly, It's just a wrapper library which injects it's own elegant webpage instead of the ugly upload page which comes by default in Arduino Library.</p>
Include AsyncElegantOTA Library `#include <AsyncElegantOTA.h>` at top of your Arduino Code.
Paste this - `AsyncElegantOTA.begin(server);` line above your `server.begin();`
That's all!
Now copy the IPAddress displayed over your Serial Monitor and go to `http://<IPAddress>/update` in browser. ( where `<IPAddress>` is the IP of your ESP Module)
<br>
<h2>Examples</h2>
<h3>For ESP8266:</h3>
```
#include <ESP8266WiFi.h>
#include <Hash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>
const char* ssid = "........";
const char* password = "........";
AsyncWebServer server(80);
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! I am ESP8266.");
});
AsyncElegantOTA.begin(server); // Start ElegantOTA
server.begin();
Serial.println("HTTP server started");
}
void loop(void) {
AsyncElegantOTA.loop();
}
```
<br>
<h3>For ESP32:</h3>
```
#include <WiFi.h>
#include <Hash.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>
const char* ssid = "........";
const char* password = "........";
AsyncWebServer server(80);
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! I am ESP32.");
});
AsyncElegantOTA.begin(server); // Start ElegantOTA
server.begin();
Serial.println("HTTP server started");
}
void loop(void) {
AsyncElegantOTA.loop();
}
```
<br>
<br>
<h2>Contributions</h2>
<p>Every Contribution to this repository is highly appriciated! Don't fear to create pull requests which enhance or fix the library as ultimatly you are going to help everybody.</p>
<p>
If you want to donate to the author then <b>you can become my patron</b>, It really helps me keep these libraries updated:
<br/><br/>
<a href="https://www.patreon.com/bePatron?u=16780597" target="_blank"><img src="https://img.shields.io/badge/patreon-donate-orange.svg?style=for-the-badge&logo=patreon" /></a>
</p>
<br/>
<br/>
<h2>License</h2>
ESP-DASH is licensed under MIT.
<br/>
<br/>
<img src="https://img.shields.io/github/license/ayushsharma82/AsyncElegantOTA.svg?style=for-the-badge" />
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 KiB

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 283 113" style="enable-background:new 0 0 283 113;" xml:space="preserve">
<style type="text/css">
.st0{fill:url(#SVGID_1_);}
.st1{fill:url(#SVGID_2_);}
</style>
<g id="e6a9b544-6145-6fc2-ea66-2788665c643e" transform="matrix(1.6,0,0,1.6,94.28699172884225,133.98400549888612)">
<path d="M-3.5-43.4L-4.4-46h-3.8l-0.9,2.7h-1.4l3.5-9.8h1.4l3.5,9.8H-3.5z M-7.8-47.2h2.9l-1.5-4.1L-7.8-47.2z M0.8-43.2L0.8-43.2
c-0.5,0-1-0.1-1.4-0.2l0,0l0,0c-0.4-0.1-0.7-0.3-0.9-0.4l0,0l0.2-1.2l0,0c0.2,0.2,0.5,0.3,0.9,0.5l0,0l0,0c0.4,0.1,0.8,0.2,1.3,0.2
l0,0l0,0c0.4,0,0.8-0.1,1-0.2l0,0l0,0c0.2-0.2,0.4-0.4,0.4-0.6l0,0l0,0c0-0.3-0.1-0.6-0.4-0.7l0,0l0,0c-0.3-0.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.7-1.8l0,0l0,0c0.7-0.4,1.6-0.6,2.5-0.6l0,0l0,0
c0.9,0,1.8,0.2,2.5,0.6l0,0l0,0c0.7,0.4,1.3,1,1.7,1.8l0,0l0,0c0.4,0.8,0.6,1.7,0.6,2.7l0,0l0,0c0,1-0.2,1.9-0.6,2.7l0,0l0,0
c-0.4,0.8-1,1.4-1.7,1.8l0,0l0,0C79.8-43.4,79-43.2,78.1-43.2L78.1-43.2z M78.1-44.5L78.1-44.5c0.7,0,1.3-0.2,1.9-0.5l0,0l0,0
c0.5-0.3,0.9-0.8,1.2-1.4l0,0l0,0c0.3-0.6,0.4-1.2,0.4-2l0,0l0,0c0-0.7-0.1-1.4-0.4-2l0,0l0,0c-0.3-0.6-0.6-1-1.2-1.4l0,0l0,0
c-0.5-0.3-1.1-0.5-1.9-0.5l0,0l0,0c-0.7,0-1.4,0.2-1.9,0.5l0,0l0,0c-0.5,0.3-0.9,0.8-1.1,1.4l0,0l0,0c-0.3,0.6-0.4,1.2-0.4,2l0,0
l0,0c0,0.7,0.1,1.4,0.4,2l0,0l0,0c0.3,0.6,0.6,1,1.1,1.4l0,0l0,0C76.7-44.6,77.3-44.5,78.1-44.5L78.1-44.5z M86.5-43.4V-52h-2.8
v-1.2h7v1.2h-2.9v8.6H86.5z M98-43.4L97.1-46h-3.8l-0.9,2.7H91l3.5-9.8h1.4l3.5,9.8H98z M93.8-47.2h2.9l-1.5-4.1L93.8-47.2z"/>
</g>
<g id="_x32_1e793a2-70b8-33ce-5769-22f208c47325" transform="matrix(0.18108908573766014,0,0,0.18108908573766014,36.66575500659057,123.51582483087321)">
<g>
<g>
<g>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-1635.4113" y1="487.8766" x2="-1634.4113" y2="487.8766" gradientTransform="matrix(31.4137 8.4891 14.6484 -18.2049 44191.0938 22333.0332)">
<stop offset="0" style="stop-color:#395ECA"/>
<stop offset="1" style="stop-color:#848BD8"/>
</linearGradient>
<path class="st0" d="M162.6-375.6c5.7,0,7.8,6.6,4.5,10.8c-7.2,8.4-14.4,16.5-21.6,24.9c-2.1,2.4-6.6,2.4-9,0
c-7.2-8.4-14.4-16.5-21.6-24.9c-4.5-5.1,1.2-12.3,6.3-10.8c4.5,0,8.7,0,13.2,0c-7.2-28.8-29.1-52.5-58.8-59.1
c-5.7-1.2-11.4-1.8-17.1-1.8c-28.8,0-55.5,15.9-69.6,42c-3.9,7.2-14.7,0.9-10.8-6.3c19.2-34.8,59.4-54.9,98.7-46.2
c35.4,7.5,63,36,70.2,71.4C152.1-375.6,157.2-375.6,162.6-375.6z"/>
</g>
</g>
</g>
</g>
<g>
<g>
<g>
<g>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-1635.4113" y1="487.096" x2="-1634.4113" y2="487.096" gradientTransform="matrix(31.4137 8.5119 14.6484 -18.2539 44168.168 22468.7363)">
<stop offset="0" style="stop-color:#395ECA"/>
<stop offset="1" style="stop-color:#848BD8"/>
</linearGradient>
<path class="st1" d="M-39.6-337.2c-5.7,0-7.8-6.6-4.5-10.8c7.2-8.4,14.4-16.5,21.6-24.9c2.1-2.4,6.6-2.4,9,0
c7.2,8.4,14.4,16.5,21.6,24.9c4.5,5.1-1.2,12.3-6.3,10.8c-4.5,0-8.7,0-13.2,0c7.2,28.8,29.1,52.5,58.8,59.1
c5.7,1.2,11.4,1.8,17.1,1.8c28.8,0,55.5-15.9,69.6-42c3.9-7.2,14.7-0.9,10.8,6.3c-19.2,35.1-59.4,55.2-98.7,46.5
c-35.4-7.8-63.3-36.3-70.5-71.7C-29.4-337.2-34.5-337.2-39.6-337.2z"/>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@@ -0,0 +1,41 @@
#include <WiFi.h>
#include <Hash.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>
const char* ssid = "........";
const char* password = "........";
AsyncWebServer server(80);
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! I am ESP32.");
});
AsyncElegantOTA.begin(&server); // Start ElegantOTA
server.begin();
Serial.println("HTTP server started");
}
void loop(void) {
AsyncElegantOTA.loop();
}

View File

@@ -0,0 +1,41 @@
#include <ESP8266WiFi.h>
#include <Hash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>
const char* ssid = "........";
const char* password = "........";
AsyncWebServer server(80);
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! I am ESP8266.");
});
AsyncElegantOTA.begin(&server); // Start ElegantOTA
server.begin();
Serial.println("HTTP server started");
}
void loop(void) {
AsyncElegantOTA.loop();
}

View File

@@ -0,0 +1,3 @@
AsyncElegantOTA KEYWORD1
begin KEYWORD2
loop KEYWORD2

View File

@@ -0,0 +1,21 @@
{
"name": "AsyncElegantOTA",
"keywords": "AsyncElegantOTA, OTA, Update, ESP8266, ESP32, Over, the, air",
"description": "Perform OTAs for ESP8266 Elegantly! Uses AsyncWebServer.",
"repository":
{
"type": "git",
"url": "https://github.com/ayushsharma82/AsyncElegantOTA.git"
},
"authors":
[
{
"name": "Ayush Sharma",
"email": "asrocks5@gmail.com",
"maintainer": true
}
],
"version": "1.0.6",
"frameworks": "arduino",
"platforms": "espressif"
}

View File

@@ -0,0 +1,9 @@
name=AsyncElegantOTA
version=1.0.6
author=Ayush Sharma
category=Communication
maintainer=Ayush Sharma <asrocks5@gmail.com>
sentence=Perform OTAs for ESP8266/ESP32 Elegantly! This Library uses AsyncWebServer.
paragraph=A User Interface Library which provides interactive elements for your Over the Air Updates on ESP8266/ESP32. UI has a size of only 50Kb!
url=https://github.com/ayushsharma82/AsyncElegantOTA
architectures=esp8266,esp32

View File

@@ -0,0 +1,98 @@
#ifndef AsyncElegantOTA_h
#define AsyncElegantOTA_h
#include "Arduino.h"
#include "stdlib_noniso.h"
#if defined(ESP8266)
#include "ESP8266WiFi.h"
#include <ESPAsyncTCP.h>
#elif defined(ESP32)
#include "WiFi.h"
#include <AsyncTCP.h>
#include <Update.h>
#include <esp_int_wdt.h>
#include <esp_task_wdt.h>
#endif
#include <ESPAsyncWebServer.h>
#include "elegantWebpage.h"
size_t content_len;
class AsyncElegantOtaClass{
public:
void begin(AsyncWebServer *server){
_server = server;
_server->on("/update", HTTP_GET, [&](AsyncWebServerRequest *request){
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", ELEGANT_HTML, ELEGANT_HTML_SIZE);
response->addHeader("Content-Encoding", "gzip");
request->send(response);
});
_server->on("/update", HTTP_POST, [&](AsyncWebServerRequest *request) {
// the request handler is triggered after the upload has finished...
// create the response, add header, and send response
AsyncWebServerResponse *response = request->beginResponse((Update.hasError())?500:200, "text/plain", (Update.hasError())?"FAIL":"OK");
response->addHeader("Connection", "close");
response->addHeader("Access-Control-Allow-Origin", "*");
request->send(response);
restartRequired = true;
}, [](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
//Upload handler chunks in data
if (!index) {
content_len = request->contentLength();
#if defined(ESP8266)
int cmd = (filename.indexOf("spiffs") > -1) ? U_FS : U_FLASH;
Update.runAsync(true);
if (!Update.begin(content_len, cmd)){ // Start with max available size
#elif defined(ESP32)
int cmd = (filename.indexOf("spiffs") > -1) ? U_SPIFFS : U_FLASH;
if (!Update.begin(UPDATE_SIZE_UNKNOWN, cmd)) { // Start with max available size
#endif
Update.printError(Serial);
}
}
// Write chunked data to the free sketch space
if (Update.write(data, len) != len) {
Update.printError(Serial);
}
if (final) { // if the final flag is set then this is the last frame of data
if (Update.end(true)) { //true to set the size to the current progress
}
}
});
}
void loop(){
if(restartRequired){
yield();
delay(1000);
yield();
#if defined(ESP8266)
ESP.restart();
#elif defined(ESP32)
esp_task_wdt_init(1,true);
esp_task_wdt_add(NULL);
while(true);
#endif
}
}
private:
AsyncWebServer *_server;
bool restartRequired = false;
};
AsyncElegantOtaClass AsyncElegantOTA;
#endif

File diff suppressed because one or more lines are too long