better error handling for flashtool

This commit is contained in:
andreas 2023-11-06 17:25:03 +01:00
parent a179de5239
commit 9648901661
1 changed files with 10 additions and 7 deletions

View File

@ -94,13 +94,16 @@ class Flasher():
print("check failed") print("check failed")
return return
imageChipId=param['info']['chipid'] imageChipId=param['info']['chipid']
chip=esptool.ESPLoader.detect_chip(param['port']) try:
print("Detected chip %s, id=%d"%(chip.CHIP_NAME,chip.IMAGE_CHIP_ID)) chip=esptool.ESPLoader.detect_chip(param['port'],trace_enabled=True)
if (chip.IMAGE_CHIP_ID != imageChipId): print("Detected chip %s, id=%d"%(chip.CHIP_NAME,chip.IMAGE_CHIP_ID))
print("##Error: chip id in image %d does not match detected chip"%imageChipId) if (chip.IMAGE_CHIP_ID != imageChipId):
return print("##Error: chip id in image %d does not match detected chip"%imageChipId)
print("Checks OK") return
param['chipname']=chip.CHIP_NAME print("Checks OK")
param['chipname']=chip.CHIP_NAME
except Exception as e:
print("ERROR: ",str(e))
return param return param
def runCheck(self,port,fileName,isFull): def runCheck(self,port,fileName,isFull):
param = self.checkSettings(port,fileName,isFull) param = self.checkSettings(port,fileName,isFull)