scripts: stm32_mem.py: change some formatting, remove unused imports

This commit is contained in:
Nicolas Schodet 2022-02-13 17:04:35 +01:00 committed by Piotr Esden-Tempski
parent eafc634eba
commit f8f2ab2016
1 changed files with 19 additions and 20 deletions

View File

@ -21,10 +21,9 @@
from time import sleep
import struct
import os
from sys import stdout, argv
from sys import stdout
import argparse
import usb
import dfu
CMD_GETCOMMANDS = 0x00
@ -86,7 +85,7 @@ def stm32_scan(args, test):
bmp_devs = []
bmp = 0
if not devs:
if test == True:
if test:
return
print("No DFU devices found!")
@ -107,14 +106,14 @@ def stm32_scan(args, test):
bmp_devs.append(dev)
if bmp == 0:
if test == True:
if test:
return
print("No compatible device found\n")
exit(-1)
if bmp > 1 and not args.serial_target:
if test == True:
if test:
return
print("Found multiple devices:\n")
@ -251,7 +250,7 @@ if __name__ == "__main__":
size = len
if bin[:size] != bytearray(data[:size]):
print("\nMismatch in block at 0x%08X" % addr)
break;
break
bin = bin[1024:]
addr += 1024
len -= 1024