From c768275be86869901f2fbb2d3469e18f07ff84d9 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 14 Apr 2025 11:29:53 +0200 Subject: [PATCH 1/9] Tasmota changes * optional Ethernet support (JL1101 driver added) * esp-modem only esp32, esp32s2 and esp32s3 * remove `OpenThread` * remove all BT 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-misc.c | 21 --- cores/esp32/esp32-hal.h | 1 - cores/esp32/main.cpp | 6 + idf_component.yml | 70 +-------- 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/Update/src/Update.h | 4 + libraries/WebServer/src/WebServer.cpp | 2 +- libraries/WiFi/src/WiFiGeneric.cpp | 6 +- tools/pioarduino-build.py | 23 ++- variants/esp32p4/pins_arduino.h | 4 +- 21 files changed, 98 insertions(+), 528 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14fcb19b6da..7b3579ed7b4 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 e974f112701..7573e88495e 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-misc.c b/cores/esp32/esp32-hal-misc.c index 594acd38153..04db0dde879 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) @@ -243,19 +240,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(); @@ -305,11 +289,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 967c4ecf0f6..c707f4a74b6 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -51,57 +51,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 in [esp32, esp32s2, esp32s3, esp32h2, esp32p4]" 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: @@ -110,18 +63,11 @@ dependencies: version: "^0.4.1" 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/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/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/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index aa994963514..3faf34fef34 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -602,9 +602,9 @@ bool WiFiGenericClass::mode(wifi_mode_t m) { #else #define WIFI_PROTOCOL_DEFAULT (WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N) #endif - uint8_t current_protocol = 0; + uint32_t current_protocol = 0; if (m & WIFI_MODE_STA) { - err = esp_wifi_get_protocol(WIFI_IF_STA, ¤t_protocol); + err = esp_wifi_get_protocol(WIFI_IF_STA, (uint8_t *)¤t_protocol); if (err == ESP_OK && current_protocol == WIFI_PROTOCOL_LR) { log_v("Disabling long range on STA"); err = esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_DEFAULT); @@ -614,7 +614,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m) { } } if (m & WIFI_MODE_AP) { - err = esp_wifi_get_protocol(WIFI_IF_AP, ¤t_protocol); + err = esp_wifi_get_protocol(WIFI_IF_AP, (uint8_t *)¤t_protocol); if (err == ESP_OK && current_protocol == WIFI_PROTOCOL_LR) { log_v("Disabling long range on AP"); err = esp_wifi_set_protocol(WIFI_IF_AP, WIFI_PROTOCOL_DEFAULT); diff --git a/tools/pioarduino-build.py b/tools/pioarduino-build.py index 3335a716888..9b688a0cdbe 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=[ @@ -219,7 +234,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 bc311215c5357bf55772e3a043a0f3de2259fd35 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 21 Apr 2025 20:49:05 +0200 Subject: [PATCH 2/9] Update esp32-hal-gpio.c --- cores/esp32/esp32-hal-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp32/esp32-hal-gpio.c b/cores/esp32/esp32-hal-gpio.c index c681be077b3..90ad1e7f36d 100644 --- a/cores/esp32/esp32-hal-gpio.c +++ b/cores/esp32/esp32-hal-gpio.c @@ -185,7 +185,7 @@ extern int ARDUINO_ISR_ATTR __digitalRead(uint8_t pin) { #endif // RGB_BUILTIN // This work when the pin is set as GPIO and in INPUT mode. For all other pin functions, it may return inconsistent response if (perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) == NULL) { - log_w("IO %i is not set as GPIO. digitalRead() may return an inconsistent value."); + log_w("IO %i is not set as GPIO. digitalRead() may return an inconsistent value.", pin); } return gpio_get_level((gpio_num_t)pin); } From 4207eb589959f2aeff8f0c45369531b1b8d3a89b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:30:09 +0200 Subject: [PATCH 3/9] 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 b3773e92ec2820d252eaf2fa4f5c3137b0570aea Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:34:54 +0200 Subject: [PATCH 4/9] 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); From 051ad9ed58b51029a9c4c0288435176949f2a134 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 18 May 2025 11:18:31 +0200 Subject: [PATCH 5/9] Update esp32-hal-bt.c --- cores/esp32/esp32-hal-bt.c | 103 +++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/cores/esp32/esp32-hal-bt.c b/cores/esp32/esp32-hal-bt.c index 2eb3ad959f5..1e5f73e324c 100644 --- a/cores/esp32/esp32-hal-bt.c +++ b/cores/esp32/esp32-hal-bt.c @@ -15,7 +15,108 @@ #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; } @@ -28,4 +129,6 @@ bool btStop() { return false; } +#endif /* CONFIG_BT_ENABLED */ + #endif /* SOC_BT_SUPPORTED */ From 265bc9b22c87de0b03f3bded1ead2281673df79b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 18 May 2025 11:19:35 +0200 Subject: [PATCH 6/9] Update esp32-hal-bt.h --- cores/esp32/esp32-hal-bt.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cores/esp32/esp32-hal-bt.h b/cores/esp32/esp32-hal-bt.h index 9758e8ab1fc..8ab03eea904 100644 --- a/cores/esp32/esp32-hal-bt.h +++ b/cores/esp32/esp32-hal-bt.h @@ -24,8 +24,16 @@ 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 From a34beba355421ab3f3b0eeb16c8dff63aac7bc6a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 18 May 2025 11:20:53 +0200 Subject: [PATCH 7/9] Update esp32-hal-misc.c --- cores/esp32/esp32-hal-misc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 04db0dde879..594acd38153 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -25,6 +25,9 @@ #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) @@ -240,6 +243,19 @@ 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(); @@ -289,6 +305,11 @@ 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(); } From 6d1511d5f92b4cb53fec5ff898b996396b5a32f6 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 18 May 2025 11:22:06 +0200 Subject: [PATCH 8/9] Update esp32-hal.h --- cores/esp32/esp32-hal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index de98e644c1a..5ed99aeb205 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -96,6 +96,7 @@ 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" From e749b5f602510b511d23f79eb42f0b5dc7a79182 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 18 May 2025 12:28:23 +0200 Subject: [PATCH 9/9] Update CMakeLists.txt --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b3579ed7b4..4eb76770fd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ set(CORE_SRCS cores/esp32/cbuf.cpp cores/esp32/ColorFormat.c 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