Skip to content

Commit

Permalink
Tasmota changes
Browse files Browse the repository at this point in the history
* Create ESP_NetworkInterface class and have Ethernet extending it

* Update CMakeLists.txt

* Split networking from WiFi (H2 can now use Ethernet)

Now all libs have been checked yet. More to do on WiFi side

* Fix build errors

* Guard WiFi classes and fix RMII ETH examples

* Decouple network related libraries from WiFi

* Fix examples and WiFiUpdate

* Guard WiFiProv lib to compile only on WiFi chips

* Add periman string for network and "fix" mdns on the first ETH

* Revert back location of Client/Server/Udp in order to accept some PRs

* Fix periman

* Some fixes from merging master

* Fix web server missing fs.h

* Move Client, Server and Udp out of WiFi

* More fixes

* more fixes

* Fix CMakekLists and rework lib menu dependencies

* Fix CMake issues

* move back WiFiClient to rebase with master

* Update ETH_TLK110.ino

* Move back WiFiClient

* Update progress

* Update WiFiGeneric.cpp

* More fixes

* Switch AP to the new interface

* Cleanup

* Rename AP methods

* Add extra interface info for Printable

* Rename IPv6 getters to clarify that they are returning LinkLocal address

cc @sgryphon

* Rename network classes

cc @sgryphon

* Update NetworkManager.h

* Rename WiFi Server and UDP

* Rename WiFiClient and WiFiClientSecure

* Update CMakeLists.txt

* Update on-push.sh

* Rename Network library

* Remove unnecessary guard

* Get the correct interface MAC address for mDND Workstation service

* Apply suggestions from code review

Co-authored-by: Lucas Saavedra Vaz <[email protected]>

* Tasmota changes

* 3.0.0 Network Refactoring (espressif#8760)

* Create ESP_NetworkInterface class and have Ethernet extending it

* Update CMakeLists.txt

* Split networking from WiFi (H2 can now use Ethernet)

Now all libs have been checked yet. More to do on WiFi side

* Fix build errors

* Guard WiFi classes and fix RMII ETH examples

* Decouple network related libraries from WiFi

* Fix examples and WiFiUpdate

* Guard WiFiProv lib to compile only on WiFi chips

* Add periman string for network and "fix" mdns on the first ETH

* Revert back location of Client/Server/Udp in order to accept some PRs

* Fix periman

* Some fixes from merging master

* Fix web server missing fs.h

* Move Client, Server and Udp out of WiFi

* More fixes

* more fixes

* Fix CMakekLists and rework lib menu dependencies

* Fix CMake issues

* move back WiFiClient to rebase with master

* Update ETH_TLK110.ino

* Move back WiFiClient

* Update progress

* Update WiFiGeneric.cpp

* More fixes

* Switch AP to the new interface

* Cleanup

* Rename AP methods

* Add extra interface info for Printable

* Rename IPv6 getters to clarify that they are returning LinkLocal address

cc @sgryphon

* Rename network classes

cc @sgryphon

* Update NetworkManager.h

* Rename WiFi Server and UDP

* Rename WiFiClient and WiFiClientSecure

* Update CMakeLists.txt

* Update on-push.sh

* Rename Network library

* Remove unnecessary guard

* Get the correct interface MAC address for mDND Workstation service

* Apply suggestions from code review



---------

Co-authored-by: Me No Dev <[email protected]>
Co-authored-by: Lucas Saavedra Vaz <[email protected]>

---------

Co-authored-by: me-no-dev <[email protected]>
Co-authored-by: Me No Dev <[email protected]>
Co-authored-by: Lucas Saavedra Vaz <[email protected]>
  • Loading branch information
4 people authored Mar 27, 2024
1 parent f2026f1 commit 26f7ad5
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 282 deletions.
79 changes: 1 addition & 78 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ endif()
set(CORE_SRCS
cores/esp32/base64.cpp
cores/esp32/cbuf.cpp
cores/esp32/chip-debug-report.cpp
cores/esp32/esp32-hal-adc.c
cores/esp32/esp32-hal-bt.c
cores/esp32/esp32-hal-cpu.c
Expand Down Expand Up @@ -78,36 +77,26 @@ set(CORE_SRCS
set(ARDUINO_ALL_LIBRARIES
ArduinoOTA
AsyncUDP
BLE
BluetoothSerial
DNSServer
EEPROM
ESP_I2S
ESP_SR
ESPmDNS
Ethernet
FFat
FS
HTTPClient
HTTPUpdate
Insights
LittleFS
NetBIOS
Network
Preferences
RainMaker
SD_MMC
SD
SimpleBLE
SPIFFS
SPI
Ticker
Update
USB
WebServer
NetworkClientSecure
WiFi
WiFiProv
Wire
)

Expand All @@ -116,22 +105,10 @@ set(ARDUINO_LIBRARY_ArduinoOTA_REQUIRES esp_https_ota)

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_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)
Expand All @@ -146,35 +123,19 @@ 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_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
libraries/SD/src/SD.cpp
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)
Expand All @@ -199,10 +160,6 @@ set(ARDUINO_LIBRARY_WebServer_SRCS
libraries/WebServer/src/Parsing.cpp
libraries/WebServer/src/detail/mimetable.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
Expand All @@ -221,42 +178,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_BLE_SRCS
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)
Expand All @@ -278,7 +201,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 wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser)
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid ${ARDUINO_LIBRARIES_REQUIRES})
set(priv_requires fatfs nvs_flash app_update bootloader_support bt esp_hid ${ARDUINO_LIBRARIES_REQUIRES})

idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})

Expand Down
70 changes: 7 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
# Arduino core for the ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2
# Tasmota Platformio Arduino for ESP32, ESP32-S2, ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C6 and ESP32-H2

![Build Status](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![External Libraries Test](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md) [![Hardware Tests](https://github.com/espressif/arduino-esp32/actions/workflows/hil.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/actions/workflows/hil.yml?query=event%3Aschedule)

### Need help or have a question? Join the chat at [Gitter](https://gitter.im/espressif/arduino-esp32) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)

## 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?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/)

Latest Development Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/) [![Release Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/) [![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg?style=plastic)](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

Expand All @@ -36,51 +12,19 @@ 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-C3 | Yes | Yes | [ESP32-C3](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) |
| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) |
| ESP32-C3 | Yes | Yes | [ESP32-C3](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) |
| ESP32-C2 | No | Yes | [ESP32-C2](https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf) |
| ESP32-C6 | No | Yes | [ESP32-C6](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) |
| ESP32-H2 | No | Yes | [ESP32-H2](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) |

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 labelled 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).
6 changes: 6 additions & 0 deletions cores/esp32/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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
Expand Down Expand Up @@ -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
Expand Down
42 changes: 2 additions & 40 deletions idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,44 +43,6 @@ files:
- "programmers.txt"
dependencies:
idf: ">=5.1"
# mdns 1.2.1 is necessary to build H2 with no WiFi
# mdns 1.2.3 is necessary to build H2 with no WiFi
mdns: "^1.2.3"
chmorgan/esp-libhelix-mp3:
version: "1.0.3"
require: public
espressif/esp-zboss-lib:
version: "^1.0.1"
rules:
- if: "target != esp32c2"
espressif/esp-zigbee-lib:
version: "^1.0.1"
rules:
- if: "target != esp32c2"
esp-dsp:
version: "^1.3.4"
rules:
- if: "target != esp32c2"
espressif/esp_rainmaker:
version: "^1.0.0"
rules:
- if: "target != esp32c2"
espressif/rmaker_common:
version: "^1.4.3"
rules:
- if: "target != esp32c2"
espressif/esp_insights:
version: "^1.0.1"
rules:
- if: "target != esp32c2"
espressif/qrcode:
version: "^0.1.0~1"
rules:
- if: "target != esp32c2"
joltwallet/littlefs: "^1.10.2"
espressif/esp-sr:
version: "^1.4.2"
rules:
- if: "target in [esp32s3]"
examples:
- path: ./idf_component_examples/Hello_world

joltwallet/littlefs: "^1.14.1"
3 changes: 3 additions & 0 deletions libraries/Ethernet/src/ETH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i
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;
Expand Down
5 changes: 4 additions & 1 deletion libraries/Ethernet/src/ETH.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
// This will be uncommented once custom SPI support is available in ESP-IDF
#define ETH_SPI_SUPPORTS_CUSTOM 1

// This will be removed when the support is backported to official IDF 5.1
#define ETH_SPI_SUPPORTS_NO_IRQ 1

#include "Network.h"

#if ETH_SPI_SUPPORTS_CUSTOM
Expand Down Expand Up @@ -92,7 +95,7 @@ typedef enum { ETH_CLOCK_GPIO0_IN, ETH_CLOCK_GPIO0_OUT, ETH_CLOCK_GPIO16_OUT, ET

typedef enum {
#if CONFIG_ETH_USE_ESP32_EMAC
ETH_PHY_LAN8720, ETH_PHY_TLK110, ETH_PHY_RTL8201, ETH_PHY_DP83848, ETH_PHY_KSZ8041, ETH_PHY_KSZ8081,
ETH_PHY_LAN8720, ETH_PHY_TLK110, ETH_PHY_RTL8201, ETH_PHY_JL1101, ETH_PHY_DP83848, ETH_PHY_KSZ8041, ETH_PHY_KSZ8081,
#endif /* CONFIG_ETH_USE_ESP32_EMAC */
#if CONFIG_ETH_SPI_ETHERNET_DM9051
ETH_PHY_DM9051,
Expand Down
Loading

0 comments on commit 26f7ad5

Please sign in to comment.