Skip to content

Commit

Permalink
Merge pull request #119 from chrisjoyce911/0.2.7
Browse files Browse the repository at this point in the history
0.2.7
  • Loading branch information
tobozo authored Dec 10, 2022
2 parents ae10808 + 744c362 commit f9de9c6
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 98 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,34 @@ jobs:
- name: Compile examples
uses: arduino/compile-sketches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fqbn: esp32:esp32:esp32
platforms: |
- name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
libraries: |
- name: esp32FOTA
path: ./
source-path: ./
- name: ArduinoJson
- name: ESP32-targz
- name: esp32-flashz
source-url: https://github.com/vortigont/esp32-flashz.git
#sketch-paths: |
#- examples/HTTP/HTTP/HTTP.ino
sketch-paths: |
- examples/withDeviceID/withDeviceID.ino
- examples/forceUpdate/forceUpdate.ino
- examples/HTTP/HTTP_signature_check/HTTP_signature_check.ino
- examples/HTTP/HTTPS/HTTPS.ino
- examples/HTTP/HTTPS_without_root_cert/HTTPS_without_root_cert.ino
- examples/HTTP/HTTP/HTTP.ino
- examples/anyFS/anyFS.ino
- examples/anyFS/test/5.sig-in-progmem/5.sig-in-progmem.ino
- examples/anyFS/test/4.cert-in-littlefs/4.cert-in-littlefs.ino
- examples/anyFS/test/1.2.nosecurity.gz/1.2.nosecurity.gz.ino
- examples/anyFS/test/2.cert-in-spiffs/2.cert-in-spiffs.ino
- examples/anyFS/test/3.cert-in-progmem/3.cert-in-progmem.ino
- examples/anyFS/test/99.final-stage/99.final-stage.ino
- examples/anyFS/test/1.3.nosecurity.zz/1.3.nosecurity.zz.ino
- examples/anyFS/test/1.1.nosecurity/1.1.nosecurity.ino
cli-compile-flags: |
- --warnings="default"
12 changes: 4 additions & 8 deletions examples/HTTP/HTTP/HTTP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#include <esp32fota.h>
#include <WiFi.h>

// Change to your WiFi credentials
const char *ssid = "";
const char *password = "";

