Remove old and modified libs, switch to ESPAsyncWebserver, add support for ESP32-H2 and multiple Ethernet modules (#455)
* Asyncwebserver * Squashed commit of the following: commit 575ef02f593918ec6654c87407a4d11fc17071b8 Author: technyon <j.o.schuemann@gmx.de> Date: Mon Aug 12 17:56:11 2024 +0200 merge master commit 35e5adf4ecd80f9829e8801181f35dd2c1d94759 Merge: a2cc7be221adca01Author: technyon <j.o.schuemann@gmx.de> Date: Mon Aug 12 17:41:04 2024 +0200 Merge branch 'master' of github.com:technyon/nuki_hub into DM9051 commit a2cc7be2954cbd8767ab8186296c0b14134d1d0b Author: technyon <j.o.schuemann@gmx.de> Date: Mon Aug 12 10:51:50 2024 +0200 update nuki ble commit 20c809f3dca28b29b219d1ff3a183f1981316de5 Author: technyon <j.o.schuemann@gmx.de> Date: Mon Aug 12 10:44:46 2024 +0200 backup commit dd41c218efb5270f5efeb734e64dff695920db16 Merge: 153000b5e84b944aAuthor: technyon <j.o.schuemann@gmx.de> Date: Mon Aug 12 10:40:03 2024 +0200 Merge branch 'master' of github.com:technyon/nuki_hub into DM9051 commit 153000b5b1af7df1fbeb5263df94eb26f689cc0a Author: technyon <j.o.schuemann@gmx.de> Date: Mon Aug 12 10:23:07 2024 +0200 fix linker error commit a93bbfbfc4301e46ff3696a763dd13c6c89efefb Author: technyon <j.o.schuemann@gmx.de> Date: Sun Aug 11 11:27:07 2024 +0200 backup commit f611c75ce8c35f829bcad6cf7e86188f4b3ec331 Merge: f1964917063fbab6Author: technyon <j.o.schuemann@gmx.de> Date: Sun Aug 11 11:24:47 2024 +0200 merge master commit f1964917b4dade3920f1ecdb699c58630199e6da Author: technyon <j.o.schuemann@gmx.de> Date: Sat Aug 10 15:17:45 2024 +0200 update platformio.ini commit f448e5e8a7e93be38e09e2ab0b622199a3721af6 Author: technyon <j.o.schuemann@gmx.de> Date: Sat Aug 10 11:28:09 2024 +0200 add SPIClass instance for DM9051 commit 1f190e9aa08033535a2eb442a92e6e20409bbda1 Author: technyon <j.o.schuemann@gmx.de> Date: Sat Aug 10 11:22:26 2024 +0200 add definitions and constructor for DM9051 commit 726b3602ae91594ee1210ad5b6714f75cc5e42a7 Merge: 50a2eb134af90cbcAuthor: technyon <j.o.schuemann@gmx.de> Date: Sat Aug 10 10:19:34 2024 +0200 merge master commit 50a2eb136d75d90921f1c6974f18bc107bddc123 Author: technyon <j.o.schuemann@gmx.de> Date: Fri Aug 9 11:52:09 2024 +0200 add comment commit 9437e485cae169efdf8e5a7bf188a1c7e792d1e5 Author: technyon <j.o.schuemann@gmx.de> Date: Sun Aug 4 08:29:21 2024 +0200 move LAN8720 definitions to seperate file * Remove Core 2 Ethernet library * Custom Ethernet * GPIO and Preferences * H2
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
""" PlatformIO POST script execution to copy updater """
|
||||
|
||||
Import("env")
|
||||
import glob, re, shutil, os
|
||||
from pathlib import Path
|
||||
|
||||
def get_board_name(env):
|
||||
board = env.get('BOARD_MCU')
|
||||
if env.get('BOARD') == 'esp32-solo1':
|
||||
board = env.get('BOARD').replace('-', '')
|
||||
return board
|
||||
|
||||
def create_target_dir(env):
|
||||
board = get_board_name(env)
|
||||
target_dir = env.GetProjectOption("custom_build") + '/' + board
|
||||
if not os.path.exists(target_dir):
|
||||
os.makedirs(target_dir)
|
||||
return target_dir
|
||||
|
||||
def copy_files(source, target, env):
|
||||
file = Path(target[0].get_abspath())
|
||||
target_dir = create_target_dir(env)
|
||||
board = get_board_name(env)
|
||||
|
||||
if "firmware" in file.stem:
|
||||
shutil.copy(file, f"{target_dir}/updater.bin")
|
||||
|
||||
def remove_files(source, target, env):
|
||||
for f in glob.glob("src/*.cpp"):
|
||||
os.remove(f)
|
||||
|
||||
for f in glob.glob("src/*.h"):
|
||||
os.remove(f)
|
||||
|
||||
for f in glob.glob("src/networkDevices/*.cpp"):
|
||||
os.remove(f)
|
||||
|
||||
for f in glob.glob("src/networkDevices/*.h"):
|
||||
os.remove(f)
|
||||
|
||||
env.AddPostAction("$BUILD_DIR/firmware.bin", copy_files)
|
||||
env.AddPostAction("$BUILD_DIR/firmware.bin", remove_files)
|
||||
|
||||
regex = r"\#define NUKI_HUB_DATE \"(.*)\""
|
||||
content_new = ""
|
||||
|
||||
with open ('../src/Config.h', 'r' ) as readfile:
|
||||
file_content = readfile.read()
|
||||
content_new = re.sub(regex, "#define NUKI_HUB_DATE \"unknownbuilddate\"", file_content, flags = re.M)
|
||||
|
||||
with open('../src/Config.h', 'w') as writefile:
|
||||
writefile.write(content_new)
|
||||
28
updater/pio_package_post.py
Normal file
28
updater/pio_package_post.py
Normal file
@@ -0,0 +1,28 @@
|
||||
""" PlatformIO POST script execution to copy updater """
|
||||
|
||||
Import("env")
|
||||
import glob, re, shutil, os
|
||||
from pathlib import Path
|
||||
|
||||
def get_board_name(env):
|
||||
board = env.get('BOARD_MCU')
|
||||
if env.get('BOARD') == 'esp32-solo1':
|
||||
board = env.get('BOARD').replace('-', '')
|
||||
return board
|
||||
|
||||
def create_target_dir(env):
|
||||
board = get_board_name(env)
|
||||
target_dir = env.GetProjectOption("custom_build") + '/' + board
|
||||
if not os.path.exists(target_dir):
|
||||
os.makedirs(target_dir)
|
||||
return target_dir
|
||||
|
||||
def copy_files(source, target, env):
|
||||
file = Path(target[0].get_abspath())
|
||||
target_dir = create_target_dir(env)
|
||||
board = get_board_name(env)
|
||||
|
||||
if "firmware" in file.stem:
|
||||
shutil.copy(file, f"{target_dir}/updater.bin")
|
||||
|
||||
env.AddPostAction("$BUILD_DIR/firmware.bin", copy_files)
|
||||
@@ -10,23 +10,50 @@ def recursive_purge(dir, pattern):
|
||||
elif re.search(pattern, os.path.join(dir, f)):
|
||||
os.remove(os.path.join(dir, f))
|
||||
|
||||
if os.path.exists("src/Config.h"):
|
||||
with open("../src/Config.h", "rb") as file_a, open("src/Config.h", "rb") as file_b:
|
||||
if file_a.read() != file_b.read():
|
||||
shutil.copy2("../src/Config.h", "src/Config.h")
|
||||
else:
|
||||
shutil.copy2("../src/Config.h", "src/Config.h")
|
||||
|
||||
regex = r"\#define NUKI_HUB_DATE \"(.*)\""
|
||||
content_new = ""
|
||||
file_content = ""
|
||||
|
||||
with open ('../src/Config.h', 'r' ) as readfile:
|
||||
with open ('src/Config.h', 'r' ) as readfile:
|
||||
file_content = readfile.read()
|
||||
content_new = re.sub(regex, "#define NUKI_HUB_DATE \"" + datetime.now(timezone.utc).strftime("%Y-%m-%d") + "\"", file_content, flags = re.M)
|
||||
|
||||
with open('../src/Config.h', 'w') as writefile:
|
||||
writefile.write(content_new)
|
||||
if content_new != file_content:
|
||||
with open('src/Config.h', 'w') as writefile:
|
||||
writefile.write(content_new)
|
||||
|
||||
if os.path.exists("src/main.cpp"):
|
||||
with open("../src/main.cpp", "rb") as file_a, open("src/main.cpp", "rb") as file_b:
|
||||
if file_a.read() != file_b.read():
|
||||
shutil.copy2("../src/main.cpp", "src/main.cpp")
|
||||
else:
|
||||
shutil.copy2("../src/main.cpp", "src/main.cpp")
|
||||
|
||||
shutil.copy("../src/main.cpp", "src/main.cpp")
|
||||
recursive_purge("managed_components", ".component_hash")
|
||||
|
||||
if env.get('BOARD_MCU') == "esp32":
|
||||
board = "esp32dev"
|
||||
else:
|
||||
board = env.get('BOARD_MCU')
|
||||
board = env.get('BOARD_MCU')
|
||||
|
||||
if os.path.exists("sdkconfig.updater_" + board):
|
||||
os.remove("sdkconfig." + board)
|
||||
f1 = 0;
|
||||
f2 = 0;
|
||||
f3 = 0;
|
||||
f4 = os.path.getmtime("sdkconfig.updater_" + board)
|
||||
|
||||
if os.path.exists("sdkconfig.defaults." + board):
|
||||
f1 = os.path.getmtime("sdkconfig.defaults." + board)
|
||||
|
||||
if os.path.exists("sdkconfig.release.defaults"):
|
||||
f2 = os.path.getmtime("sdkconfig.release.defaults")
|
||||
|
||||
if os.path.exists("sdkconfig.defaults"):
|
||||
f3 = os.path.getmtime("sdkconfig.defaults")
|
||||
|
||||
if(f1 > f4 or f2 > f4 or f3 > f4):
|
||||
os.remove("sdkconfig.updater_" + board)
|
||||
@@ -9,7 +9,7 @@
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = updater_esp32dev
|
||||
default_envs = updater_esp32
|
||||
boards_dir = ../boards
|
||||
|
||||
[env]
|
||||
@@ -32,6 +32,14 @@ build_flags =
|
||||
-DESP_PLATFORM
|
||||
-DESP32
|
||||
-DARDUINO_ARCH_ESP32
|
||||
-DUSE_ESP_IDF_LOG
|
||||
-DCONFIG_ASYNC_TCP_MAX_ACK_TIME=3000
|
||||
-DCONFIG_ASYNC_TCP_PRIORITY=10
|
||||
-DCONFIG_ASYNC_TCP_RUNNING_CORE=1
|
||||
-DCONFIG_ASYNC_TCP_QUEUE_SIZE=128
|
||||
-DCONFIG_ASYNC_TCP_STACK_SIZE=24576
|
||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
||||
-DETH_SPI_SUPPORTS_NO_IRQ
|
||||
-DNUKI_HUB_UPDATER
|
||||
-Wno-ignored-qualifiers
|
||||
-Wno-missing-field-initializers
|
||||
@@ -46,10 +54,7 @@ lib_ignore =
|
||||
WiFiProv
|
||||
lib_deps =
|
||||
AsyncTCP=symlink://../lib/AsyncTCP
|
||||
Ethernet=symlink://../lib/Ethernet
|
||||
HTTPClient=symlink://../lib/HTTPClient
|
||||
NetworkClientSecure=symlink://../lib/NetworkClientSecure
|
||||
WebServer=symlink://../lib/WebServer
|
||||
ESPAsyncWebServer=symlink://../lib/ESPAsyncWebServer
|
||||
WiFiManager=symlink://../lib/WiFiManager
|
||||
|
||||
monitor_speed = 115200
|
||||
@@ -57,26 +62,35 @@ monitor_filters =
|
||||
esp32_exception_decoder
|
||||
time
|
||||
|
||||
[env:updater_esp32dev]
|
||||
[env:updater_esp32]
|
||||
board = esp32dev
|
||||
extra_scripts =
|
||||
pre:pio_package_pre.py
|
||||
post:pio_package.py
|
||||
post:pio_package_post.py
|
||||
|
||||
[env:updater_esp32-c3]
|
||||
extends = env:updater_esp32dev
|
||||
extends = env:updater_esp32
|
||||
board = esp32-c3-devkitc-02
|
||||
|
||||
[env:updater_esp32-s3]
|
||||
extends = env:updater_esp32dev
|
||||
extends = env:updater_esp32
|
||||
board = nuki-esp32-s3
|
||||
|
||||
[env:updater_esp32-c6]
|
||||
extends = env:updater_esp32dev
|
||||
extends = env:updater_esp32
|
||||
board = esp32-c6-devkitm-1
|
||||
|
||||
[env:updater_esp32-h2]
|
||||
extends = env:updater_esp32
|
||||
board = esp32-h2-devkitm-1
|
||||
board_build.cmake_extra_args =
|
||||
-DNUKI_TARGET_H2=y
|
||||
lib_deps =
|
||||
AsyncTCP=symlink://../lib/AsyncTCP
|
||||
ESPAsyncWebServer=symlink://../lib/ESPAsyncWebServer
|
||||
|
||||
[env:updater_esp32-solo1]
|
||||
extends = env:updater_esp32dev
|
||||
extends = env:updater_esp32
|
||||
board = esp32-solo1
|
||||
board_build.cmake_extra_args =
|
||||
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-solo1"
|
||||
@@ -9,8 +9,6 @@ CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y
|
||||
CONFIG_BT_ENABLED=n
|
||||
CONFIG_IEEE802154_ENABLED=n
|
||||
CONFIG_ARDUINO_SELECTIVE_COMPILATION=y
|
||||
CONFIG_ARDUINO_SELECTIVE_HTTPClient=n
|
||||
CONFIG_ARDUINO_SELECTIVE_WebServer=n
|
||||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
|
||||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y
|
||||
CONFIG_LOG_COLORS=n
|
||||
@@ -19,4 +17,9 @@ CONFIG_LOG_MAXIMUM_LEVEL=4
|
||||
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL=0
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL=1
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL=1
|
||||
CONFIG_ETH_ENABLED=y
|
||||
CONFIG_ETH_USE_SPI_ETHERNET=y
|
||||
CONFIG_ETH_SPI_ETHERNET_W5500=y
|
||||
CONFIG_ETH_SPI_ETHERNET_DM9051=y
|
||||
CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y
|
||||
@@ -1,8 +1,7 @@
|
||||
list(APPEND app_sources ${CMAKE_SOURCE_DIR}/src/main.cpp)
|
||||
list(APPEND app_sources ../../src/Config.h)
|
||||
list(APPEND app_sources ${CMAKE_SOURCE_DIR}/src/Config.h)
|
||||
list(APPEND app_sources ../../src/Logger.h)
|
||||
list(APPEND app_sources ../../src/NukiNetwork.h)
|
||||
list(APPEND app_sources ../../src/Ota.h)
|
||||
list(APPEND app_sources ../../src/PreferencesKeys.h)
|
||||
list(APPEND app_sources ../../src/RestartReason.h)
|
||||
list(APPEND app_sources ../../src/WebCfgServer.h)
|
||||
@@ -10,19 +9,22 @@ list(APPEND app_sources ../../src/WebCfgServerConstants.h)
|
||||
|
||||
list(APPEND app_sources ../../src/Logger.cpp)
|
||||
list(APPEND app_sources ../../src/NukiNetwork.cpp)
|
||||
list(APPEND app_sources ../../src/Ota.cpp)
|
||||
list(APPEND app_sources ../../src/WebCfgServer.cpp)
|
||||
|
||||
list(APPEND app_sources ../../src/networkDevices/EthLan8720Device.h)
|
||||
list(APPEND app_sources ../../src/networkDevices/EthernetDevice.h)
|
||||
list(APPEND app_sources ../../src/networkDevices/IPConfiguration.h)
|
||||
list(APPEND app_sources ../../src/networkDevices/NetworkDevice.h)
|
||||
list(APPEND app_sources ../../src/networkDevices/W5500Device.h)
|
||||
list(APPEND app_sources ../../src/networkDevices/WifiDevice.h)
|
||||
|
||||
list(APPEND app_sources ../../src/networkDevices/EthLan8720Device.cpp)
|
||||
if(NOT DEFINED NUKI_TARGET_H2)
|
||||
list(APPEND app_sources ../../src/networkDevices/WifiDevice.h)
|
||||
endif()
|
||||
|
||||
list(APPEND app_sources ../../src/networkDevices/EthernetDevice.cpp)
|
||||
list(APPEND app_sources ../../src/networkDevices/IPConfiguration.cpp)
|
||||
list(APPEND app_sources ../../src/networkDevices/NetworkDevice.cpp)
|
||||
list(APPEND app_sources ../../src/networkDevices/W5500Device.cpp)
|
||||
list(APPEND app_sources ../../src/networkDevices/WifiDevice.cpp)
|
||||
|
||||
if(NOT DEFINED NUKI_TARGET_H2)
|
||||
list(APPEND app_sources ../../src/networkDevices/WifiDevice.cpp)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${app_sources})
|
||||
|
||||
Reference in New Issue
Block a user