forked from ayushsharma82/ElegantOTA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb68602
commit 9bfc04e
Showing
7 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,40 @@ | ||
#include <ESP8266WiFi.h> | ||
#include <WiFiClient.h> | ||
#include <ESP8266WebServer.h> | ||
#include <ElegantOTA.h> | ||
|
||
const char* ssid = "........"; | ||
const char* password = "........"; | ||
|
||
ESP8266WebServer 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("/", []() { | ||
server.send(200, "text/plain", "Hi! I am ESP8266."); | ||
}); | ||
|
||
ElegantOTA.begin(&server); // Start ElegantOTA | ||
server.begin(); | ||
Serial.println("HTTP server started"); | ||
} | ||
|
||
void loop(void) { | ||
server.handleClient(); | ||
} |
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,2 @@ | ||
ElegantOTA KEYWORD1 | ||
begin KEYWORD2 |
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,21 @@ | ||
{ | ||
"name": "ElegantOTA", | ||
"keywords": "ElegantOTA, OTA, Update, ESP8266, ESP32, Over, the, air", | ||
"description": "Perform OTAs for ESP8266 Elegantly!", | ||
"repository": | ||
{ | ||
"type": "git", | ||
"url": "https://github.com/ayushsharma82/ElegantOTA.git" | ||
}, | ||
"authors": | ||
[ | ||
{ | ||
"name": "Ayush Sharma", | ||
"email": "asrocks5@gmail.com", | ||
"maintainer": true | ||
} | ||
], | ||
"version": "1.0.0", | ||
"frameworks": "arduino", | ||
"platforms": "espressif" | ||
} |
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,9 @@ | ||
name=ElegantOTA | ||
version=1.0.0 | ||
author=Ayush Sharma | ||
category=Communication | ||
maintainer=Ayush Sharma <asrocks5@gmail.com> | ||
sentence=Perform OTAs for ESP8266 Elegantly! | ||
paragraph=A User Interface Library which provides interactive elements for your Over the Air Updates on ESP8266. UI has a size of only 50Kb! | ||
url=https://github.com/ayushsharma82/ElegantOTA | ||
architectures=esp8266 |
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,41 @@ | ||
#ifndef ElegantOTA_h | ||
#define ElegantOTA_h | ||
|
||
#if defined(ESP8266) | ||
#include "Arduino.h" | ||
#include "stdlib_noniso.h" | ||
#include "elegantWebpage.h" | ||
#endif | ||
|
||
#if defined(ESP8266) | ||
#define HARDWARE "ESP8266" | ||
#include "ESP8266WiFi.h" | ||
#include "WiFiClient.h" | ||
#include "ESP8266WebServer.h" | ||
#include "ESP8266HTTPUpdateServer.h" | ||
#endif | ||
|
||
class ElegantOtaClass{ | ||
public: | ||
#if defined(ESP8266) | ||
void begin(ESP8266WebServer *server){ | ||
_server = server; | ||
|
||
_server->on("/update", HTTP_GET, [&](){ | ||
_server->sendHeader("Content-Encoding", "gzip"); | ||
_server->send_P(200, "text/html", (const char*)ELEGANT_HTML, ELEGANT_HTML_SIZE); | ||
}); | ||
|
||
_httpUpdater.setup(server); | ||
} | ||
#endif | ||
|
||
private: | ||
#if defined(ESP8266) | ||
ESP8266WebServer *_server; | ||
ESP8266HTTPUpdateServer _httpUpdater; | ||
#endif | ||
}; | ||
|
||
ElegantOtaClass ElegantOTA; | ||
#endif |
Large diffs are not rendered by default.
Oops, something went wrong.