Files
IoTManager/tools/patch8266_16m.py

27 lines
1.1 KiB
Python
Raw Normal View History

2023-09-09 12:19:22 +03:00
# правим %USERPROFILE%\.platformio\platforms\espressif8266\builder\main.py 103-115
# для добавления возможности прошивки 16мб модуля esp8266
2025-01-07 16:22:58 +03:00
Import("env")
2023-09-09 12:19:22 +03:00
import os
import shutil
from sys import platform
2025-01-07 13:46:03 +03:00
2025-01-07 16:22:58 +03:00
pio_home = env.subst("$PROJECT_CORE_DIR")
print(pio_home)
2023-09-09 12:19:22 +03:00
if platform == "linux" or platform == "linux2":
2025-01-07 16:22:58 +03:00
#mainPyPath = '/home/rise/.platformio/platforms/espressif8266@4.0.1/builder/main.py'
mainPyPath = pio_home + '/platforms/espressif8266@4.0.1/builder/main.py'
else:
2025-01-07 16:22:58 +03:00
#mainPyPath = os.environ['USERPROFILE'] + '\\.platformio\\platforms\\espressif8266@4.0.1\\builder\\main.py'
mainPyPath = pio_home + '\\platforms\\espressif8266@4.0.1\\builder\\main.py'
2023-09-09 12:19:22 +03:00
2025-01-07 16:22:58 +03:00
print("FIX 16Mb path: " + mainPyPath)
2023-09-09 12:19:22 +03:00
with open(mainPyPath) as fr:
oldData = fr.read()
if not 'if _value == -0x6000:' in oldData:
shutil.copyfile(mainPyPath, mainPyPath+'.bak')
newData = oldData.replace('_value += 0xE00000 # correction', '_value += 0xE00000 # correction\n\n if _value == -0x6000:\n _value = env[k]-0x40200000')
with open(mainPyPath, 'w') as fw:
fw.write(newData)