From 53114208cfe78a343cca4f0f2e0705e49e227c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leborne?= Date: Wed, 11 Jan 2023 18:31:09 +0100 Subject: [PATCH 1/2] [Bootloader] Fix display of baudrate used --- pyluos/tools/bootloader.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pyluos/tools/bootloader.py b/pyluos/tools/bootloader.py index 0b71da3..d06d817 100644 --- a/pyluos/tools/bootloader.py +++ b/pyluos/tools/bootloader.py @@ -622,13 +622,6 @@ def reboot_network(device, topic, nodes_to_reboot): # @return None # ******************************************************************************* def luos_flash(args): - print('Luos flash subcommand with parameters :') - print('\t--baudrate : ', args.baudrate) - print('\t--gate : ', args.gate) - print('\t--target : ', args.target) - print('\t--binary : ', args.binary) - print('\t--port : ', args.port) - topic = 1 if not (args.port): @@ -638,6 +631,15 @@ def luos_flash(args): sys.exit() return + baudrate = os.getenv('LUOS_BAUDRATE', args.baudrate) + + print('Luos flash subcommand with parameters :') + print('\t--baudrate : ', baudrate) + print('\t--gate : ', args.gate) + print('\t--target : ', args.target) + print('\t--binary : ', args.binary) + print('\t--port : ', args.port) + # state used to check each step machine_state = True # list of all the nodes that may fail in each step @@ -654,7 +656,7 @@ def luos_flash(args): f.close() # init device - device = Device(args.port, baudrate=os.getenv('LUOS_BAUDRATE', args.baudrate), background_task=False) + device = Device(args.port, baudrate=baudrate, background_task=False) # find routing table state = find_network(device) @@ -759,9 +761,6 @@ def luos_flash(args): # @return None # ******************************************************************************* def luos_detect(args): - print('Luos detect subcommand on port : ', args.port) - print('\tLuos detect subcommand at baudrate : ', args.baudrate) - if not (args.port): try: args.port= serial_discover(os.getenv('LUOS_BAUDRATE', args.baudrate))[0] @@ -769,8 +768,13 @@ def luos_detect(args): sys.exit() return + baudrate = os.getenv('LUOS_BAUDRATE', args.baudrate) + + print('Luos detect subcommand on port : ', args.port) + print('\tLuos detect subcommand at baudrate : ', baudrate) + # detect network - device = Device(args.port, baudrate=os.getenv('LUOS_BAUDRATE', args.baudrate)) + device = Device(args.port, baudrate=baudrate) # print network to user print(device.nodes) device.close() From c5786b7963f4f5dc16f8366e4c13f6546caf2a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leborne?= Date: Thu, 12 Jan 2023 18:38:04 +0100 Subject: [PATCH 2/2] [Bootloader] Fix display of baudrate for luos_reset --- pyluos/tools/bootloader.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pyluos/tools/bootloader.py b/pyluos/tools/bootloader.py index d06d817..37c5a16 100644 --- a/pyluos/tools/bootloader.py +++ b/pyluos/tools/bootloader.py @@ -787,9 +787,6 @@ def luos_detect(args): # @return None # ******************************************************************************* def luos_reset(args): - print('Luos discover subcommand on port : ', args.port) - print('\tLuos discover subcommand at baudrate : ', args.baudrate) - if not (args.port): try: args.port= serial_discover(os.getenv('LUOS_BAUDRATE', args.baudrate))[0] @@ -797,10 +794,14 @@ def luos_reset(args): sys.exit() return + baudrate = os.getenv('LUOS_BAUDRATE', args.baudrate) + + print('Luos discover subcommand on port : ', args.port) + print('\tLuos discover subcommand at baudrate : ', args.baudrate) # send rescue command print('Send reset command.') - port = serial.Serial(args.port, os.getenv('LUOS_BAUDRATE', args.baudrate), timeout=0.05) + port = serial.Serial(args.port, baudrate, timeout=0.05) rst_cmd = { 'bootloader': { 'command': { @@ -815,7 +816,7 @@ def luos_reset(args): port.close() # detect network - device = Device(args.port, baudrate=os.getenv('LUOS_BAUDRATE', args.baudrate), background_task=False) + device = Device(args.port, baudrate=baudrate, background_task=False) print(device.nodes) device.close()