Skip to content

Commit f9de9c6

Browse files
authored
Merge pull request #119 from chrisjoyce911/0.2.7
0.2.7
2 parents ae10808 + 744c362 commit f9de9c6

File tree

19 files changed

+134
-98
lines changed

19 files changed

+134
-98
lines changed

.github/workflows/arduino.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,34 @@ jobs:
1717
- name: Compile examples
1818
uses: arduino/compile-sketches@v1
1919
with:
20-
github-token: ${{ secrets.GITHUB_TOKEN }}
2120
fqbn: esp32:esp32:esp32
2221
platforms: |
2322
- name: esp32:esp32
2423
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
2524
libraries: |
2625
- name: esp32FOTA
27-
path: ./
26+
source-path: ./
2827
- name: ArduinoJson
2928
- name: ESP32-targz
3029
- name: esp32-flashz
3130
source-url: https://github.com/vortigont/esp32-flashz.git
3231
33-
#sketch-paths: |
34-
#- examples/HTTP/HTTP/HTTP.ino
32+
sketch-paths: |
33+
- examples/withDeviceID/withDeviceID.ino
34+
- examples/forceUpdate/forceUpdate.ino
35+
- examples/HTTP/HTTP_signature_check/HTTP_signature_check.ino
36+
- examples/HTTP/HTTPS/HTTPS.ino
37+
- examples/HTTP/HTTPS_without_root_cert/HTTPS_without_root_cert.ino
38+
- examples/HTTP/HTTP/HTTP.ino
39+
- examples/anyFS/anyFS.ino
40+
- examples/anyFS/test/5.sig-in-progmem/5.sig-in-progmem.ino
41+
- examples/anyFS/test/4.cert-in-littlefs/4.cert-in-littlefs.ino
42+
- examples/anyFS/test/1.2.nosecurity.gz/1.2.nosecurity.gz.ino
43+
- examples/anyFS/test/2.cert-in-spiffs/2.cert-in-spiffs.ino
44+
- examples/anyFS/test/3.cert-in-progmem/3.cert-in-progmem.ino
45+
- examples/anyFS/test/99.final-stage/99.final-stage.ino
46+
- examples/anyFS/test/1.3.nosecurity.zz/1.3.nosecurity.zz.ino
47+
- examples/anyFS/test/1.1.nosecurity/1.1.nosecurity.ino
48+
3549
cli-compile-flags: |
3650
- --warnings="default"

examples/HTTP/HTTP/HTTP.ino

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
#include <esp32fota.h>
1818
#include <WiFi.h>
1919

20-
// Change to your WiFi credentials
21-
const char *ssid = "";
22-
const char *password = "";
2320

