Skip to content

Commit 63e325f

Browse files
committed
Update documentation and examples
1 parent 109fc10 commit 63e325f

File tree

7 files changed

+30
-13
lines changed

7 files changed

+30
-13
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,13 @@ const char *password = "";
156156

157157
esp32FOTA esp32FOTA("esp32-fota-http", "1.0.0");
158158

159+
const char* manifest_url = "http://server/fota/fota.json";
160+
159161
void setup()
160162
{
161163
Serial.begin(115200);
162164
setup_wifi();
163-
esp32FOTA.setManifestURL( "http://server/fota/fota.json" );
165+
esp32FOTA.setManifestURL( manifest_url );
164166
// esp32FOTA.useDeviceId( true ); // optionally append the device ID to the HTTP query
165167
}
166168

@@ -196,6 +198,9 @@ Late init is possible using `FOTAConfig_t`, allowing more complex configurations
196198
197199
esp32FOTA FOTA;
198200
201+
const char* manifest_url = "http://server/fota/fota.json";
202+
const char* fota_name = "esp32-fota-http";
203+
199204
// CryptoFileAsset *MyRootCA = new CryptoFileAsset( "/root_ca.pem", &SPIFFS );
200205
// CryptoFileAsset *MyRSAKey = new CryptoFileAsset( "/rsa_key.pub", &SD );
201206
@@ -206,8 +211,8 @@ void setup()
206211
207212
{
208213
auto cfg = FOTA.getConfig();
209-
cfg.name = "esp32-fota-http";
210-
cfg.manifest_url = "http://server/fota/fota.json";
214+
cfg.name = fota_name;
215+
cfg.manifest_url = manifest_url;
211216
cfg.sem = SemverClass( 1, 0, 0 ); // major, minor, patch
212217
cfg.check_sig = false; // verify signed firmware with rsa public key
213218
cfg.unsafe = true; // disable certificate check when using TLS
@@ -336,10 +341,13 @@ CryptoFileAsset *MyPubKey = new CryptoFileAsset("RSA Key", "/rsa_key.pub", &SD);
336341
Then later in the `setup()`:
337342

338343
```C++
344+
345+
const char* manifest_url = "http://server/fota/fota.json";
346+
339347
void setup()
340348
{
341349
// (...)
342-
esp32FOTA.setManifestURL( "http://server/fota/fota.json" );
350+
esp32FOTA.setManifestURL( manifest_url );
343351
esp32FOTA.setRootCA( MyRootCA );
344352
esp32FOTA.setPubKey( MyPubKey );
345353
}

examples/HTTP/HTTP.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const char *password = "";
2424
// esp32fota esp32fota("<Type of Firme for this device>", <this version>, <validate signature>);
2525
esp32FOTA esp32FOTA("esp32-fota-http", 1, false);
2626

27+
const char* manifest_url = "http://server/fota/fota.json";
28+
2729
void setup_wifi()
2830
{
2931
delay(10);
@@ -44,7 +46,7 @@ void setup_wifi()
4446

4547
void setup()
4648
{
47-
esp32FOTA.setManifestURL( "http://server/fota/fota.json" );
49+
esp32FOTA.setManifestURL( manifest_url );
4850
Serial.begin(115200);
4951
setup_wifi();
5052
}

examples/HTTP/HTTPS.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const char *password = "";
3030

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

3435
void setup_wifi()
3536
{
@@ -54,7 +55,7 @@ void setup()
5455
// Provide spiffs with root_ca.pem to validate server certificate
5556
SPIFFS.begin(true);
5657

57-
esp32FOTA.setManifestURL( "http://server/fota/fota.json" );
58+
esp32FOTA.setManifestURL( manifest_url );
5859
Serial.begin(115200);
5960
setup_wifi();
6061
}

examples/HTTP/HTTPS_without_root_cert.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
esp32 firmware OTA
3-
3+
44
Purpose: Perform an OTA update from a bin located on a webserver (HTTPS) without having a root cert
55
66
Setup:
77
Step 1 : Set your WiFi (ssid & password)
88
Step 2 : set esp32fota()
9-
9+
1010
Upload:
1111
Step 1 : Menu > Sketch > Export Compiled Library. The bin file will be saved in the sketch folder (Menu > Sketch > Show Sketch folder)
1212
Step 2 : Upload it to your webserver
@@ -29,6 +29,7 @@ const char *password = "";
2929

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

3334
void setup_wifi()
3435
{
@@ -50,8 +51,8 @@ void setup_wifi()
5051

5152
void setup()
5253
{
53-
54-
esp32FOTA.checkURL = "https://server/fota/fota.json";
54+
55+
esp32FOTA.checkURL = manifest_url;
5556
Serial.begin(115200);
5657
setup_wifi();
5758
}

examples/HTTP/HTTP_signature_check.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const char *password = "";
2828
// esp32fota esp32fota("<Type of Firme for this device>", <this version>, <validate signature>);
2929
esp32FOTA esp32FOTA("esp32-fota-http", 1, true);
3030

31+
const char* manifest_url = "http://server/fota/fota.json";
32+
3133
void setup_wifi()
3234
{
3335
delay(10);
@@ -51,7 +53,7 @@ void setup_wifi()
5153

5254
void setup()
5355
{
54-
esp32FOTA.setManifestURL( "http://server/fota/fota.json" );
56+
esp32FOTA.setManifestURL( manifest_url );
5557
Serial.begin(115200);
5658
setup_wifi();
5759
}

examples/forceUpdate/forceUpdate.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ const char *password = "";
2424
// esp32fota esp32fota("<Type of Firmware for this device>", <this version>, <validate signature>);
2525
esp32FOTA esp32FOTA("esp32-fota-http", 1, false);
2626

27+
const char* manifest_url = "http://server/fota/fota.json";
28+
2729
void setup()
2830
{
29-
esp32FOTA.setManifestURL( "http://server/fota/fota.json" );
31+
esp32FOTA.setManifestURL( manifest_url );
3032
Serial.begin(115200);
3133
setup_wifi();
3234
}

examples/withDeviceID/withDeviceID.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ const char *password = "";
2323

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

2728
void setup()
2829
{
2930
Serial.begin(115200);
3031
setup_wifi();
3132

32-
esp32FOTA.setManifestURL( "http://server/fota/fota.json" );
33+
esp32FOTA.setManifestURL( manifest_url );
3334
esp32FOTA.useDeviceId( true );
3435
}
3536

0 commit comments

Comments
 (0)