// esp32fota esp32fota("<Type of Firme for this device>", <this version>, <validate signature>);
esp32FOTA esp32FOTA("esp32-fota-http", 1, false);
Expand All @@ -29,10 +26,8 @@ const char* manifest_url = "http://server/fota/fota.json";
void setup_wifi()
{
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi");
WiFi.begin(); // no WiFi creds in this demo :-)

while (WiFi.status() != WL_CONNECTED)
{
Expand All @@ -46,8 +41,9 @@ void setup_wifi()

void setup()
{
esp32FOTA.setManifestURL( manifest_url );
Serial.begin(115200);
esp32FOTA.setManifestURL( manifest_url );
esp32FOTA.printConfig();
setup_wifi();
}

Expand Down
18 changes: 8 additions & 10 deletions examples/HTTP/HTTPS/HTTPS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,18 @@
#include <esp32fota.h>


// Change to your WiFi credentials
const char *ssid = "";
const char *password = "";

// esp32fota esp32fota("<Type of Firme for this device>", <this version>, <validate signature>);
esp32FOTA esp32FOTA("esp32-fota-http", 1, false);
const char* manifest_url = "http://server/fota/fota.json";
const char* manifest_url = "https://server/fota/fota.json";

CryptoFileAsset *MyRootCA = new CryptoFileAsset( "/root_ca.pem", &SPIFFS );

void setup_wifi()
{
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
Serial.print("Connecting to WiFi");

WiFi.begin(ssid, password);
WiFi.begin(); // no WiFi creds in this demo :-)

while (WiFi.status() != WL_CONNECTED)
{
Expand All @@ -52,11 +49,12 @@ void setup_wifi()

void setup()
{
Serial.begin(115200);
// Provide spiffs with root_ca.pem to validate server certificate
SPIFFS.begin(true);

esp32FOTA.setManifestURL( manifest_url );
Serial.begin(115200);
esp32FOTA.setRootCA( MyRootCA );
esp32FOTA.printConfig();
setup_wifi();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,16 @@
#include <esp32fota.h>


// Change to your WiFi credentials
const char *ssid = "";
const char *password = "";

// esp32fota esp32fota("<Type of Firmware for this device>", <this version>, <validate signature>, <allow insecure https>);
esp32FOTA esp32FOTA("esp32-fota-http", 1, false, true);
const char* manifest_url = "http://server/fota/fota.json";

void setup_wifi()
{
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
Serial.print("Connecting to WiFi");

WiFi.begin(ssid, password);
WiFi.begin(); // no WiFi creds in this demo :-)

while (WiFi.status() != WL_CONNECTED)
{
Expand All @@ -51,9 +46,9 @@ void setup_wifi()

void setup()
{

esp32FOTA.checkURL = manifest_url;
Serial.begin(115200);
esp32FOTA.setManifestURL( manifest_url );
esp32FOTA.printConfig();
setup_wifi();
}

Expand Down
13 changes: 6 additions & 7 deletions examples/HTTP/HTTP_signature_check/HTTP_signature_check.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@

#include <esp32fota.h>

// Change to your WiFi credentials
const char *ssid = "";
const char *password = "";

// esp32fota esp32fota("<Type of Firme for this device>", <this version>, <validate signature>);
esp32FOTA esp32FOTA("esp32-fota-http", 1, true);

const char* manifest_url = "http://server/fota/fota.json";
CryptoFileAsset *MyRSAKey = new CryptoFileAsset( "/rsa_key.pub", &SPIFFS );

void setup_wifi()
{
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
Serial.print("Connecting to WiFi");

// Need to provide SPIFFS with rsa_key.pub inside.
SPIFFS.begin( true );

WiFi.begin(ssid, password);
WiFi.begin(); // no WiFi creds in this demo :-)

while (WiFi.status() != WL_CONNECTED)
{
Expand All @@ -53,8 +50,10 @@ void setup_wifi()

void setup()
{
esp32FOTA.setManifestURL( manifest_url );
Serial.begin(115200);
esp32FOTA.setManifestURL( manifest_url );
esp32FOTA.setPubKey( MyRSAKey );
esp32FOTA.printConfig();
setup_wifi();
}

Expand Down
6 changes: 3 additions & 3 deletions examples/anyFS/anyFS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void setup()
{
auto cfg = FOTA.getConfig();

cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
Expand All @@ -92,7 +92,7 @@ void setup()
FOTA.setConfig( cfg );
}


FOTA.printConfig();
// FOTA.setStatusChecker( WiFiConnected );


Expand Down
5 changes: 3 additions & 2 deletions examples/anyFS/test/1.1.nosecurity/1.1.nosecurity.ino
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ void setup()

{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
//cfg.root_ca = MyRootCA;
//cfg.pub_key = MyRSAKey;
FOTA.setConfig( cfg );
}
FOTA.printConfig();

setup_wifi();
}
Expand Down
5 changes: 3 additions & 2 deletions examples/anyFS/test/1.2.nosecurity.gz/1.2.nosecurity.gz.ino
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ void setup()

{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
//cfg.root_ca = MyRootCA;
//cfg.pub_key = MyRSAKey;
FOTA.setConfig( cfg );
}
FOTA.printConfig();

setup_wifi();
}
Expand Down
5 changes: 3 additions & 2 deletions examples/anyFS/test/1.3.nosecurity.zz/1.3.nosecurity.zz.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ void setup()

{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
//cfg.root_ca = MyRootCA;
//cfg.pub_key = MyRSAKey;
FOTA.setConfig( cfg );
}
FOTA.printConfig();

setup_wifi();
}
Expand Down
5 changes: 3 additions & 2 deletions examples/anyFS/test/2.cert-in-spiffs/2.cert-in-spiffs.ino
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ void setup()

{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
cfg.root_ca = MyRootCA;
//cfg.pub_key = MyRSAKey;
FOTA.setConfig( cfg );
}
FOTA.printConfig();

setup_wifi();
}
Expand Down
5 changes: 3 additions & 2 deletions examples/anyFS/test/3.cert-in-progmem/3.cert-in-progmem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ void setup()

{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
cfg.root_ca = MyRootCA;
//cfg.pub_key = MyRSAKey;
FOTA.setConfig( cfg );
}
FOTA.printConfig();

setup_wifi();
}
Expand Down
5 changes: 3 additions & 2 deletions examples/anyFS/test/4.cert-in-littlefs/4.cert-in-littlefs.ino
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ void setup()

{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
cfg.root_ca = MyRootCA;
cfg.pub_key = MyRSAKey;
FOTA.setConfig( cfg );
}
FOTA.printConfig();

setup_wifi();

Expand Down
5 changes: 3 additions & 2 deletions examples/anyFS/test/5.sig-in-progmem/5.sig-in-progmem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ void setup()

{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.name = (char*)firmware_name;
cfg.manifest_url = (char*)FOTA_URL;
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
cfg.root_ca = MyRootCA;
cfg.pub_key = MyRSAKey;
FOTA.setConfig( cfg );
}
FOTA.printConfig();

setup_wifi();
}
Expand Down
25 changes: 12 additions & 13 deletions examples/forceUpdate/forceUpdate.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,18 @@
#include <esp32fota.h>
#include <WiFi.h>

// Change to your WiFi credentials
const char *ssid = "";
const char *password = "";

// esp32fota esp32fota("<Type of Firmware for this device>", <this version>, <validate signature>);
esp32FOTA esp32FOTA("esp32-fota-http", 1, false);

const char* manifest_url = "http://server/fota/fota.json";

void setup()
{
esp32FOTA.setManifestURL( manifest_url );
Serial.begin(115200);
setup_wifi();
}

void setup_wifi()
{
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
Serial.print("Connecting to WiFi");

WiFi.begin(ssid, password);
WiFi.begin(); // no WiFi creds in this demo :-)

while (WiFi.status() != WL_CONNECTED)
{
Expand All @@ -51,6 +40,16 @@ void setup_wifi()
Serial.println(WiFi.localIP());
}


void setup()
{
Serial.begin(115200);
esp32FOTA.setManifestURL( manifest_url );
esp32FOTA.printConfig();
setup_wifi();
}


void loop()
{
delay(2000);
Expand Down
Loading

0 comments on commit f9de9c6

Please sign in to comment.