diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d96f83e..0fc51e60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/build_and_docs_to_dev.yml b/.github/workflows/build_and_docs_to_dev.yml index 8a9ed555..4bfa3aa3 100644 --- a/.github/workflows/build_and_docs_to_dev.yml +++ b/.github/workflows/build_and_docs_to_dev.yml @@ -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'" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62beb7b9..19f3cf38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/environments.ini b/environments.ini index fc9dd895..a9d07085 100644 --- a/environments.ini +++ b/environments.ini @@ -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} diff --git a/main/User_config.h b/main/User_config.h index 898f7653..5aabd582 100644 --- a/main/User_config.h +++ b/main/User_config.h @@ -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 diff --git a/platformio.ini b/platformio.ini index c04da237..fb303956 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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} diff --git a/scripts/replace_lib.py b/scripts/replace_lib.py new file mode 100644 index 00000000..82e09e28 --- /dev/null +++ b/scripts/replace_lib.py @@ -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()