From e79b16e5b84b23647629a9e0810db6f922085b7e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:43:46 +0200 Subject: [PATCH 1/3] Tasmota changes * optional Ethernet support (JL1101 driver added) * esp-modem only esp32, esp32s2 and esp32s3 * remove `OpenThread` * remove all BT BLE libraries * remove zigbee * remove SPIFFS * remove Client Secure * remove Provisioning * remove TfLite, Insights and Rainmaker * make GPIOViewer working see https://github.com/arendst/Tasmota/commit/969611835c803197e0a683c9cf9647d074bdfae8 * remove FS log which is just littering --- CMakeLists.txt | 213 +++--------------- Kconfig.projbuild | 61 ----- README.md | 89 +------- cores/esp32/FirmwareMSC.h | 2 + cores/esp32/HWCDC.cpp | 2 + cores/esp32/HardwareSerial.h | 2 + cores/esp32/esp32-hal-bt.c | 103 --------- cores/esp32/esp32-hal-bt.h | 8 - cores/esp32/esp32-hal-i2c-slave.c | 7 + cores/esp32/esp32-hal-misc.c | 21 -- cores/esp32/esp32-hal.h | 1 - cores/esp32/main.cpp | 6 + idf_component.yml | 70 +----- libraries/BluetoothSerial/src/BTAddress.cpp | 4 +- libraries/BluetoothSerial/src/BTAddress.h | 4 +- .../BluetoothSerial/src/BTAdvertisedDevice.h | 6 +- .../src/BTAdvertisedDeviceSet.cpp | 4 +- libraries/BluetoothSerial/src/BTScan.h | 7 +- .../BluetoothSerial/src/BTScanResultsSet.cpp | 4 +- .../BluetoothSerial/src/BluetoothSerial.cpp | 3 +- .../BluetoothSerial/src/BluetoothSerial.h | 3 +- libraries/Ethernet/src/ETH.cpp | 1 + libraries/Ethernet/src/ETH.h | 3 +- libraries/FS/src/vfs_api.cpp | 1 - libraries/HTTPClient/src/HTTPClient.h | 4 + libraries/SimpleBLE/src/SimpleBLE.cpp | 3 +- libraries/SimpleBLE/src/SimpleBLE.h | 3 +- libraries/Update/src/Update.h | 4 + libraries/WebServer/src/WebServer.cpp | 2 +- package.json | 2 +- tools/pioarduino-build.py | 23 +- variants/esp32p4/pins_arduino.h | 4 +- 32 files changed, 132 insertions(+), 538 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ba9c999d81..2fc32676f63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,9 +26,7 @@ set(CORE_SRCS cores/esp32/base64.cpp cores/esp32/cbuf.cpp cores/esp32/ColorFormat.c - cores/esp32/chip-debug-report.cpp cores/esp32/esp32-hal-adc.c - cores/esp32/esp32-hal-bt.c cores/esp32/esp32-hal-cpu.c cores/esp32/esp32-hal-dac.c cores/esp32/esp32-hal-gpio.c @@ -44,8 +42,7 @@ set(CORE_SRCS cores/esp32/esp32-hal-sigmadelta.c cores/esp32/esp32-hal-spi.c cores/esp32/esp32-hal-time.c - cores/esp32/esp32-hal-timer.c - cores/esp32/esp32-hal-tinyusb.c + cores/esp32/esp32-hal-timer.c cores/esp32/esp32-hal-touch.c cores/esp32/esp32-hal-touch-ng.c cores/esp32/esp32-hal-uart.c @@ -68,9 +65,6 @@ set(CORE_SRCS cores/esp32/StreamString.cpp cores/esp32/Tone.cpp cores/esp32/HWCDC.cpp - cores/esp32/USB.cpp - cores/esp32/USBCDC.cpp - cores/esp32/USBMSC.cpp cores/esp32/FirmwareMSC.cpp cores/esp32/firmware_msc_fat.c cores/esp32/wiring_pulse.c @@ -78,72 +72,51 @@ set(CORE_SRCS cores/esp32/WMath.cpp cores/esp32/WString.cpp ) +if(IDF_TARGET MATCHES "esp32s2|esp32s3|esp32p4" AND CONFIG_TINYUSB_ENABLED) + list(APPEND CORE_SRCS + cores/esp32/esp32-hal-tinyusb.c + cores/esp32/USB.cpp + cores/esp32/USBCDC.cpp + cores/esp32/USBMSC.cpp) +endif() set(ARDUINO_ALL_LIBRARIES ArduinoOTA AsyncUDP - BLE - BluetoothSerial DNSServer EEPROM - ESP_I2S - ESP_NOW - ESP_SR ESPmDNS Ethernet FFat FS HTTPClient HTTPUpdate - Insights LittleFS - Matter NetBIOS Network - OpenThread PPP Preferences - RainMaker SD_MMC SD - SimpleBLE - SPIFFS SPI Ticker Update - USB WebServer - NetworkClientSecure WiFi - WiFiProv Wire - Zigbee ) +if(IDF_TARGET MATCHES "esp32s2|esp32s3|esp32p4" AND CONFIG_TINYUSB_ENABLED) + list(APPEND ARDUINO_ALL_LIBRARIES USB) +endif() set(ARDUINO_LIBRARY_ArduinoOTA_SRCS libraries/ArduinoOTA/src/ArduinoOTA.cpp) set(ARDUINO_LIBRARY_AsyncUDP_SRCS libraries/AsyncUDP/src/AsyncUDP.cpp) -set(ARDUINO_LIBRARY_BluetoothSerial_SRCS - libraries/BluetoothSerial/src/BluetoothSerial.cpp - libraries/BluetoothSerial/src/BTAddress.cpp - libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp - libraries/BluetoothSerial/src/BTScanResultsSet.cpp) - set(ARDUINO_LIBRARY_DNSServer_SRCS libraries/DNSServer/src/DNSServer.cpp) set(ARDUINO_LIBRARY_EEPROM_SRCS libraries/EEPROM/src/EEPROM.cpp) -set(ARDUINO_LIBRARY_ESP_I2S_SRCS libraries/ESP_I2S/src/ESP_I2S.cpp) - -set(ARDUINO_LIBRARY_ESP_NOW_SRCS - libraries/ESP_NOW/src/ESP32_NOW.cpp - libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp) - -set(ARDUINO_LIBRARY_ESP_SR_SRCS - libraries/ESP_SR/src/ESP_SR.cpp - libraries/ESP_SR/src/esp32-hal-sr.c) - set(ARDUINO_LIBRARY_ESPmDNS_SRCS libraries/ESPmDNS/src/ESPmDNS.cpp) set(ARDUINO_LIBRARY_Ethernet_SRCS libraries/Ethernet/src/ETH.cpp) @@ -158,49 +131,16 @@ set(ARDUINO_LIBRARY_HTTPClient_SRCS libraries/HTTPClient/src/HTTPClient.cpp) set(ARDUINO_LIBRARY_HTTPUpdate_SRCS libraries/HTTPUpdate/src/HTTPUpdate.cpp) -set(ARDUINO_LIBRARY_Insights_SRCS libraries/Insights/src/Insights.cpp) - set(ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp) set(ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp) -set(ARDUINO_LIBRARY_OpenThread_SRCS - libraries/OpenThread/src/OThreadCLI.cpp - libraries/OpenThread/src/OThreadCLI_Util.cpp) - -set(ARDUINO_LIBRARY_Matter_SRCS - libraries/Matter/src/MatterEndpoints/MatterGenericSwitch.cpp - libraries/Matter/src/MatterEndpoints/MatterOnOffLight.cpp - libraries/Matter/src/MatterEndpoints/MatterDimmableLight.cpp - libraries/Matter/src/MatterEndpoints/MatterColorTemperatureLight.cpp - libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp - libraries/Matter/src/MatterEndpoints/MatterEnhancedColorLight.cpp - libraries/Matter/src/MatterEndpoints/MatterFan.cpp - libraries/Matter/src/MatterEndpoints/MatterTemperatureSensor.cpp - libraries/Matter/src/MatterEndpoints/MatterHumiditySensor.cpp - libraries/Matter/src/MatterEndpoints/MatterContactSensor.cpp - libraries/Matter/src/MatterEndpoints/MatterPressureSensor.cpp - libraries/Matter/src/MatterEndpoints/MatterOccupancySensor.cpp - libraries/Matter/src/MatterEndpoints/MatterOnOffPlugin.cpp - libraries/Matter/src/MatterEndpoints/MatterThermostat.cpp - libraries/Matter/src/Matter.cpp) - set(ARDUINO_LIBRARY_PPP_SRCS libraries/PPP/src/PPP.cpp libraries/PPP/src/ppp.c) set(ARDUINO_LIBRARY_Preferences_SRCS libraries/Preferences/src/Preferences.cpp) -set(ARDUINO_LIBRARY_RainMaker_SRCS - libraries/RainMaker/src/RMaker.cpp - libraries/RainMaker/src/RMakerNode.cpp - libraries/RainMaker/src/RMakerParam.cpp - libraries/RainMaker/src/RMakerDevice.cpp - libraries/RainMaker/src/RMakerType.cpp - libraries/RainMaker/src/RMakerQR.cpp - libraries/RainMaker/src/RMakerUtils.cpp - libraries/RainMaker/src/AppInsights.cpp) - set(ARDUINO_LIBRARY_SD_MMC_SRCS libraries/SD_MMC/src/SD_MMC.cpp) set(ARDUINO_LIBRARY_SD_SRCS @@ -208,10 +148,6 @@ set(ARDUINO_LIBRARY_SD_SRCS libraries/SD/src/sd_diskio.cpp libraries/SD/src/sd_diskio_crc.c) -set(ARDUINO_LIBRARY_SimpleBLE_SRCS libraries/SimpleBLE/src/SimpleBLE.cpp) - -set(ARDUINO_LIBRARY_SPIFFS_SRCS libraries/SPIFFS/src/SPIFFS.cpp) - set(ARDUINO_LIBRARY_SPI_SRCS libraries/SPI/src/SPI.cpp) set(ARDUINO_LIBRARY_Ticker_SRCS libraries/Ticker/src/Ticker.cpp) @@ -220,26 +156,28 @@ set(ARDUINO_LIBRARY_Update_SRCS libraries/Update/src/Updater.cpp libraries/Update/src/HttpsOTAUpdate.cpp) -set(ARDUINO_LIBRARY_USB_SRCS - libraries/USB/src/USBHID.cpp - libraries/USB/src/USBMIDI.cpp - libraries/USB/src/USBHIDMouse.cpp - libraries/USB/src/USBHIDKeyboard.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_da_DK.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_de_DE.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_en_US.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_es_ES.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_fr_FR.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_hu_HU.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_it_IT.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_pt_BR.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_pt_PT.cpp - libraries/USB/src/keyboardLayout/KeyboardLayout_sv_SE.cpp - libraries/USB/src/USBHIDGamepad.cpp - libraries/USB/src/USBHIDConsumerControl.cpp - libraries/USB/src/USBHIDSystemControl.cpp - libraries/USB/src/USBHIDVendor.cpp - libraries/USB/src/USBVendor.cpp) +if(IDF_TARGET MATCHES "esp32s2|esp32s3|esp32p4" AND CONFIG_TINYUSB_ENABLED) + set(ARDUINO_LIBRARY_USB_SRCS + libraries/USB/src/USBHID.cpp + libraries/USB/src/USBMIDI.cpp + libraries/USB/src/USBHIDMouse.cpp + libraries/USB/src/USBHIDKeyboard.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_da_DK.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_de_DE.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_en_US.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_es_ES.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_fr_FR.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_hu_HU.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_it_IT.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_pt_BR.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_pt_PT.cpp + libraries/USB/src/keyboardLayout/KeyboardLayout_sv_SE.cpp + libraries/USB/src/USBHIDGamepad.cpp + libraries/USB/src/USBHIDConsumerControl.cpp + libraries/USB/src/USBHIDSystemControl.cpp + libraries/USB/src/USBHIDVendor.cpp + libraries/USB/src/USBVendor.cpp) +endif() set(ARDUINO_LIBRARY_WebServer_SRCS libraries/WebServer/src/WebServer.cpp @@ -250,10 +188,6 @@ set(ARDUINO_LIBRARY_WebServer_SRCS libraries/WebServer/src/middleware/CorsMiddleware.cpp libraries/WebServer/src/middleware/LoggingMiddleware.cpp) -set(ARDUINO_LIBRARY_NetworkClientSecure_SRCS - libraries/NetworkClientSecure/src/ssl_client.cpp - libraries/NetworkClientSecure/src/NetworkClientSecure.cpp) - set(ARDUINO_LIBRARY_Network_SRCS libraries/Network/src/NetworkInterface.cpp libraries/Network/src/NetworkEvents.cpp @@ -272,70 +206,8 @@ set(ARDUINO_LIBRARY_WiFi_SRCS libraries/WiFi/src/STA.cpp libraries/WiFi/src/AP.cpp) -set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp) - set(ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp) -set(ARDUINO_LIBRARY_Zigbee_SRCS - libraries/Zigbee/src/ZigbeeCore.cpp - libraries/Zigbee/src/ZigbeeEP.cpp - libraries/Zigbee/src/ZigbeeHandlers.cpp - libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp - libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp - libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp - libraries/Zigbee/src/ep/ZigbeeLight.cpp - libraries/Zigbee/src/ep/ZigbeeSwitch.cpp - libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp - libraries/Zigbee/src/ep/ZigbeeThermostat.cpp - libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp - libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp - libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp - libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp - libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp - libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp - libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp - libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp - libraries/Zigbee/src/ep/ZigbeeAnalog.cpp - libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp - libraries/Zigbee/src/ep/ZigbeeGateway.cpp - libraries/Zigbee/src/ep/ZigbeeWindSpeedSensor.cpp - libraries/Zigbee/src/ep/ZigbeeIlluminanceSensor.cpp - libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp - ) - -set(ARDUINO_LIBRARY_BLE_SRCS - libraries/BLE/src/BLE2901.cpp - libraries/BLE/src/BLE2902.cpp - libraries/BLE/src/BLE2904.cpp - libraries/BLE/src/BLEAddress.cpp - libraries/BLE/src/BLEAdvertisedDevice.cpp - libraries/BLE/src/BLEAdvertising.cpp - libraries/BLE/src/BLEBeacon.cpp - libraries/BLE/src/BLECharacteristic.cpp - libraries/BLE/src/BLECharacteristicMap.cpp - libraries/BLE/src/BLEClient.cpp - libraries/BLE/src/BLEDescriptor.cpp - libraries/BLE/src/BLEDescriptorMap.cpp - libraries/BLE/src/BLEDevice.cpp - libraries/BLE/src/BLEEddystoneTLM.cpp - libraries/BLE/src/BLEEddystoneURL.cpp - libraries/BLE/src/BLEExceptions.cpp - libraries/BLE/src/BLEHIDDevice.cpp - libraries/BLE/src/BLERemoteCharacteristic.cpp - libraries/BLE/src/BLERemoteDescriptor.cpp - libraries/BLE/src/BLERemoteService.cpp - libraries/BLE/src/BLEScan.cpp - libraries/BLE/src/BLESecurity.cpp - libraries/BLE/src/BLEServer.cpp - libraries/BLE/src/BLEService.cpp - libraries/BLE/src/BLEServiceMap.cpp - libraries/BLE/src/BLEUtils.cpp - libraries/BLE/src/BLEUUID.cpp - libraries/BLE/src/BLEValue.cpp - libraries/BLE/src/FreeRTOS.cpp - libraries/BLE/src/GeneralUtils.cpp - ) - set(ARDUINO_LIBRARIES_SRCS) set(ARDUINO_LIBRARIES_REQUIRES) set(ARDUINO_LIBRARIES_INCLUDEDIRS) @@ -357,15 +229,7 @@ set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRA set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS}) set(priv_includes cores/esp32/libb64) set(requires spi_flash esp_partition mbedtls wpa_supplicant esp_adc esp_eth http_parser esp_ringbuf esp_driver_gptimer esp_driver_usb_serial_jtag driver) -set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid usb esp_psram ${ARDUINO_LIBRARIES_REQUIRES}) - -if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_OpenThread) - #if(CONFIG_SOC_IEEE802154_SUPPORTED) # Does not work! - #if(CONFIG_OPENTHREAD_ENABLED) # Does not work! - if(IDF_TARGET STREQUAL "esp32c6" OR IDF_TARGET STREQUAL "esp32h2") # Sadly only this works - list(APPEND requires openthread) - endif() -endif() +set(priv_requires fatfs nvs_flash app_update bootloader_support bt esp_hid usb esp_psram ${ARDUINO_LIBRARIES_REQUIRES}) if(IDF_TARGET STREQUAL "esp32p4") list(APPEND requires esp_driver_touch_sens) @@ -416,15 +280,6 @@ endif() if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_ArduinoOTA) maybe_add_component(esp_https_ota) endif() -if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_ESP_SR) - maybe_add_component(espressif__esp_sr) -endif() -if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_Matter) - maybe_add_component(espressif__esp_matter) -endif() if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_LittleFS) maybe_add_component(joltwallet__littlefs) endif() -if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_WiFiProv) - maybe_add_component(espressif__network_provisioning) -endif() diff --git a/Kconfig.projbuild b/Kconfig.projbuild index 9966463f8c1..9b53fb77e81 100644 --- a/Kconfig.projbuild +++ b/Kconfig.projbuild @@ -266,11 +266,6 @@ config ARDUINO_SELECTIVE_Wire depends on ARDUINO_SELECTIVE_COMPILATION default y -config ARDUINO_SELECTIVE_ESP_SR - bool "Enable ESP-SR" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - config ARDUINO_SELECTIVE_EEPROM bool "Enable EEPROM" depends on ARDUINO_SELECTIVE_COMPILATION @@ -291,11 +286,6 @@ config ARDUINO_SELECTIVE_Update depends on ARDUINO_SELECTIVE_COMPILATION default y -config ARDUINO_SELECTIVE_Zigbee - bool "Enable Zigbee" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - config ARDUINO_SELECTIVE_FS bool "Enable FS" depends on ARDUINO_SELECTIVE_COMPILATION @@ -311,11 +301,6 @@ config ARDUINO_SELECTIVE_SD_MMC depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS default y -config ARDUINO_SELECTIVE_SPIFFS - bool "Enable SPIFFS" - depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS - default y - config ARDUINO_SELECTIVE_FFat bool "Enable FFat" depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS @@ -365,12 +350,6 @@ config ARDUINO_SELECTIVE_ESPmDNS config ARDUINO_SELECTIVE_HTTPClient bool "Enable HTTPClient" depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network - select ARDUINO_SELECTIVE_NetworkClientSecure - default y - -config ARDUINO_SELECTIVE_Matter - bool "Enable Matter" - depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network default y config ARDUINO_SELECTIVE_NetBIOS @@ -389,44 +368,4 @@ config ARDUINO_SELECTIVE_WiFi depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network default y -config ARDUINO_SELECTIVE_NetworkClientSecure - bool "Enable NetworkClientSecure" - depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network - default y - -config ARDUINO_SELECTIVE_WiFiProv - bool "Enable WiFiProv" - depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Network && ARDUINO_SELECTIVE_WiFi - default y - -config ARDUINO_SELECTIVE_BLE - bool "Enable BLE" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - -config ARDUINO_SELECTIVE_BluetoothSerial - bool "Enable BluetoothSerial" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - -config ARDUINO_SELECTIVE_SimpleBLE - bool "Enable SimpleBLE" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - -config ARDUINO_SELECTIVE_RainMaker - bool "Enable RainMaker" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - -config ARDUINO_SELECTIVE_OpenThread - bool "Enable OpenThread" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - -config ARDUINO_SELECTIVE_Insights - bool "Enable Insights" - depends on ARDUINO_SELECTIVE_COMPILATION - default y - endmenu diff --git a/README.md b/README.md index f40315c03cc..8ffb180cc44 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,6 @@ -# Arduino core for the ESP32, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4, ESP32-S2 and ESP32-S3. +# Tasmota Platformio Arduino for ESP32, ESP32-P4, ESP32-S2, ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C6 and ESP32-H2 -[![Build Status](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/push.yml?branch=master&event=push&label=Compilation%20Tests)](https://github.com/espressif/arduino-esp32/actions/workflows/push.yml?query=branch%3Amaster+event%3Apush) -[![Verbose Build Status](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/push.yml?branch=master&event=schedule&label=Compilation%20Tests%20(Verbose))](https://github.com/espressif/arduino-esp32/actions/workflows/push.yml?query=branch%3Amaster+event%3Aschedule) -[![External Libraries Test](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/lib.yml?branch=master&event=schedule&label=External%20Libraries%20Test)](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md) -[![Runtime Tests](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/badge.svg)](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/RUNTIME_TESTS_REPORT.md) - -### Need help or have a question? Join the chat at [Discord](https://discord.gg/8xY6e9crwv) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions) - -[![Discord invite](https://img.shields.io/discord/1327272229427216425?logo=discord&logoColor=white&logoSize=auto&label=Discord)](https://discord.gg/8xY6e9crwv) - -## Contents - - - [Development Status](#development-status) - - [Development Planning](#development-planning) - - [Documentation](#documentation) - - [Supported Chips](#supported-chips) - - [Decoding exceptions](#decoding-exceptions) - - [Issue/Bug report template](#issuebug-report-template) - - [Contributing](#contributing) - -### Development Status - -#### Latest Stable Release - -[![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/) -[![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/) -[![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg)](https://github.com/espressif/arduino-esp32/releases/latest/) - -#### Latest Development Release - -[![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg)](https://github.com/espressif/arduino-esp32/releases/) -[![Release Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/) -[![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg)](https://github.com/espressif/arduino-esp32/releases/) - -### Development Planning - -Our Development is fully tracked on this public **[Roadmap 🎉](https://github.com/orgs/espressif/projects/3)** - -For even more information you can join our **[Monthly Community Meetings 🔔](https://github.com/espressif/arduino-esp32/discussions/categories/monthly-community-meetings).** +### [![GitHub Releases](https://img.shields.io/github/downloads/tasmota/arduino-esp32/total?label=downloads)](https://github.com/tasmota/arduino-esp32/releases/latest) ### Documentation @@ -49,57 +12,21 @@ You can use the [Arduino-ESP32 Online Documentation](https://docs.espressif.com/ --- -**APIs compatibility with ESP8266 and Arduino-CORE (Arduino.cc) is explained [here](https://docs.espressif.com/projects/arduino-esp32/en/latest/libraries.html#apis).** - ---- - -* [Getting Started](https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html) -* [Installing (Windows, Linux and macOS)](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html) -* [Libraries](https://docs.espressif.com/projects/arduino-esp32/en/latest/libraries.html) -* [Arduino as an ESP-IDF component](https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html) -* [FAQ](https://docs.espressif.com/projects/arduino-esp32/en/latest/faq.html) -* [Troubleshooting](https://docs.espressif.com/projects/arduino-esp32/en/latest/troubleshooting.html) - ### Supported Chips -Here are the ESP32 series supported by the Arduino-ESP32 project: +Here are the ESP32 series supported by the Tasmota Arduino-ESP32 project: | **SoC** | **Stable** | **Development** | **Datasheet** | |----------|:----------:|:---------------:|:-------------------------------------------------------------------------------------------------:| -| ESP32 | Yes | Yes | [ESP32](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) | +| ESP32 | Yes | Yes | [ESP32](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) | +| ESP32solo1| Yes | Yes | [ESP32solo1](https://www.espressif.com/sites/default/files/documentation/esp32-solo-1_datasheet_en.pdf) | +| ESP32-S2 | Yes | Yes | [ESP32-S2](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) | +| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) | +| ESP32-C2 | Yes | Yes | [ESP32-C2](https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf) | | ESP32-C3 | Yes | Yes | [ESP32-C3](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) | | ESP32-C6 | Yes | Yes | [ESP32-C6](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) | | ESP32-H2 | Yes | Yes | [ESP32-H2](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) | | ESP32-P4 | Yes | Yes | [ESP32-P4](https://www.espressif.com/sites/default/files/documentation/esp32-p4_datasheet_en.pdf) | -| ESP32-S2 | Yes | Yes | [ESP32-S2](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) | -| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) | -> [!NOTE] -> ESP32-C2 is also supported by Arduino-ESP32 but requires using Arduino as an ESP-IDF component or rebuilding the static libraries. -> For more information, see the [Arduino as an ESP-IDF component documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html) or the -> [Lib Builder documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html), respectively. For more details visit the [supported chips](https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html#supported-soc-s) documentation page. - -### Decoding exceptions - -You can use [EspExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecoder) to get meaningful call trace. - -### Issue/Bug report template - -Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labeled as [Type: For reference](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue+label%3A%22Type%3A+For+reference%22+). - -Finally, if you are sure no one else had the issue, follow the **Issue template** or **Feature request template** while reporting any [new Issue](https://github.com/espressif/arduino-esp32/issues/new/choose). - -### External libraries compilation test - -We have set-up CI testing for external libraries for ESP32 Arduino core. You can check test results in the file [LIBRARIES_TEST](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md). -For more information and how to add your library to the test see [external library testing](https://docs.espressif.com/projects/arduino-esp32/en/latest/external_libraries_test.html) in the documentation. - -### Contributing - -We welcome contributions to the Arduino ESP32 project! - -See [contributing](https://docs.espressif.com/projects/arduino-esp32/en/latest/contributing.html) in the documentation for more information on how to contribute to the project. - -> We would like to have this repository in a polite and friendly atmosphere, so please be kind and respectful to others. For more details, look at [Code of Conduct](https://github.com/espressif/arduino-esp32/blob/master/CODE_OF_CONDUCT.md). diff --git a/cores/esp32/FirmwareMSC.h b/cores/esp32/FirmwareMSC.h index 3eaa184bcd6..cc428bc69b8 100644 --- a/cores/esp32/FirmwareMSC.h +++ b/cores/esp32/FirmwareMSC.h @@ -14,7 +14,9 @@ #pragma once #include +#if defined __has_include && __has_include("USBMSC.h") #include "USBMSC.h" +#endif #if CONFIG_TINYUSB_MSC_ENABLED diff --git a/cores/esp32/HWCDC.cpp b/cores/esp32/HWCDC.cpp index 062317d9f53..afbc458e620 100644 --- a/cores/esp32/HWCDC.cpp +++ b/cores/esp32/HWCDC.cpp @@ -11,7 +11,9 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +#if defined __has_include && __has_include("USB.h") #include "USB.h" +#endif #if SOC_USB_SERIAL_JTAG_SUPPORTED #include "esp32-hal.h" diff --git a/cores/esp32/HardwareSerial.h b/cores/esp32/HardwareSerial.h index bd24e0eec0e..8d82c3781a9 100644 --- a/cores/esp32/HardwareSerial.h +++ b/cores/esp32/HardwareSerial.h @@ -51,7 +51,9 @@ #include "esp32-hal.h" #include "soc/soc_caps.h" #include "HWCDC.h" +#if defined __has_include && __has_include("USBCDC.h") #include "USBCDC.h" +#endif #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/cores/esp32/esp32-hal-bt.c b/cores/esp32/esp32-hal-bt.c index 1e5f73e324c..2eb3ad959f5 100644 --- a/cores/esp32/esp32-hal-bt.c +++ b/cores/esp32/esp32-hal-bt.c @@ -15,108 +15,7 @@ #include "esp32-hal-bt.h" #if SOC_BT_SUPPORTED -#ifdef CONFIG_BT_BLUEDROID_ENABLED -#if CONFIG_IDF_TARGET_ESP32 -bool btInUse() { - return true; -} -#else -// user may want to change it to free resources -__attribute__((weak)) bool btInUse() { - return true; -} -#endif - -#include "esp_bt.h" - -#ifdef CONFIG_BTDM_CONTROLLER_MODE_BTDM -#define BT_MODE ESP_BT_MODE_BTDM -#elif defined(CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY) -#define BT_MODE ESP_BT_MODE_CLASSIC_BT -#else -#define BT_MODE ESP_BT_MODE_BLE -#endif - -bool btStarted() { - return (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED); -} - -bool btStart() { - return btStartMode(BT_MODE); -} - -bool btStartMode(bt_mode mode) { - esp_bt_mode_t esp_bt_mode; - esp_bt_controller_config_t cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); -#if CONFIG_IDF_TARGET_ESP32 - switch (mode) { - case BT_MODE_BLE: esp_bt_mode = ESP_BT_MODE_BLE; break; - case BT_MODE_CLASSIC_BT: esp_bt_mode = ESP_BT_MODE_CLASSIC_BT; break; - case BT_MODE_BTDM: esp_bt_mode = ESP_BT_MODE_BTDM; break; - default: esp_bt_mode = BT_MODE; break; - } - // esp_bt_controller_enable(MODE) This mode must be equal as the mode in “cfg” of esp_bt_controller_init(). - cfg.mode = esp_bt_mode; - if (cfg.mode == ESP_BT_MODE_CLASSIC_BT) { - esp_bt_controller_mem_release(ESP_BT_MODE_BLE); - } -#else - // other esp variants dont support BT-classic / DM. - esp_bt_mode = BT_MODE; -#endif - - if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED) { - return true; - } - esp_err_t ret; - if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) { - if ((ret = esp_bt_controller_init(&cfg)) != ESP_OK) { - log_e("initialize controller failed: %s", esp_err_to_name(ret)); - return false; - } - while (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) {} - } - if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED) { - if ((ret = esp_bt_controller_enable(esp_bt_mode)) != ESP_OK) { - log_e("BT Enable mode=%d failed %s", BT_MODE, esp_err_to_name(ret)); - return false; - } - } - if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED) { - return true; - } - log_e("BT Start failed"); - return false; -} - -bool btStop() { - if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) { - return true; - } - if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED) { - if (esp_bt_controller_disable()) { - log_e("BT Disable failed"); - return false; - } - while (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED); - } - if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED) { - if (esp_bt_controller_deinit()) { - log_e("BT deint failed"); - return false; - } - vTaskDelay(1); - if (esp_bt_controller_get_status() != ESP_BT_CONTROLLER_STATUS_IDLE) { - return false; - } - return true; - } - log_e("BT Stop failed"); - return false; -} - -#else // CONFIG_BT_ENABLED bool btStarted() { return false; } @@ -129,6 +28,4 @@ bool btStop() { return false; } -#endif /* CONFIG_BT_ENABLED */ - #endif /* SOC_BT_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-bt.h b/cores/esp32/esp32-hal-bt.h index 8ab03eea904..9758e8ab1fc 100644 --- a/cores/esp32/esp32-hal-bt.h +++ b/cores/esp32/esp32-hal-bt.h @@ -24,16 +24,8 @@ extern "C" { #endif -typedef enum { - BT_MODE_DEFAULT, - BT_MODE_BLE, - BT_MODE_CLASSIC_BT, - BT_MODE_BTDM -} bt_mode; - bool btStarted(); bool btStart(); -bool btStartMode(bt_mode mode); bool btStop(); #ifdef __cplusplus diff --git a/cores/esp32/esp32-hal-i2c-slave.c b/cores/esp32/esp32-hal-i2c-slave.c index 0e01259da61..1d92a55ae15 100644 --- a/cores/esp32/esp32-hal-i2c-slave.c +++ b/cores/esp32/esp32-hal-i2c-slave.c @@ -43,6 +43,7 @@ #include "soc/i2c_struct.h" #include "soc/periph_defs.h" #include "hal/i2c_ll.h" +#include "hal/i2c_types.h" #ifndef CONFIG_IDF_TARGET_ESP32C5 #include "hal/clk_gate_ll.h" #endif @@ -337,7 +338,13 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t } #endif // !defined(CONFIG_IDF_TARGET_ESP32P4) +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) + i2c_ll_set_mode(i2c->dev, I2C_BUS_MODE_SLAVE); + i2c_ll_enable_pins_open_drain(i2c->dev, true); +#else i2c_ll_slave_init(i2c->dev); +#endif + #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0) i2c_ll_enable_fifo_mode(i2c->dev, true); #else diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 6b46f688305..5b4d35c6464 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -25,9 +25,6 @@ #include "esp_ota_ops.h" #endif //CONFIG_APP_ROLLBACK_ENABLE #include "esp_private/startup_internal.h" -#if defined(CONFIG_BT_BLUEDROID_ENABLED) && SOC_BT_SUPPORTED -#include "esp_bt.h" -#endif //CONFIG_BT_BLUEDROID_ENABLED #include #include "soc/rtc.h" #if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5) @@ -245,19 +242,6 @@ bool verifyRollbackLater() { } #endif -#ifdef CONFIG_BT_BLUEDROID_ENABLED -#if CONFIG_IDF_TARGET_ESP32 -//overwritten in esp32-hal-bt.c -bool btInUse() __attribute__((weak)); -bool btInUse() { - return false; -} -#else -//from esp32-hal-bt.c -extern bool btInUse(); -#endif -#endif - #if CONFIG_SPIRAM_SUPPORT || CONFIG_SPIRAM ESP_SYSTEM_INIT_FN(init_psram_new, CORE, BIT(0), 99) { psramInit(); @@ -307,11 +291,6 @@ void initArduino() { if (err) { log_e("Failed to initialize NVS! Error: %u", err); } -#if defined(CONFIG_BT_BLUEDROID_ENABLED) && SOC_BT_SUPPORTED - if (!btInUse()) { - esp_bt_controller_mem_release(ESP_BT_MODE_BTDM); - } -#endif init(); initVariant(); } diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 5ed99aeb205..de98e644c1a 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -96,7 +96,6 @@ void yield(void); #include "esp32-hal-rmt.h" #include "esp32-hal-sigmadelta.h" #include "esp32-hal-timer.h" -#include "esp32-hal-bt.h" #include "esp32-hal-psram.h" #include "esp32-hal-rgb-led.h" #include "esp32-hal-cpu.h" diff --git a/cores/esp32/main.cpp b/cores/esp32/main.cpp index 6c4d50a9a84..746d18dc075 100644 --- a/cores/esp32/main.cpp +++ b/cores/esp32/main.cpp @@ -10,7 +10,9 @@ #endif #endif +#if defined __has_include && __has_include("chip-debug-report.h") #include "chip-debug-report.h" +#endif #ifndef ARDUINO_LOOP_STACK_SIZE #ifndef CONFIG_ARDUINO_LOOP_STACK_SIZE @@ -49,20 +51,24 @@ void loopTask(void *pvParameters) { // sets UART0 (default console) RX/TX pins as already configured in boot or as defined in variants/pins_arduino.h Serial0.setPins(gpioNumberToDigitalPin(SOC_RX0), gpioNumberToDigitalPin(SOC_TX0)); #endif +#if defined __has_include && __has_include("chip-debug-report.h") #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG printBeforeSetupInfo(); #else if (shouldPrintChipDebugReport()) { printBeforeSetupInfo(); } +#endif #endif setup(); +#if defined __has_include && __has_include("chip-debug-report.h") #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG printAfterSetupInfo(); #else if (shouldPrintChipDebugReport()) { printAfterSetupInfo(); } +#endif #endif for (;;) { #if CONFIG_FREERTOS_UNICORE diff --git a/idf_component.yml b/idf_component.yml index c1fc614cae5..d19f4399271 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -53,57 +53,10 @@ dependencies: require: public espressif/esp_modem: version: "^1.1.0" - espressif/esp-zboss-lib: - version: "==1.6.3" - require: public - rules: - - if: "target not in [esp32c2, esp32p4]" - espressif/esp-zigbee-lib: - version: "==1.6.3" - require: public rules: - - if: "target not in [esp32c2, esp32p4]" + - if: "target not in [esp32c2]" espressif/esp-dsp: - version: "^1.3.4" - rules: - - if: "target != esp32c2" - # RainMaker Start (Fixed versions, because Matter supports only Insights 1.0.1) - espressif/network_provisioning: - version: "1.0.2" - espressif/esp_rainmaker: - version: "1.5.2" - rules: - - if: "target not in [esp32c2, esp32p4]" - espressif/rmaker_common: - version: "1.4.6" - rules: - - if: "target not in [esp32c2, esp32p4]" - espressif/esp_insights: - version: "1.2.2" - rules: - - if: "target not in [esp32c2, esp32p4]" - # New version breaks esp_insights 1.0.1 - espressif/esp_diag_data_store: - version: "1.0.2" - rules: - - if: "target not in [esp32c2, esp32p4]" - espressif/esp_diagnostics: - version: "1.2.1" - rules: - - if: "target not in [esp32c2, esp32p4]" - espressif/cbor: - version: "0.6.0~1" - rules: - - if: "target not in [esp32c2, esp32p4]" - espressif/qrcode: - version: "0.1.0~2" - rules: - - if: "target not in [esp32c2, esp32p4]" - # RainMaker End - espressif/esp-sr: - version: "^1.4.2" - rules: - - if: "target in [esp32s3]" + version: "^1.4.12" espressif/esp_hosted: version: "^0.0.25" rules: @@ -112,18 +65,11 @@ dependencies: version: "^0.5.4" rules: - if: "target == esp32p4" - espressif/libsodium: - version: "^1.0.20~1" - require: public - espressif/esp-modbus: - version: "^1.0.15" - require: public joltwallet/littlefs: - version: "^1.10.2" - chmorgan/esp-libhelix-mp3: - version: "1.0.3" + version: "^1.14.1" + espressif/esp32-camera: + version: "master" + git: https://github.com/espressif/esp32-camera.git require: public -examples: - - path: ./idf_component_examples/hello_world - - path: ./idf_component_examples/hw_cdc_hello_world - - path: ./idf_component_examples/esp_matter_light + rules: + - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" diff --git a/libraries/BluetoothSerial/src/BTAddress.cpp b/libraries/BluetoothSerial/src/BTAddress.cpp index 6a6de6522bd..6dc05f3aafb 100644 --- a/libraries/BluetoothSerial/src/BTAddress.cpp +++ b/libraries/BluetoothSerial/src/BTAddress.cpp @@ -7,7 +7,9 @@ * Author: Thomas M. (ArcticSnowSky) */ #include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#include "soc/soc_caps.h" + +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include "BTAddress.h" #include diff --git a/libraries/BluetoothSerial/src/BTAddress.h b/libraries/BluetoothSerial/src/BTAddress.h index a2af9247fb0..ece3ae83525 100644 --- a/libraries/BluetoothSerial/src/BTAddress.h +++ b/libraries/BluetoothSerial/src/BTAddress.h @@ -10,7 +10,9 @@ #ifndef COMPONENTS_CPP_UTILS_BTADDRESS_H_ #define COMPONENTS_CPP_UTILS_BTADDRESS_H_ #include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#include "soc/soc_caps.h" + +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include // ESP32 BT #include diff --git a/libraries/BluetoothSerial/src/BTAdvertisedDevice.h b/libraries/BluetoothSerial/src/BTAdvertisedDevice.h index 63c19c908b6..53aa2629b56 100644 --- a/libraries/BluetoothSerial/src/BTAdvertisedDevice.h +++ b/libraries/BluetoothSerial/src/BTAdvertisedDevice.h @@ -5,9 +5,11 @@ * Author: Thomas M. (ArcticSnowSky) */ -#ifndef __BTADVERTISEDDEVICE_H__ -#define __BTADVERTISEDDEVICE_H__ +#pragma once +#include "sdkconfig.h" +#include "soc/soc_caps.h" +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include "BTAddress.h" #include diff --git a/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp b/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp index ed6076a3103..9afc28547e5 100644 --- a/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp +++ b/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp @@ -6,7 +6,9 @@ */ #include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#include "soc/soc_caps.h" + +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) //#include diff --git a/libraries/BluetoothSerial/src/BTScan.h b/libraries/BluetoothSerial/src/BTScan.h index a08f68cd7c2..6fd2daf9f6d 100644 --- a/libraries/BluetoothSerial/src/BTScan.h +++ b/libraries/BluetoothSerial/src/BTScan.h @@ -5,8 +5,11 @@ * Author: Thomas M. (ArcticSnowSky) */ -#ifndef __BTSCAN_H__ -#define __BTSCAN_H__ +#pragma once +#include "sdkconfig.h" +#include "soc/soc_caps.h" + +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include #include diff --git a/libraries/BluetoothSerial/src/BTScanResultsSet.cpp b/libraries/BluetoothSerial/src/BTScanResultsSet.cpp index 3633c010eae..02459b081ba 100644 --- a/libraries/BluetoothSerial/src/BTScanResultsSet.cpp +++ b/libraries/BluetoothSerial/src/BTScanResultsSet.cpp @@ -6,7 +6,9 @@ */ #include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#include "soc/soc_caps.h" + +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.cpp b/libraries/BluetoothSerial/src/BluetoothSerial.cpp index 3d00504c1b1..b7eede93ee6 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.cpp +++ b/libraries/BluetoothSerial/src/BluetoothSerial.cpp @@ -19,8 +19,9 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "soc/soc_caps.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #ifdef ARDUINO_ARCH_ESP32 #include "esp32-hal-log.h" diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.h b/libraries/BluetoothSerial/src/BluetoothSerial.h index d59fbf1f714..8cb6edb876c 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.h +++ b/libraries/BluetoothSerial/src/BluetoothSerial.h @@ -16,8 +16,9 @@ #define _BLUETOOTH_SERIAL_H_ #include "sdkconfig.h" +#include "soc/soc_caps.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include "Arduino.h" #include "Stream.h" diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index 3dfba37c684..27f132a21b5 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -290,6 +290,7 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i case ETH_PHY_TLK110: _phy = esp_eth_phy_new_ip101(&phy_config); break; case ETH_PHY_RTL8201: _phy = esp_eth_phy_new_rtl8201(&phy_config); break; case ETH_PHY_DP83848: _phy = esp_eth_phy_new_dp83848(&phy_config); break; + case ETH_PHY_JL1101: _phy = esp_eth_phy_new_jl1101(&phy_config); break; case ETH_PHY_KSZ8041: _phy = esp_eth_phy_new_ksz80xx(&phy_config); break; case ETH_PHY_KSZ8081: _phy = esp_eth_phy_new_ksz80xx(&phy_config); break; default: log_e("Unsupported PHY %d", type); break; diff --git a/libraries/Ethernet/src/ETH.h b/libraries/Ethernet/src/ETH.h index c52aac6ec6f..0e10c012435 100644 --- a/libraries/Ethernet/src/ETH.h +++ b/libraries/Ethernet/src/ETH.h @@ -130,11 +130,12 @@ typedef enum { #if CONFIG_ETH_USE_ESP32_EMAC #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0) ETH_PHY_GENERIC, -#define ETH_PHY_JL1101 ETH_PHY_GENERIC +//#define ETH_PHY_JL1101 ETH_PHY_GENERIC // Tasmota IDF has native JL1101 driver #endif ETH_PHY_LAN8720, ETH_PHY_TLK110, ETH_PHY_RTL8201, + ETH_PHY_JL1101, ETH_PHY_DP83848, ETH_PHY_KSZ8041, ETH_PHY_KSZ8081, diff --git a/libraries/FS/src/vfs_api.cpp b/libraries/FS/src/vfs_api.cpp index 616f37ac611..a57067c1bbb 100644 --- a/libraries/FS/src/vfs_api.cpp +++ b/libraries/FS/src/vfs_api.cpp @@ -96,7 +96,6 @@ FileImplPtr VFSImpl::open(const char *fpath, const char *mode, const bool create return std::make_shared(this, fpath, mode); } - log_e("%s does not exist, no permits for creation", temp); free(temp); return FileImplPtr(); } diff --git a/libraries/HTTPClient/src/HTTPClient.h b/libraries/HTTPClient/src/HTTPClient.h index 80f6da28599..20d07c723ed 100644 --- a/libraries/HTTPClient/src/HTTPClient.h +++ b/libraries/HTTPClient/src/HTTPClient.h @@ -31,6 +31,10 @@ #define HTTPCLIENT_1_1_COMPATIBLE #endif +#ifndef HTTPCLIENT_NOSECURE +#define HTTPCLIENT_NOSECURE +#endif + #include #include #include diff --git a/libraries/SimpleBLE/src/SimpleBLE.cpp b/libraries/SimpleBLE/src/SimpleBLE.cpp index 3c4ed915c05..3f1f2bbd1c1 100644 --- a/libraries/SimpleBLE/src/SimpleBLE.cpp +++ b/libraries/SimpleBLE/src/SimpleBLE.cpp @@ -13,8 +13,9 @@ // limitations under the License. #include "sdkconfig.h" +#include "soc/soc_caps.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include "SimpleBLE.h" #include "esp32-hal-log.h" diff --git a/libraries/SimpleBLE/src/SimpleBLE.h b/libraries/SimpleBLE/src/SimpleBLE.h index 23c1cdb593f..df1ee751f10 100644 --- a/libraries/SimpleBLE/src/SimpleBLE.h +++ b/libraries/SimpleBLE/src/SimpleBLE.h @@ -16,8 +16,9 @@ #define _SIMPLE_BLE_H_ #include "sdkconfig.h" +#include "soc/soc_caps.h" -#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) +#if SOC_BT_SUPPORTED && defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED) #include #include diff --git a/libraries/Update/src/Update.h b/libraries/Update/src/Update.h index 9a4d3e02489..67189da2f02 100644 --- a/libraries/Update/src/Update.h +++ b/libraries/Update/src/Update.h @@ -7,6 +7,10 @@ #ifndef ESP32UPDATER_H #define ESP32UPDATER_H +#ifndef UPDATE_NOCRYPT +#define UPDATE_NOCRYPT +#endif + #include #include #include diff --git a/libraries/WebServer/src/WebServer.cpp b/libraries/WebServer/src/WebServer.cpp index 652a86f587f..bdc583e786d 100644 --- a/libraries/WebServer/src/WebServer.cpp +++ b/libraries/WebServer/src/WebServer.cpp @@ -467,7 +467,7 @@ void WebServer::handleClient() { case HC_WAIT_CLOSE: if (_currentClient.isSSE()) { // Never close connection - _statusChange = millis(); + //_statusChange = millis(); } // Wait for client to close the connection if (millis() - _statusChange <= HTTP_MAX_CLOSE_WAIT) { diff --git a/package.json b/package.json index 9c918733209..4c3e4725a9d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "framework-arduinoespressif32", - "version": "3.2.0", + "version": "3.3.0", "description": "Arduino Wiring-based Framework for the Espressif ESP32, ESP32-P4, ESP32-S and ESP32-C series of SoCs", "keywords": [ "framework", diff --git a/tools/pioarduino-build.py b/tools/pioarduino-build.py index 47940b0d043..8795146a713 100644 --- a/tools/pioarduino-build.py +++ b/tools/pioarduino-build.py @@ -22,7 +22,7 @@ http://arduino.cc/en/Reference/HomePage """ -# Extends: https://github.com/pioarduino/platform-espressif32/blob/develop/builder/main.py +# Extends: https://github.com/tasmota/platform-espressif32/blob/develop/builder/main.py from os.path import abspath, basename, isdir, isfile, join from copy import deepcopy @@ -35,7 +35,7 @@ partitions_name = board_config.get("build.partitions", board_config.get("build.arduino.partitions", "")) FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") -FRAMEWORK_LIBS_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") +FRAMEWORK_LIBS_DIR = join(FRAMEWORK_DIR, "tools", "esp32-arduino-libs") assert isdir(FRAMEWORK_DIR) @@ -184,9 +184,15 @@ def add_tinyuf2_extra_image(): libs = [] variants_dir = join(FRAMEWORK_DIR, "variants") +try: + build_variants_dir = join(board_config.get("build.variants_dir")) +except Exception: + build_variants_dir = "" if "build.variants_dir" in board_config: - variants_dir = join("$PROJECT_DIR", board_config.get("build.variants_dir")) + if len(build_variants_dir) > 1: + variants_dir = join("$PROJECT_DIR", board_config.get("build.variants_dir")) + if "build.variant" in board_config: env.Append(CPPPATH=[join(variants_dir, board_config.get("build.variant"))]) @@ -209,6 +215,15 @@ def add_tinyuf2_extra_image(): # Process framework extra images # +# Tasmota places extra images "safeboot" in custom variants folder in project directory +build_name = join(board_config.get("name")) +if len(build_variants_dir) > 1: + EXTRA_IMG_DIR = join(variants_dir) +else: + EXTRA_IMG_DIR = FRAMEWORK_DIR + if "tasmota" in build_name.lower(): + EXTRA_IMG_DIR = join(EXTRA_IMG_DIR, "variants", "tasmota") + env.Append( LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")], FLASH_EXTRA_IMAGES=[ @@ -223,7 +238,7 @@ def add_tinyuf2_extra_image(): ("0x8000", join(env.subst("$BUILD_DIR"), "partitions.bin")), ("0xe000", join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin")), ] - + [(offset, join(FRAMEWORK_DIR, img)) for offset, img in board_config.get("upload.arduino.flash_extra_images", [])], + + [(offset, join(EXTRA_IMG_DIR, img)) for offset, img in board_config.get("upload.arduino.flash_extra_images", [])], ) # Add an extra UF2 image if the 'TinyUF2' partition is selected diff --git a/variants/esp32p4/pins_arduino.h b/variants/esp32p4/pins_arduino.h index cbb1e871ae5..a7a5568adf3 100644 --- a/variants/esp32p4/pins_arduino.h +++ b/variants/esp32p4/pins_arduino.h @@ -10,8 +10,8 @@ static const uint8_t TX = 37; static const uint8_t RX = 38; -static const uint8_t SDA = 7; -static const uint8_t SCL = 8; +static const uint8_t SDA = 13; +static const uint8_t SCL = 12; // Use GPIOs 36 or lower on the P4 DevKit to avoid LDO power issues with high numbered GPIOs. static const uint8_t SS = 26; From 3b531d78d69655cf7d4a34c3dd5ab3858216a54d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:28:25 +0200 Subject: [PATCH 2/3] Ledc struct change idf 5.4 --- cores/esp32/esp32-hal-ledc.c | 38 ++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index 0a3ec5a60c7..039fa1312f1 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -126,7 +126,14 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c return false; } } else { - ledc_timer_config_t ledc_timer = {.speed_mode = group, .timer_num = timer, .duty_resolution = resolution, .freq_hz = freq, .clk_cfg = clock_source}; + ledc_timer_config_t ledc_timer; + memset((void *)&ledc_timer, 0, sizeof(ledc_timer_config_t)); + ledc_timer.speed_mode = group; + ledc_timer.timer_num = timer; + ledc_timer.duty_resolution = resolution; + ledc_timer.freq_hz = freq; + ledc_timer.clk_cfg = clock_source; + if (ledc_timer_config(&ledc_timer) != ESP_OK) { log_e("ledc setup failed!"); return false; @@ -134,9 +141,16 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c uint32_t duty = ledc_get_duty(group, (channel % 8)); - ledc_channel_config_t ledc_channel = { - .speed_mode = group, .channel = (channel % 8), .timer_sel = timer, .intr_type = LEDC_INTR_DISABLE, .gpio_num = pin, .duty = duty, .hpoint = 0 - }; + ledc_channel_config_t ledc_channel; + memset((void *)&ledc_channel, 0, sizeof(ledc_channel_config_t)); + ledc_channel.speed_mode = group; + ledc_channel.channel = (channel % 8); + ledc_channel.timer_sel = timer; + ledc_channel.intr_type = LEDC_INTR_DISABLE; + ledc_channel.gpio_num = pin; + ledc_channel.duty = duty; + ledc_channel.hpoint = 0; + ledc_channel_config(&ledc_channel); } @@ -256,7 +270,13 @@ uint32_t ledcWriteTone(uint8_t pin, uint32_t freq) { uint8_t group = (bus->channel / 8), timer = ((bus->channel / 2) % 4); - ledc_timer_config_t ledc_timer = {.speed_mode = group, .timer_num = timer, .duty_resolution = 10, .freq_hz = freq, .clk_cfg = clock_source}; + ledc_timer_config_t ledc_timer; + memset((void *)&ledc_timer, 0, sizeof(ledc_timer_config_t)); + ledc_timer.speed_mode = group; + ledc_timer.timer_num = timer; + ledc_timer.duty_resolution = 10; + ledc_timer.freq_hz = freq; + ledc_timer.clk_cfg = clock_source; if (ledc_timer_config(&ledc_timer) != ESP_OK) { log_e("ledcWriteTone configuration failed!"); @@ -307,7 +327,13 @@ uint32_t ledcChangeFrequency(uint8_t pin, uint32_t freq, uint8_t resolution) { } uint8_t group = (bus->channel / 8), timer = ((bus->channel / 2) % 4); - ledc_timer_config_t ledc_timer = {.speed_mode = group, .timer_num = timer, .duty_resolution = resolution, .freq_hz = freq, .clk_cfg = clock_source}; + ledc_timer_config_t ledc_timer; + memset((void *)&ledc_timer, 0, sizeof(ledc_timer_config_t)); + ledc_timer.speed_mode = group; + ledc_timer.timer_num = timer; + ledc_timer.duty_resolution = resolution; + ledc_timer.freq_hz = freq; + ledc_timer.clk_cfg = clock_source; if (ledc_timer_config(&ledc_timer) != ESP_OK) { log_e("ledcChangeFrequency failed!"); From 52259809ac4543b136959896a686dac6c26b58ad Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:35:27 +0200 Subject: [PATCH 3/3] Update RxTimeout_Demo.ino --- .../Serial/RxTimeout_Demo/RxTimeout_Demo.ino | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino b/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino index 64d15d3d916..35d2da5c199 100644 --- a/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino +++ b/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino @@ -21,6 +21,15 @@ If UART receives less than 120 bytes, it will wait RX Timeout to understand that the bus is IDLE and then copy the data from the FIFO to the Arduino internal buffer, making it available to the Arduino API. + There is an important detail about how HardwareSerial works using ESP32 and ESP32-S2: + If the baud rate is lower than 250,000, it will select REF_TICK as clock source in order to avoid that + the baud rate may change when the CPU Frequency is changed. Default UART clock source is APB, which changes + when CPU clock source is also changed. But when it selects REF_TICK as UART clock source, RX Timeout is limited to 1. + Therefore, in order to change the ESP32/ESP32-S2 RX Timeout it is necessary to fix the UART Clock Source to APB. + + In the case of the other SoC, such as ESP32-S3, C3, C6, H2 and P4, there is no such RX Timeout limitation. + Those will set the UART Source Clock as XTAL, which allows the baud rate to be high and it is steady, not + changing with the CPU Frequency. */ #include @@ -45,6 +54,12 @@ void setup() { // UART1 will have its RX<->TX cross connected // GPIO4 <--> GPIO5 using external wire +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 + // UART_CLK_SRC_APB will allow higher values of RX Timeout + // default for ESP32 and ESP32-S2 is REF_TICK which limits the RX Timeout to 1 + // setClockSource() must be called before begin() + Serial1.setClockSource(UART_CLK_SRC_APB); +#endif Serial1.begin(BAUD, SERIAL_8N1, RXPIN, TXPIN); // Rx = 4, Tx = 5 will work for ESP32, S2, S3 and C3 #if USE_INTERNAL_PIN_LOOPBACK uart_internal_loopback(TEST_UART, RXPIN);