解决参数不足运行会报错的问题

This commit is contained in:
ranchuan
2024-10-17 16:36:08 +08:00
parent fbda160e9a
commit 99218a5a4c

View File

@@ -295,11 +295,15 @@ def global_def():
global time_stamp_end
global function_type
global upload_key
arg_num=len(sys.argv)
if(arg_num<=1):
return
init_str="WQKL"
serial_com=sys.argv[1]
b_rate=115200
nb_rate=1500000
arg_num=len(sys.argv)
def set_upload():
global function_type
if(sys.argv[3].endswith('.bin')):
@@ -328,17 +332,16 @@ def global_def():
if(function_type=='upload'):
ram_file=f'bootram_{sys.argv[2]}.bin'
iot_flash_file=sys.argv[3]
ram_file=os.path.join(bin_path(),ram_file)
elif(function_type=='download'):
ram_file=f'{sys.argv[2]}_ram_build.bin'
iot_flash_file=sys.argv[3]
ram_file=os.path.join(bin_path(),ram_file)
elif(function_type=='ram'):
ram_file=sys.argv[2]
iot_flash_file=sys.argv[2]
return
elif(function_type=='convert'):
iot_flash_file=sys.argv[1]
return
ram_file=os.path.join(bin_path(),ram_file)
def print_help():