esp-ota-test.py (552B)
1 import sys 2 import os 3 4 idf_path = os.environ["IDF_PATH"] # get value of IDF_PATH from environment 5 otatool_dir = os.path.join(idf_path, "components", "app_update") # otatool.py lives in $IDF_PATH/components/app_update 6 7 sys.path.append(otatool_dir) # this enables Python to find otatool module 8 from otatool import * # import all names inside otatool module 9 10 target = OtatoolTarget("/dev/ttyACM0") 11 target.switch_ota_partition(0) 12 #print(target._get_otadata_info()) 13 14 #target.erase_otadata() 15 #target.erase_ota_partition(1) 16 #target.switch_ota_partition(1)