matthiasbock / cvra-bootloader

CAN-Bootloader of the Club Vaudois de Robotique Autonome
BSD 2-Clause "Simplified" License
0 stars 1 forks source link

ValueError: invalid literal for int() with base 16 #17

Open matthiasbock opened 6 years ago

matthiasbock commented 6 years ago
$ bootloader_flash -p /dev/ttyCANtact 1 -c "Test" -f test.elf
t321704806400000000
t3217048t321704806400000000
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "cvra-bootloader/client/env/lib/python3.5/site-packages/cvra_bootloader-2.1.0-py3.5.egg/can/adapters/slcan.py", line 99, in spin
    frame = self.decode_frame(frame)
  File "cvra-bootloader/client/env/lib/python3.5/site-packages/cvra_bootloader-2.1.0-py3.5.egg/can/adapters/slcan.py", line 134, in decode_fr
    data = [int(msg[i:i + 2], 16) for i in range(0, 2 * data_len, 2)]
  File "cvra-bootloader/client/env/lib/python3.5/site-packages/cvra_bootloader-2.1.0-py3.5.egg/can/adapters/slcan.py", line 134, in <listcomp>
    data = [int(msg[i:i + 2], 16) for i in range(0, 2 * data_len, 2)]
ValueError: invalid literal for int() with base 16: '8t'

The following boards are offline: 1. Aborting.

See also matthiasbock/cantact-fw#5

The bootloader client should catch such errors instead of raising on exception.

matthiasbock commented 6 years ago

Although this is a problem with the CANtact adapter firmware, the client should also be able to handle such situations gracefully, e.g. by discarding malformed frames and attempting to continue operation.

matthiasbock commented 6 years ago

Problem persists with bootloader v2.1.2 using CANtact v2.8.2.

image image image