mirror of
https://github.com/1technophile/OpenMQTTGateway.git
synced 2026-03-12 02:09:29 +01:00
[DEV] Add automatic BT lib replacement for BLE environments (#1860)
So that the replacement is done locally on the development environments but also with the CI
This commit is contained in:
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@@ -97,16 +97,6 @@ jobs:
|
||||
run: |
|
||||
ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]')
|
||||
echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV
|
||||
- name: Trigger framework installation
|
||||
run: platformio run -e esp32dev-all-test
|
||||
- name: Replace libbtdm_app.a file
|
||||
run: cp lib/esp32-bt-lib/esp32/libbtdm_app.a $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a
|
||||
- name: Verify file replacement
|
||||
run: |
|
||||
echo "Listing the file at the target location:"
|
||||
ls -ltr $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/
|
||||
echo "Checking file checksum:"
|
||||
md5sum $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a
|
||||
- name: Run PlatformIO
|
||||
run: platformio run -e ${{ matrix.environments }}
|
||||
- name: Upload Assets
|
||||
|
||||
10
.github/workflows/build_and_docs_to_dev.yml
vendored
10
.github/workflows/build_and_docs_to_dev.yml
vendored
@@ -32,16 +32,6 @@ jobs:
|
||||
run: |
|
||||
ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]')
|
||||
echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV
|
||||
- name: Trigger framework installation
|
||||
run: platformio run -e esp32dev-all-test
|
||||
- name: Replace libbtdm_app.a file
|
||||
run: cp lib/esp32-bt-lib/esp32/libbtdm_app.a $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a
|
||||
- name: Verify file replacement
|
||||
run: |
|
||||
echo "Listing the file at the target location:"
|
||||
ls -ltr $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/
|
||||
echo "Checking file checksum:"
|
||||
md5sum $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a
|
||||
- name: Run PlatformIO
|
||||
run: |
|
||||
export PLATFORMIO_BUILD_FLAGS="'-DDEVELOPMENTOTA=true'"
|
||||
|
||||
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@@ -24,16 +24,6 @@ jobs:
|
||||
run: |
|
||||
ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]')
|
||||
echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV
|
||||
- name: Trigger framework installation
|
||||
run: platformio run -e esp32dev-all-test
|
||||
- name: Replace libbtdm_app.a file
|
||||
run: cp lib/esp32-bt-lib/esp32/libbtdm_app.a $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a
|
||||
- name: Verify file replacement
|
||||
run: |
|
||||
echo "Listing the file at the target location:"
|
||||
ls -ltr $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/
|
||||
echo "Checking file checksum:"
|
||||
md5sum $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a
|
||||
- name: Run PlatformIO
|
||||
run: platformio run
|
||||
- name: Prepare Release Assets
|
||||
|
||||
@@ -51,6 +51,7 @@ custom_hardware = RFBridge v1
|
||||
[env:theengs-bridge]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32dev
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -130,6 +131,7 @@ custom_hardware = Theengs Bridge gateway ethernet
|
||||
[env:esp32dev-all-test]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32dev
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -320,6 +322,7 @@ custom_description = Infrared (Emitting and receiving) using IRremoteESP8266
|
||||
[env:esp32dev-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32dev
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -336,6 +339,7 @@ custom_description = Regular BLE gateway with adaptive scanning activated, autom
|
||||
[env:esp32dev-ble-mqtt-undecoded]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32dev
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -353,6 +357,7 @@ custom_description = BLE gateway with the decoding offloaded to Theengs Gateway
|
||||
[env:esp32dev-ble-aws]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32dev
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -377,6 +382,7 @@ custom_description = BLE gateway with AWS integration capability
|
||||
[env:esp32feather-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = featheresp32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -394,6 +400,7 @@ custom_hardware = ESP32 Feather Adafruit
|
||||
[env:esp32-lolin32lite-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = lolin32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -423,6 +430,7 @@ custom_hardware = LOLIN 32 Lite
|
||||
[env:esp32-olimex-gtw-ble-eth]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32-gateway
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -442,6 +450,7 @@ custom_hardware = OLIMEX ESP32 Gateway
|
||||
[env:esp32-olimex-gtw-ble-poe]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32-poe
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -458,6 +467,7 @@ custom_hardware = OLIMEX ESP32 Gateway with POE
|
||||
[env:esp32-olimex-gtw-ble-poe-iso]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32-poe-iso
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -474,6 +484,7 @@ custom_hardware = OLIMEX ESP32 Gateway with POE and ISO
|
||||
[env:esp32-wt32-eth01-ble-eth]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32-gateway
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -493,6 +504,7 @@ custom_hardware = WT32
|
||||
[env:esp32-olimex-gtw-ble-wifi]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32-gateway
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -511,6 +523,7 @@ custom_hardware = OLIMEX ESP32 Gateway
|
||||
[env:esp32-m5stick-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = m5stack-core-esp32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -534,6 +547,7 @@ custom_hardware = M5Stick Grey
|
||||
[env:esp32-m5stack-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = m5stack-core-esp32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -558,6 +572,7 @@ custom_hardware = M5Stack Core
|
||||
[env:esp32-m5tough-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = m5stack-core-esp32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -576,6 +591,7 @@ custom_hardware = M5Tough rugged
|
||||
[env:esp32-m5stick-c-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = m5stick-c
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -606,6 +622,7 @@ custom_hardware = M5Stick C
|
||||
[env:esp32-m5stick-cp-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = pico32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -636,6 +653,7 @@ custom_hardware = M5Stick CP
|
||||
[env:esp32-m5atom-matrix]
|
||||
platform = ${com.esp32_platform}
|
||||
board = pico32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -661,6 +679,7 @@ custom_hardware = M5 ATOM Matrix
|
||||
[env:esp32-m5atom-lite]
|
||||
platform = ${com.esp32_platform}
|
||||
board = pico32
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -867,6 +886,7 @@ custom_hardware = ESP32 HELTEC LORA32 V2
|
||||
[env:heltec-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = heltec_wifi_lora_32_V2
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
@@ -953,6 +973,7 @@ custom_hardware = ESP32 LILYGO LoRa32 V2.1
|
||||
[env:lilygo-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = ttgo-lora32-v21
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
@@ -1029,6 +1050,7 @@ custom_description = Multi RF library with the possibility to switch between ESP
|
||||
[env:tinypico-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = tinypico
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -1092,6 +1114,7 @@ custom_hardware = ESP32 LILYGO LoRa32 V2.1
|
||||
# https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436
|
||||
platform = ${com.esp32_platform}
|
||||
board = ttgo-t-beam
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -1149,6 +1172,7 @@ custom_hardware = ESP32 HELTEC LORA32
|
||||
[env:shelly-plus1]
|
||||
platform = ${com.esp32_solo_platform}
|
||||
board = esp32-solo1
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -1604,6 +1628,7 @@ custom_description = FastLed control
|
||||
[env:esp32dev-ble-datatest]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32dev
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
@@ -1775,6 +1800,7 @@ build_flags =
|
||||
[env:thingpulse-espgateway]
|
||||
platform = ${com.esp32_platform}
|
||||
board = esp32dev
|
||||
extra_scripts = ${com-esp32.extra_scripts}
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp32.lib_deps}
|
||||
|
||||
@@ -256,7 +256,6 @@ const char* alpnProtocols[] = {"x-amzn-mqtt-ca", NULL};
|
||||
# define MQTT_SECURE_SELF_SIGNED_CLIENT 1 // If using a self signed certificate for the broker and not using client certificates set this to false or 0
|
||||
# endif
|
||||
|
||||
|
||||
# ifndef MQTT_SECURE_SELF_SIGNED_INDEX_DEFAULT
|
||||
# define MQTT_SECURE_SELF_SIGNED_INDEX_DEFAULT 0
|
||||
# endif
|
||||
|
||||
@@ -190,6 +190,7 @@ build_flags =
|
||||
;'-DCORE_DEBUG_LEVEL=4'
|
||||
|
||||
[com-esp32] ; Used by all ESP32 based builds
|
||||
extra_scripts = pre:scripts/replace_lib.py
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${libraries.wifimanager32}
|
||||
|
||||
28
scripts/replace_lib.py
Normal file
28
scripts/replace_lib.py
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
import shutil
|
||||
import os
|
||||
import hashlib
|
||||
Import("env")
|
||||
|
||||
def calculate_md5(filepath):
|
||||
md5_hash = hashlib.md5()
|
||||
with open(filepath, "rb") as f:
|
||||
for byte_block in iter(lambda: f.read(4096), b""):
|
||||
md5_hash.update(byte_block)
|
||||
return md5_hash.hexdigest()
|
||||
|
||||
def main():
|
||||
print(f"Pre build BLE library replacement script")
|
||||
home_path = os.environ.get('HOME') or os.environ.get('USERPROFILE')
|
||||
source_file = 'lib/esp32-bt-lib/esp32/libbtdm_app.a'
|
||||
destination_file = os.path.join(home_path, '.platformio', 'packages', 'framework-arduinoespressif32', 'tools', 'sdk', 'esp32', 'ld', 'libbtdm_app.a')
|
||||
|
||||
try:
|
||||
shutil.copyfile(source_file, destination_file)
|
||||
md5_hash = calculate_md5(destination_file)
|
||||
print(f"Successfully copied {source_file} to {destination_file}")
|
||||
print(f"MD5: {md5_hash}")
|
||||
except Exception as e:
|
||||
print(f"Error occurred: {e}")
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user