radiacode
radiacode copied to clipboard
Issues on Radiacode 102 via USB
Describe the bug
When running any of the examples with a Radiacode 102, the program execution stops after a while
To reproduce
Start any of the included examples, in this case I have used webserver.py
Desktop/FW:
- OS: MacOS Sonoma (23A5276g)
- Packages installed by the poetry env.
- Radiacode 102
- FW v04.02
- BOOT 04.00
Additional context
(radiacode-py3.11) (base) leandro-m1@Leandros-M1-Max radiacode % poetry run python3 radiacode-examples/webserver.py
<will use USB connection
Rates updated, sending to 0 connected clients
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
Rates updated, sending to 0 connected clients
Rates updated, sending to 0 connected clients
Rates updated, sending to 0 connected clients
Rates updated, sending to 0 connected clients
Spectrum updated
Rates updated, sending to 1 connected clients
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<process() done, defined at /Users/leandro-m1/radiacode/radiacode-examples/webserver.py:44> exception=error('unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 0)')>
Traceback (most recent call last):
File "/Users/leandro-m1/radiacode/radiacode-examples/webserver.py", line 48, in process
databuf = app.rc_conn.data_buf()
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode/radiacode.py", line 134, in data_buf
r = self.read_request(VS.DATA_BUF)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode/radiacode.py", line 60, in read_request
r = self.execute(b'\x26\x08', struct.pack('<I', int(command_id)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode/radiacode.py", line 54, in execute
response = self._connection.execute(full_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode/transports/usb.py", line 28, in execute
response_length = struct.unpack_from('<I', data)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 0)
Error handling request
Traceback (most recent call last):
File "/Users/leandro-m1/radiacode/.venv/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/.venv/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode-examples/webserver.py", line 28, in handle_spectrum
spectrum = cn.spectrum_accum() if accum else cn.spectrum()
^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode/radiacode.py", line 142, in spectrum_accum
r = self.read_request(VS.SPEC_ACCUM)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode/radiacode.py", line 60, in read_request
r = self.execute(b'\x26\x08', struct.pack('<I', int(command_id)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/leandro-m1/radiacode/radiacode/radiacode.py", line 56, in execute
assert req_header == resp_header, f'req={req_header.hex()} resp={resp_header.hex()}'
^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: req=2608008c resp=2608008b
Let me know if you need any more information, I don't know if the 102 is supposed to even work with this library. Note: I've checked #9 , but still facing this issue on v0.2.0 Thanks!