diff --git a/.github/workflows/arduino.yml b/.github/workflows/arduino.yml index c69e893..ea2e55c 100644 --- a/.github/workflows/arduino.yml +++ b/.github/workflows/arduino.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile examples uses: arduino/compile-sketches@v1 diff --git a/.github/workflows/platformio.yml b/.github/workflows/platformio.yml index 24b1c5c..3b7bfca 100644 --- a/.github/workflows/platformio.yml +++ b/.github/workflows/platformio.yml @@ -26,7 +26,7 @@ jobs: matrix: python-version: [3.7] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -51,7 +51,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: arduino/arduino-lint-action@v1 with: project-type: library diff --git a/library.json b/library.json index e666db7..df6ef0f 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "esp32FOTA", - "version": "0.2.7", + "version": "0.2.8", "keywords": "firmware, OTA, Over The Air Updates, ArduinoOTA", "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.", "examples": "examples/*/*.ino", diff --git a/library.properties b/library.properties index 11a9da3..f99b726 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=esp32FOTA -version=0.2.7 +version=0.2.8 author=Chris Joyce maintainer=Chris Joyce sentence=A simple library for firmware OTA updates diff --git a/src/esp32FOTA.cpp b/src/esp32FOTA.cpp index 0a4ee45..69dd749 100644 --- a/src/esp32FOTA.cpp +++ b/src/esp32FOTA.cpp @@ -32,17 +32,25 @@ #include "esp32FOTA.hpp" -#include "mbedtls/pk.h" -#include "mbedtls/md.h" -#include "mbedtls/md_internal.h" +// arduino-esp32 core 2.x => 3.x migration +#if __has_include("md_wrap.h") + #include "md_wrap.h" +#else + #include "mbedtls/pk.h" + #include "mbedtls/md.h" + #include "mbedtls/md_internal.h" +#endif +// arduino-esp32 core 2.x => 3.x migration +#if !defined SPI_FLASH_SEC_SIZE + #include "spi_flash_mmap.h" +#endif + #include "esp_ota_ops.h" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - - static int64_t getHTTPStream( esp32FOTA* fota, int partition ); static int64_t getFileStream( esp32FOTA* fota, int partition ); static int64_t getSerialStream( esp32FOTA* fota, int partition ); diff --git a/src/esp32FOTA.hpp b/src/esp32FOTA.hpp index f84cb2e..e472437 100644 --- a/src/esp32FOTA.hpp +++ b/src/esp32FOTA.hpp @@ -38,7 +38,17 @@ extern "C" { } #include -#include +#include + +// arduino-esp32 core 2.x => 3.x migration +#if __has_include() + #include + #define ClientSecure NetworkClientSecure +#else + #include + #define ClientSecure WiFiClientSecure +#endif + #include #include #include @@ -86,8 +96,6 @@ extern "C" { #endif - - #if __has_include() #pragma message "Using FlashZ as Update agent" #include @@ -325,7 +333,7 @@ class esp32FOTA FOTAConfig_t getConfig() { return _cfg; }; FOTAStreamType_t getStreamType() { return _stream_type; } HTTPClient* getHTTPCLient() { return &_http; } - WiFiClientSecure* getWiFiClient() { return &_client; } + ClientSecure* getWiFiClient() { return &_client; } fs::File* getFotaFilePtr() { return &_file; } Stream* getFotaStreamPtr() { return _stream; } fs::FS* getFotaFS() { return _fs; } @@ -341,7 +349,7 @@ class esp32FOTA private: HTTPClient _http; - WiFiClientSecure _client; + ClientSecure _client; Stream *_stream; fs::File _file;