2421
// esp32fota esp32fota("<Type of Firme for this device>", <this version>, <validate signature>);
2522
esp32FOTA esp32FOTA("esp32-fota-http", 1, false);
@@ -29,10 +26,8 @@ const char* manifest_url = "http://server/fota/fota.json";
2926
void setup_wifi()
3027
{
3128
delay(10);
32-
Serial.print("Connecting to ");
33-
Serial.println(ssid);
34-
35-
WiFi.begin(ssid, password);
29+
Serial.print("Connecting to WiFi");
30+
WiFi.begin(); // no WiFi creds in this demo :-)
3631

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

4742
void setup()
4843
{
49-
esp32FOTA.setManifestURL( manifest_url );
5044
Serial.begin(115200);
45+
esp32FOTA.setManifestURL( manifest_url );
46+
esp32FOTA.printConfig();
5147
setup_wifi();
5248
}
5349

examples/HTTP/HTTPS/HTTPS.ino

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,18 @@
2424
#include <esp32fota.h>
2525

2626

27-
// Change to your WiFi credentials
28-
const char *ssid = "";
29-
const char *password = "";
30-
3127
// esp32fota esp32fota("<Type of Firme for this device>", <this version>, <validate signature>);
3228
esp32FOTA esp32FOTA("esp32-fota-http", 1, false);
33-
const char* manifest_url = "http://server/fota/fota.json";
29+
const char* manifest_url = "https://server/fota/fota.json";
30+
31+
CryptoFileAsset *MyRootCA = new CryptoFileAsset( "/root_ca.pem", &SPIFFS );
3432

3533
void setup_wifi()
3634
{
3735
delay(10);
38-
Serial.print("Connecting to ");
39-
Serial.println(ssid);
36+
Serial.print("Connecting to WiFi");
4037

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

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

5350
void setup()
5451
{
52+
Serial.begin(115200);
5553
// Provide spiffs with root_ca.pem to validate server certificate
5654
SPIFFS.begin(true);
57-
5855
esp32FOTA.setManifestURL( manifest_url );
59-
Serial.begin(115200);
56+
esp32FOTA.setRootCA( MyRootCA );
57+
esp32FOTA.printConfig();
6058
setup_wifi();
6159
}
6260

examples/HTTP/HTTPS_without_root_cert/HTTPS_without_root_cert.ino

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,16 @@
2323
#include <esp32fota.h>
2424

2525

26-
// Change to your WiFi credentials
27-
const char *ssid = "";
28-
const char *password = "";
29-
3026
// esp32fota esp32fota("<Type of Firmware for this device>", <this version>, <validate signature>, <allow insecure https>);
3127
esp32FOTA esp32FOTA("esp32-fota-http", 1, false, true);
3228
const char* manifest_url = "http://server/fota/fota.json";
3329

3430
void setup_wifi()
3531
{
3632
delay(10);
37-
Serial.print("Connecting to ");
38-
Serial.println(ssid);
33+
Serial.print("Connecting to WiFi");
3934

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

4237
while (WiFi.status() != WL_CONNECTED)
4338
{
@@ -51,9 +46,9 @@ void setup_wifi()
5146

5247
void setup()
5348
{
54-
55-
esp32FOTA.checkURL = manifest_url;
5649
Serial.begin(115200);
50+
esp32FOTA.setManifestURL( manifest_url );
51+
esp32FOTA.printConfig();
5752
setup_wifi();
5853
}
5954

examples/HTTP/HTTP_signature_check/HTTP_signature_check.ino

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,22 @@
2121

2222
#include <esp32fota.h>
2323

24-
// Change to your WiFi credentials
25-
const char *ssid = "";
26-
const char *password = "";
2724

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

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

3331
void setup_wifi()
3432
{
3533
delay(10);
36-
Serial.print("Connecting to ");
37-
Serial.println(ssid);
34+
Serial.print("Connecting to WiFi");
3835

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

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

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

5451
void setup()
5552
{
56-
esp32FOTA.setManifestURL( manifest_url );
5753
Serial.begin(115200);
54+
esp32FOTA.setManifestURL( manifest_url );
55+
esp32FOTA.setPubKey( MyRSAKey );
56+
esp32FOTA.printConfig();
5857
setup_wifi();
5958
}
6059

examples/anyFS/anyFS.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ void setup()
8181
{
8282
auto cfg = FOTA.getConfig();
8383

84-
cfg.name = firmware_name;
85-
cfg.manifest_url = FOTA_URL;
84+
cfg.name = (char*)firmware_name;
85+
cfg.manifest_url = (char*)FOTA_URL;
8686
cfg.sem = SemverClass( firmware_version );
8787
cfg.check_sig = check_signature;
8888
cfg.unsafe = disable_security;
@@ -92,7 +92,7 @@ void setup()
9292
FOTA.setConfig( cfg );
9393
}
9494

95-
95+
FOTA.printConfig();
9696
// FOTA.setStatusChecker( WiFiConnected );
9797

9898

examples/anyFS/test/1.1.nosecurity/1.1.nosecurity.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ void setup()
6262

6363
{
6464
auto cfg = FOTA.getConfig();
65-
cfg.name = firmware_name;
66-
cfg.manifest_url = FOTA_URL;
65+
cfg.name = (char*)firmware_name;
66+
cfg.manifest_url = (char*)FOTA_URL;
6767
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
6868
cfg.check_sig = check_signature;
6969
cfg.unsafe = disable_security;
7070
//cfg.root_ca = MyRootCA;
7171
//cfg.pub_key = MyRSAKey;
7272
FOTA.setConfig( cfg );
7373
}
74+
FOTA.printConfig();
7475

7576
setup_wifi();
7677
}

examples/anyFS/test/1.2.nosecurity.gz/1.2.nosecurity.gz.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ void setup()
6262

6363
{
6464
auto cfg = FOTA.getConfig();
65-
cfg.name = firmware_name;
66-
cfg.manifest_url = FOTA_URL;
65+
cfg.name = (char*)firmware_name;
66+
cfg.manifest_url = (char*)FOTA_URL;
6767
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
6868
cfg.check_sig = check_signature;
6969
cfg.unsafe = disable_security;
7070
//cfg.root_ca = MyRootCA;
7171
//cfg.pub_key = MyRSAKey;
7272
FOTA.setConfig( cfg );
7373
}
74+
FOTA.printConfig();
7475

7576
setup_wifi();
7677
}

examples/anyFS/test/1.3.nosecurity.zz/1.3.nosecurity.zz.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@ void setup()
6161

6262
{
6363
auto cfg = FOTA.getConfig();
64-
cfg.name = firmware_name;
65-
cfg.manifest_url = FOTA_URL;
64+
cfg.name = (char*)firmware_name;
65+
cfg.manifest_url = (char*)FOTA_URL;
6666
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
6767
cfg.check_sig = check_signature;
6868
cfg.unsafe = disable_security;
6969
//cfg.root_ca = MyRootCA;
7070
//cfg.pub_key = MyRSAKey;
7171
FOTA.setConfig( cfg );
7272
}
73+
FOTA.printConfig();
7374

7475
setup_wifi();
7576
}

examples/anyFS/test/2.cert-in-spiffs/2.cert-in-spiffs.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ void setup()
7070

7171
{
7272
auto cfg = FOTA.getConfig();
73-
cfg.name = firmware_name;
74-
cfg.manifest_url = FOTA_URL;
73+
cfg.name = (char*)firmware_name;
74+
cfg.manifest_url = (char*)FOTA_URL;
7575
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
7676
cfg.check_sig = check_signature;
7777
cfg.unsafe = disable_security;
7878
cfg.root_ca = MyRootCA;
7979
//cfg.pub_key = MyRSAKey;
8080
FOTA.setConfig( cfg );
8181
}
82+
FOTA.printConfig();
8283

8384
setup_wifi();
8485
}

examples/anyFS/test/3.cert-in-progmem/3.cert-in-progmem.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,16 @@ void setup()
6767

6868
{
6969
auto cfg = FOTA.getConfig();
70-
cfg.name = firmware_name;
71-
cfg.manifest_url = FOTA_URL;
70+
cfg.name = (char*)firmware_name;
71+
cfg.manifest_url = (char*)FOTA_URL;
7272
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
7373
cfg.check_sig = check_signature;
7474
cfg.unsafe = disable_security;
7575
cfg.root_ca = MyRootCA;
7676
//cfg.pub_key = MyRSAKey;
7777
FOTA.setConfig( cfg );
7878
}
79+
FOTA.printConfig();
7980

8081
setup_wifi();
8182
}

