Skip to content

Commit

Permalink
Merge pull request #148 from MathewHDYT/feat_mqtt_interface
Browse files Browse the repository at this point in the history
Adding complete Espressif IDF compatibility
  • Loading branch information
imbeacon committed Oct 10, 2023
2 parents f34a458 + 0cac2a2 commit d6d1722
Show file tree
Hide file tree
Showing 98 changed files with 4,300 additions and 932 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/arduino-compile.yml
Expand Up @@ -18,11 +18,11 @@ on:

env:
SKETCHES_REPORTS_PATH: sketches-reports
SKETCHES_REPORTS_NAME: esp32
SKETCHES_REPORTS_NAME: arduino

jobs:
build:
name: Arduino Uno
name: ${{ matrix.board.fqbn }}
runs-on: ubuntu-latest
env:
LIBRARIES: |
Expand All @@ -31,16 +31,25 @@ jobs:
- name: TBPubSubClient
- name: ArduinoHttpClient
- name: ArduinoJson
- name: StreamUtils
- name: WiFiEsp
- name: TinyGSM
- name: StreamUtils
strategy:
matrix:
board:
# The possible board types for Arduino can be found here https://github.com/arduino/ArduinoCore-avr/blob/master/.github/workflows/compile-platform-examples.yml
- fqbn: "arduino:avr:mega:cpu=atmega2560"
platform-name: avr:mega

steps:
- uses: actions/checkout@v3

- name: Compile examples
uses: arduino/compile-sketches@v1
with:
platforms: ${{ matrix.platforms }}
fqbn: ${{ matrix.board.fqbn }}
libraries: ${{ env.LIBRARIES }}
enable-deltas-report: true
sketch-paths: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/esp32-compile.yml
Expand Up @@ -4,13 +4,13 @@ on:
pull_request:
paths:
- ".github/workflows/esp32-compile.yml"
- "library.properties"
- "library.json"
- "examples/**"
- "src/**"
push:
paths:
- ".github/workflows/esp32-compile.yml"
- "library.properties"
- "library.json"
- "examples/**"
- "src/**"
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/esp8266-compile.yml
Expand Up @@ -4,13 +4,13 @@ on:
pull_request:
paths:
- ".github/workflows/esp8266-compile.yml"
- "library.properties"
- "library.json"
- "examples/**"
- "src/**"
push:
paths:
- ".github/workflows/esp8266-compile.yml"
- "library.properties"
- "library.json"
- "examples/**"
- "src/**"
workflow_dispatch:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/espidf-compile-v4.4.yml
@@ -0,0 +1,38 @@
name: Compile ESP-IDF Sketches for v4.4

on:
pull_request:
paths:
- ".github/workflows/espidf-compile.yml"
- "examples/**"
- "src/**"
push:
paths:
- ".github/workflows/espidf-compile.yml"
- "examples/**"
- "src/**"
workflow_dispatch:
repository_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Build send data example on v4.4
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v4.4
target: esp32
path: 'examples/0014-espressif_esp32_send_data'
- name: Build process OTA over MQTT example on v4.4
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v4.4
target: esp32
path: 'examples/0015-espressif_esp32_process_OTA_MQTT'
38 changes: 38 additions & 0 deletions .github/workflows/espidf-compile-v5.1.yml
@@ -0,0 +1,38 @@
name: Compile ESP-IDF Sketches for v5.1

on:
pull_request:
paths:
- ".github/workflows/espidf-compile.yml"
- "examples/**"
- "src/**"
push:
paths:
- ".github/workflows/espidf-compile.yml"
- "examples/**"
- "src/**"
workflow_dispatch:
repository_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Build send data example on v5.1
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.1
target: esp32
path: 'examples/0014-espressif_esp32_send_data'
- name: Build process OTA over MQTT example on v5.1
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.1
target: esp32
path: 'examples/0015-espressif_esp32_process_OTA_MQTT'
45 changes: 45 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,45 @@
cmake_minimum_required(VERSION 3.12)

set(srcs
src/Arduino_HTTP_Client.cpp
src/Arduino_MQTT_Client.cpp
src/Attribute_Request_Callback.cpp
src/Callback_Watchdog.cpp
src/Arduino_ESP32_Updater.cpp
src/Arduino_ESP8266_Updater.cpp
src/Espressif_Updater.cpp
src/Espressif_MQTT_Client.cpp
src/HashGenerator.cpp
src/Helper.cpp
src/OTA_Update_Callback.cpp
src/Provision_Callback.cpp
src/RPC_Callback.cpp
src/RPC_Request_Callback.cpp
src/RPC_Response.cpp
src/Shared_Attribute_Callback.cpp
src/Telemetry.cpp
src/ThingsBoardDefaultLogger.cpp
)

set(dependencies
mqtt
mbedtls
)

set(private_dependencies
esp_timer
)

if(ESP_PLATFORM)
# Build ThingsBoard Arduino SDK as an ESP-IDF component
idf_component_register(
SRCS ${srcs}
INCLUDE_DIRS "src"
PRIV_INCLUDE_DIRS "src"
REQUIRES ${dependencies}
PRIV_REQUIRES ${private_dependencies}
)
return()
endif()

project(ThingsBoardArduinoSDK VERSION 0.12.0)
15 changes: 15 additions & 0 deletions Kconfig
@@ -0,0 +1,15 @@
menu "ThingsBoard Arduino SDK Configurations"

config THINGSBOARD_ENABLE_DYNAMIC
bool "Removes the need to set MaxFieldAmts in template class, but saves json into DynamicJsonDocument, requiring heap instead of stack memory"
default n
help
If this is disabled the library will use StaticJsonDocument to receive messages from the MQTT broker instead

config THINGSBOARD_ENABLE_DEBUG
bool "Enables debug messages in the ThingsBoard client"
default n
help
If this is enabled the library uses more global constant variables containg messages that are printed

endmenu

0 comments on commit d6d1722

Please sign in to comment.