mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
patch time-out WebSocket esp32
This commit is contained in:
@@ -180,6 +180,7 @@ build_src_filter =
|
|||||||
${env:esp8266_16mb_fromitems.build_src_filter}
|
${env:esp8266_16mb_fromitems.build_src_filter}
|
||||||
|
|
||||||
[env:esp32_4mb]
|
[env:esp32_4mb]
|
||||||
|
extra_scripts = pre:tools/patch32_ws.py
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common_env_data.lib_deps_external}
|
${common_env_data.lib_deps_external}
|
||||||
${env:esp32_4mb_fromitems.lib_deps}
|
${env:esp32_4mb_fromitems.lib_deps}
|
||||||
@@ -200,6 +201,7 @@ build_src_filter =
|
|||||||
${env:esp32_4mb_fromitems.build_src_filter}
|
${env:esp32_4mb_fromitems.build_src_filter}
|
||||||
|
|
||||||
[env:esp32_4mb3f]
|
[env:esp32_4mb3f]
|
||||||
|
extra_scripts = pre:tools/patch32_ws.py
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common_env_data.lib_deps_external}
|
${common_env_data.lib_deps_external}
|
||||||
${env:esp32_4mb3f_fromitems.lib_deps}
|
${env:esp32_4mb3f_fromitems.lib_deps}
|
||||||
@@ -221,6 +223,7 @@ build_src_filter =
|
|||||||
${env:esp32_4mb3f_fromitems.build_src_filter}
|
${env:esp32_4mb3f_fromitems.build_src_filter}
|
||||||
|
|
||||||
[env:esp32cam_4mb]
|
[env:esp32cam_4mb]
|
||||||
|
extra_scripts = pre:tools/patch32_ws.py
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common_env_data.lib_deps_external}
|
${common_env_data.lib_deps_external}
|
||||||
${env:esp32cam_4mb_fromitems.lib_deps}
|
${env:esp32cam_4mb_fromitems.lib_deps}
|
||||||
@@ -244,6 +247,7 @@ build_src_filter =
|
|||||||
${env:esp32cam_4mb_fromitems.build_src_filter}
|
${env:esp32cam_4mb_fromitems.build_src_filter}
|
||||||
|
|
||||||
[env:esp32s2_4mb]
|
[env:esp32s2_4mb]
|
||||||
|
extra_scripts = pre:tools/patch32_ws.py
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common_env_data.lib_deps_external}
|
${common_env_data.lib_deps_external}
|
||||||
${env:esp32s2_4mb_fromitems.lib_deps}
|
${env:esp32s2_4mb_fromitems.lib_deps}
|
||||||
@@ -267,6 +271,7 @@ build_src_filter =
|
|||||||
${env:esp32s2_4mb_fromitems.build_src_filter}
|
${env:esp32s2_4mb_fromitems.build_src_filter}
|
||||||
|
|
||||||
[env:esp32c3m_4mb]
|
[env:esp32c3m_4mb]
|
||||||
|
extra_scripts = pre:tools/patch32_ws.py
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common_env_data.lib_deps_external}
|
${common_env_data.lib_deps_external}
|
||||||
${env:esp32c3m_4mb_fromitems.lib_deps}
|
${env:esp32c3m_4mb_fromitems.lib_deps}
|
||||||
@@ -289,6 +294,7 @@ build_src_filter =
|
|||||||
${env:esp32c3m_4mb_fromitems.build_src_filter}
|
${env:esp32c3m_4mb_fromitems.build_src_filter}
|
||||||
|
|
||||||
[env:esp32s3_16mb]
|
[env:esp32s3_16mb]
|
||||||
|
extra_scripts = pre:tools/patch32_ws.py
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common_env_data.lib_deps_external}
|
${common_env_data.lib_deps_external}
|
||||||
${env:esp32s3_16mb_fromitems.lib_deps}
|
${env:esp32s3_16mb_fromitems.lib_deps}
|
||||||
@@ -313,6 +319,7 @@ build_src_filter =
|
|||||||
${env:esp32s3_16mb_fromitems.build_src_filter}
|
${env:esp32s3_16mb_fromitems.build_src_filter}
|
||||||
|
|
||||||
[env:esp32_16mb]
|
[env:esp32_16mb]
|
||||||
|
extra_scripts = pre:tools/patch32_ws.py
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common_env_data.lib_deps_external}
|
${common_env_data.lib_deps_external}
|
||||||
${env:esp32_16mb_fromitems.lib_deps}
|
${env:esp32_16mb_fromitems.lib_deps}
|
||||||
|
|||||||
27
tools/patch32_ws.py
Normal file
27
tools/patch32_ws.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# правим %USERPROFILE%\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFiClient.cpp 27-28
|
||||||
|
# для уменьшения тайм-аута ВебСокетов
|
||||||
|
# #define WIFI_CLIENT_MAX_WRITE_RETRY (10)
|
||||||
|
# #define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)
|
||||||
|
# Прописать скрипт в platformio.ini внутри [env:esp32_4mb3f] написать extra_scripts = pre:tools/patch32_ws.py
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from sys import platform
|
||||||
|
|
||||||
|
if platform == "linux" or platform == "linux2":
|
||||||
|
# linux
|
||||||
|
mainPyPath = '~/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.cpp'
|
||||||
|
else:
|
||||||
|
# windows
|
||||||
|
mainPyPath = os.environ['USERPROFILE'] + '\\.platformio\\packages\\framework-arduinoespressif32\\libraries\\WiFi\\src\\WiFiClient.cpp'
|
||||||
|
|
||||||
|
# print(mainPyPath)
|
||||||
|
|
||||||
|
with open(mainPyPath) as fr:
|
||||||
|
oldData = fr.read()
|
||||||
|
if not 'if WIFI_CLIENT_MAX_WRITE_RETRY (10)' in oldData:
|
||||||
|
shutil.copyfile(mainPyPath, mainPyPath+'.bak')
|
||||||
|
newData = oldData.replace('#define WIFI_CLIENT_MAX_WRITE_RETRY (10)', '#define WIFI_CLIENT_MAX_WRITE_RETRY (2)')
|
||||||
|
newData = newData.replace('#define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)', '#define WIFI_CLIENT_SELECT_TIMEOUT_US (500000)')
|
||||||
|
with open(mainPyPath, 'w') as fw:
|
||||||
|
fw.write(newData)
|
||||||
Reference in New Issue
Block a user