Skip to content

Commit

Permalink
arduino-esp32 core 2.x => 3.x migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tobozo authored Jun 15, 2024
2 parents c8573d1 + 511715c commit 5a835bb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=esp32FOTA
version=0.2.7
version=0.2.8
author=Chris Joyce
maintainer=Chris Joyce <[email protected]>
sentence=A simple library for firmware OTA updates
Expand Down
18 changes: 13 additions & 5 deletions src/esp32FOTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
18 changes: 13 additions & 5 deletions src/esp32FOTA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ extern "C" {
}

#include <map>
#include <WiFiClientSecure.h>
#include <WiFi.h>

// arduino-esp32 core 2.x => 3.x migration
#if __has_include(<NetworkClientSecure.h>)
#include <NetworkClientSecure.h>
#define ClientSecure NetworkClientSecure
#else
#include <WiFiClientSecure.h>
#define ClientSecure WiFiClientSecure
#endif

#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <FS.h>
Expand Down Expand Up @@ -86,8 +96,6 @@ extern "C" {
#endif




#if __has_include(<flashz.hpp>)
#pragma message "Using FlashZ as Update agent"
#include <flashz.hpp>
Expand Down Expand Up @@ -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; }
Expand All @@ -341,7 +349,7 @@ class esp32FOTA
private:

HTTPClient _http;
WiFiClientSecure _client;
ClientSecure _client;
Stream *_stream;
fs::File _file;

Expand Down

0 comments on commit 5a835bb

Please sign in to comment.