examples/anyFS/test/4.cert-in-littlefs/4.cert-in-littlefs.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ void setup()
7070

7171
{
7272
auto cfg = FOTA.getConfig();
73-
cfg.name = firmware_name;
74-
cfg.manifest_url = FOTA_URL;
73+
cfg.name = (char*)firmware_name;
74+
cfg.manifest_url = (char*)FOTA_URL;
7575
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
7676
cfg.check_sig = check_signature;
7777
cfg.unsafe = disable_security;
7878
cfg.root_ca = MyRootCA;
7979
cfg.pub_key = MyRSAKey;
8080
FOTA.setConfig( cfg );
8181
}
82+
FOTA.printConfig();
8283

8384
setup_wifi();
8485

examples/anyFS/test/5.sig-in-progmem/5.sig-in-progmem.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ void setup()
6666

6767
{
6868
auto cfg = FOTA.getConfig();
69-
cfg.name = firmware_name;
70-
cfg.manifest_url = FOTA_URL;
69+
cfg.name = (char*)firmware_name;
70+
cfg.manifest_url = (char*)FOTA_URL;
7171
cfg.sem = SemverClass( firmware_version_major, firmware_version_minor, firmware_version_patch );
7272
cfg.check_sig = check_signature;
7373
cfg.unsafe = disable_security;
7474
cfg.root_ca = MyRootCA;
7575
cfg.pub_key = MyRSAKey;
7676
FOTA.setConfig( cfg );
7777
}
78+
FOTA.printConfig();
7879

7980
setup_wifi();
8081
}

examples/forceUpdate/forceUpdate.ino

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,18 @@
1717
#include <esp32fota.h>
1818
#include <WiFi.h>
1919

20-
// Change to your WiFi credentials
21-
const char *ssid = "";
22-
const char *password = "";
2320

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

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

29-
void setup()
30-
{
31-
esp32FOTA.setManifestURL( manifest_url );
32-
Serial.begin(115200);
33-
setup_wifi();
34-
}
35-
3626
void setup_wifi()
3727
{
3828
delay(10);
39-
Serial.print("Connecting to ");
40-
Serial.println(ssid);
29+
Serial.print("Connecting to WiFi");
4130

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

4433
while (WiFi.status() != WL_CONNECTED)
4534
{
@@ -51,6 +40,16 @@ void setup_wifi()
5140
Serial.println(WiFi.localIP());
5241
}
5342

43+
44+
void setup()
45+
{
46+
Serial.begin(115200);
47+
esp32FOTA.setManifestURL( manifest_url );
48+
esp32FOTA.printConfig();
49+
setup_wifi();
50+
}
51+
52+
5453
void loop()
5554
{
5655
delay(2000);

0 commit comments

Comments
 (0)