mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 20:09:14 +03:00
undo ~, try exception
This commit is contained in:
@@ -10,13 +10,13 @@ from sys import platform
|
|||||||
|
|
||||||
if platform == "linux" or platform == "linux2":
|
if platform == "linux" or platform == "linux2":
|
||||||
# linux
|
# linux
|
||||||
mainPyPath = '~/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.cpp'
|
mainPyPath = '/home/rise/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.cpp'
|
||||||
else:
|
else:
|
||||||
# windows
|
# windows
|
||||||
mainPyPath = os.environ['USERPROFILE'] + '\\.platformio\\packages\\framework-arduinoespressif32\\libraries\\WiFi\\src\\WiFiClient.cpp'
|
mainPyPath = os.environ['USERPROFILE'] + '\\.platformio\\packages\\framework-arduinoespressif32\\libraries\\WiFi\\src\\WiFiClient.cpp'
|
||||||
|
|
||||||
# print(mainPyPath)
|
# print(mainPyPath)
|
||||||
|
try:
|
||||||
with open(mainPyPath) as fr:
|
with open(mainPyPath) as fr:
|
||||||
oldData = fr.read()
|
oldData = fr.read()
|
||||||
if not 'if WIFI_CLIENT_MAX_WRITE_RETRY (10)' in oldData:
|
if not 'if WIFI_CLIENT_MAX_WRITE_RETRY (10)' in oldData:
|
||||||
@@ -25,3 +25,5 @@ with open(mainPyPath) as fr:
|
|||||||
newData = newData.replace('#define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)', '#define WIFI_CLIENT_SELECT_TIMEOUT_US (500000)')
|
newData = newData.replace('#define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)', '#define WIFI_CLIENT_SELECT_TIMEOUT_US (500000)')
|
||||||
with open(mainPyPath, 'w') as fw:
|
with open(mainPyPath, 'w') as fw:
|
||||||
fw.write(newData)
|
fw.write(newData)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("Файл не найден или не удается открыть")
|
||||||
@@ -5,14 +5,15 @@ from sys import platform
|
|||||||
|
|
||||||
if platform == "linux" or platform == "linux2":
|
if platform == "linux" or platform == "linux2":
|
||||||
# linux
|
# linux
|
||||||
devkitm = '~/.platformio/platforms/espressif32/boards/esp32-c6-devkitm-1.json'
|
devkitm = '/home/rise/.platformio/platforms/espressif32/boards/esp32-c6-devkitm-1.json'
|
||||||
devkitc = '~/.platformio/platforms/espressif32/boards/esp32-c6-devkitc-1.json'
|
devkitc = '/home/rise/.platformio/platforms/espressif32/boards/esp32-c6-devkitc-1.json'
|
||||||
else:
|
else:
|
||||||
# windows
|
# windows
|
||||||
devkitm = os.environ['USERPROFILE'] + '\\.platformio\\platforms\\espressif32\\boards\\esp32-c6-devkitm-1.json'
|
devkitm = os.environ['USERPROFILE'] + '\\.platformio\\platforms\\espressif32\\boards\\esp32-c6-devkitm-1.json'
|
||||||
devkitc = os.environ['USERPROFILE'] + '\\.platformio\\platforms\\espressif32\\boards\\esp32-c6-devkitc-1.json'
|
devkitc = os.environ['USERPROFILE'] + '\\.platformio\\platforms\\espressif32\\boards\\esp32-c6-devkitc-1.json'
|
||||||
|
|
||||||
def add_arduino_to_frameworks(file_name):
|
def add_arduino_to_frameworks(file_name):
|
||||||
|
try:
|
||||||
with open(file_name, 'r+') as f:
|
with open(file_name, 'r+') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
frameworks = data['frameworks']
|
frameworks = data['frameworks']
|
||||||
@@ -24,6 +25,8 @@ def add_arduino_to_frameworks(file_name):
|
|||||||
f.truncate()
|
f.truncate()
|
||||||
else:
|
else:
|
||||||
print(f"Arduino already exists in {file_name}")
|
print(f"Arduino already exists in {file_name}")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("Файл не найден или не удается открыть")
|
||||||
|
|
||||||
if os.path.exists(devkitm) and os.path.exists(devkitc):
|
if os.path.exists(devkitm) and os.path.exists(devkitc):
|
||||||
add_arduino_to_frameworks(devkitm)
|
add_arduino_to_frameworks(devkitm)
|
||||||
|
|||||||
Reference in New Issue
Block a user