Skip to content

Commit 5a835bb

Browse files
authored
arduino-esp32 core 2.x => 3.x migration
2 parents c8573d1 + 511715c commit 5a835bb

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

.github/workflows/arduino.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313

1414
- name: Checkout repository
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
- name: Compile examples
1818
uses: arduino/compile-sketches@v1

.github/workflows/platformio.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
matrix:
2727
python-version: [3.7]
2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030
- name: Set up Python ${{ matrix.python-version }}
3131
uses: actions/setup-python@v4
3232
with:
@@ -51,7 +51,7 @@ jobs:
5151
lint:
5252
runs-on: ubuntu-latest
5353
steps:
54-
- uses: actions/checkout@v3
54+
- uses: actions/checkout@v4
5555
- uses: arduino/arduino-lint-action@v1
5656
with:
5757
project-type: library

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "esp32FOTA",
3-
"version": "0.2.7",
3+
"version": "0.2.8",
44
"keywords": "firmware, OTA, Over The Air Updates, ArduinoOTA",
55
"description": "Allows for firmware to be updated from a webserver, the device can check for updates at any time. Uses a simple JSON file to outline if a new firmware is avaiable.",
66
"examples": "examples/*/*.ino",

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=esp32FOTA
2-
version=0.2.7
2+
version=0.2.8
33
author=Chris Joyce
44
maintainer=Chris Joyce <chris@joyce.id.au>
55
sentence=A simple library for firmware OTA updates

src/esp32FOTA.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,25 @@
3232

3333
#include "esp32FOTA.hpp"
3434

35-
#include "mbedtls/pk.h"
36-
#include "mbedtls/md.h"
37-
#include "mbedtls/md_internal.h"
35+
// arduino-esp32 core 2.x => 3.x migration
36+
#if __has_include("md_wrap.h")
37+
#include "md_wrap.h"
38+
#else
39+
#include "mbedtls/pk.h"
40+
#include "mbedtls/md.h"
41+
#include "mbedtls/md_internal.h"
42+
#endif
43+
// arduino-esp32 core 2.x => 3.x migration
44+
#if !defined SPI_FLASH_SEC_SIZE
45+
#include "spi_flash_mmap.h"
46+
#endif
47+
3848
#include "esp_ota_ops.h"
3949

4050
#pragma GCC diagnostic push
4151
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
4252
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
4353

44-
45-
4654
static int64_t getHTTPStream( esp32FOTA* fota, int partition );
4755
static int64_t getFileStream( esp32FOTA* fota, int partition );
4856
static int64_t getSerialStream( esp32FOTA* fota, int partition );

src/esp32FOTA.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ extern "C" {
3838
}
3939

4040
#include <map>
41-
#include <WiFiClientSecure.h>
41+
#include <WiFi.h>
42+
43+
// arduino-esp32 core 2.x => 3.x migration
44+
#if __has_include(<NetworkClientSecure.h>)
45+
#include <NetworkClientSecure.h>
46+
#define ClientSecure NetworkClientSecure
47+
#else
48+
#include <WiFiClientSecure.h>
49+
#define ClientSecure WiFiClientSecure
50+
#endif
51+
4252
#include <HTTPClient.h>
4353
#include <ArduinoJson.h>
4454
#include <FS.h>
@@ -86,8 +96,6 @@ extern "C" {
8696
#endif
8797

8898

89-
90-
9199
#if __has_include(<flashz.hpp>)
92100
#pragma message "Using FlashZ as Update agent"
93101
#include <flashz.hpp>
@@ -325,7 +333,7 @@ class esp32FOTA
325333
FOTAConfig_t getConfig() { return _cfg; };
326334
FOTAStreamType_t getStreamType() { return _stream_type; }
327335
HTTPClient* getHTTPCLient() { return &_http; }
328-
WiFiClientSecure* getWiFiClient() { return &_client; }
336+
ClientSecure* getWiFiClient() { return &_client; }
329337
fs::File* getFotaFilePtr() { return &_file; }
330338
Stream* getFotaStreamPtr() { return _stream; }
331339
fs::FS* getFotaFS() { return _fs; }
@@ -341,7 +349,7 @@ class esp32FOTA
341349
private:
342350

343351
HTTPClient _http;
344-
WiFiClientSecure _client;
352+
ClientSecure _client;
345353
Stream *_stream;
346354
fs::File _file;
347355

0 commit comments

Comments
 (0)