1
1
/*
2
- An example of how to use HTTpClient to download an encrypted and plain image files OTA from a web server.
2
+ An example of how to use HTTPClient to download an encrypted and plain image files OTA from a web server.
3
3
This example uses Wifi & HTTPClient to connect to webserver and two functions for obtaining firmware image from webserver.
4
4
One uses the example 'updater.php' code on server to check and/or send relavent download firmware image file,
5
5
the other directly downloads the firmware file from web server.
6
6
7
7
To use:-
8
- Make a folder/directory on your webserve where your firmware images will be uploaded to. ie. /firmware
8
+ Make a folder/directory on your webserver where your firmware images will be uploaded to. ie. /firmware
9
9
The 'updater.php' file can also be uploaded to the same folder. Edit and change definitions in 'update.php' to suit your needs.
10
10
In sketch:
11
- set HTTPUPDATE_HOST to domain name or IP address if on LAN of your web server
11
+ set HTTPUPDATE_HOST to domain name or IP address if on LAN of your web server
12
12
set HTTPUPDATE_UPDATER_URI to path and file to call 'updater.php'
13
13
or set HTTPUPDATE_DIRECT_URI to path and firmware file to download
14
14
edit other HTTPUPDATE_ as needed
@@ -35,7 +35,8 @@ OTA_MODE options:-
35
35
36
36
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/
37
37
38
- espsecure.py encrypt_flash_data -k ota_key.bin --flash_crypt_conf 0xf -a 0x1000 -o output_filename.bin source_filename.bin
38
+ Example:
39
+ espsecure.py encrypt_flash_data -k ota_key.bin --flash_crypt_conf 0xf -a 0x4320 -o output_filename.bin source_filename.bin
39
40
40
41
espsecure.py encrypt_flash_data = runs the idf encryption function to make a encrypted output file from a source file
41
42
-k text = path/filename to the AES 256bit(32byte) encryption key file
@@ -69,7 +70,7 @@ const uint8_t OTA_KEY[32] = {'0', '1', '2', '3', '4', '5', '6', '7',
69
70
*/
70
71
71
72
// const uint8_t OTA_KEY[33] = "0123456789 this a simpletest key";
72
-
73
+
73
74
const uint32_t OTA_ADDRESS = 0x4320 ;
74
75
const uint32_t OTA_CFG = 0x0f ;
75
76
const uint32_t OTA_MODE = U_AES_DECRYPT_AUTO;
@@ -242,7 +243,7 @@ bool http_updater(const String& host, const uint16_t& port, String uri, const bo
242
243
if (!download){
243
244
Serial.printf ( " Found V%s Firmware\n " , http.header (" version" ).c_str () );
244
245
}else {
245
- Serial.printf ( " Downloading & Installing V%s Firmware\n " , http.header (" version" ).c_str () );
246
+ Serial.printf ( " Downloading & Installing V%s Firmware\n " , http.header (" version" ).c_str () );
246
247
}
247
248
if ( !download || http_downloadUpdate (http) ){
248
249
http.end (); // end connection
0 commit comments